Commit Graph

12431 Commits

Author SHA1 Message Date
Karel Zak a15dca2f6d include/debug: introduce __UL_INIT_DEBUG_FROM_STRING()
Let's make it possible to use debug.h without environment variables.

Suggested-by: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-17 13:58:29 +01:00
J William Piggott de4568f757 hwclock: rename --debug option to --verbose
Warn on --debug; do not fallthrough because
the message is lost in the verbose output.

Coauthored-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2018-01-17 13:29:11 +01:00
J William Piggott a4b55ad008 cal: update man page
Update cal.1 with the new options --reform and --iso.

Also add information about the calendar systems used and
the difference between the --julian option and the Julian
calendar system.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2018-01-16 13:51:43 -05:00
J William Piggott ae51e7b429 cal: add option to set Gregorian reform date
Create the new option: --reform <1752|gregorian|iso|julian>

This adds the capability to display either the proleptic Gregorian or
the Julian calendar systems exclusively.

Also create the option --iso as alias of --reform=gregorian.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
2018-01-16 13:51:24 -05:00
J William Piggott db9baa8ab7 cal: move REFORMATION_YEAR to control struct
Signed-off-by: J William Piggott <elseifthen@gmx.com>
2018-01-15 11:06:36 -05:00
Karel Zak 7bd0c1ae18 include/debug: improve debug message
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-12 13:46:49 +01:00
Karel Zak 66643f3151 include/debug: print info when addresses suppressed
Suggested-by: Peter Cordes <peter@cordes.ca>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-12 13:37:05 +01:00
Karel Zak 7e95fd82b7 sfdisk: cleanup shortcuts in man page too
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-12 12:38:58 +01:00
Karel Zak e92b6f68c4 libfdisk: (script) be consistent in code with types
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-12 12:04:16 +01:00
Karel Zak bc9ca775a2 Merge branch 'mbsencode' of https://github.com/yontalcar/util-linux
* 'mbsencode' of https://github.com/yontalcar/util-linux:
  tests: mark mbsencode as KNOWN_FAIL
  tests: mbsencode - test for HAVE_WIDECHAR
  lib/mbsalign: Fix escaping nonprintable multibyte characters
  tests: mbsencode - removed emoji, added control unicode character
  tests: add tests for encode functions from lib/mbsalign.c
  lib/mbsalign: escape "\x" when HAVE_WIDECHAR not defined
2018-01-12 11:59:22 +01:00
Karel Zak 6d00cfb233 include/debug: don't print pointer address for SUID programs
* introduce new flag __UL_DEBUG_FL_NOADDR to suppress pointer address printing

* use __UL_DEBUG_FL_NOADDR when SUID

* move ul_debugobj() to debugobj.h, and require UL_DEBUG_CURRENT_MASK
  to provide access to the current mask from ul_debugobj(). It's better
  than modify all ul_debugobj() calls and use the global mask as
  argument.

* remove never used UL_DEBUG_DEFINE_FLAG

Reported-by: halfdog <me@halfdog.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-12 11:01:26 +01:00
Karel Zak 9c76f85f9a libfdisk: allow to start freespace for zero
This is necessary for disk labels like SUN where whole disk is possible
to address by partitions.

Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-11 15:18:00 +01:00
Karel Zak f7606d2d9f libfdisk: (sun) fix n-1 bug and whole-disk
* set whole_disk variable if SUN_TAG_WHOLEDISK specified
* fix N-1 bug in add new partition according to template (script)

Addresses: https://github.com/karelzak/util-linux/issues/555
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-11 14:23:57 +01:00
Vaclav Dolezal fb178a04af tests: mark mbsencode as KNOWN_FAIL
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-11 14:19:23 +01:00
Vaclav Dolezal 8326119ad1 tests: mbsencode - test for HAVE_WIDECHAR
Test only safe-ascii as it should behave in the same way.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-11 11:11:31 +01:00
Vaclav Dolezal edf86d6bc0 lib/mbsalign: Fix escaping nonprintable multibyte characters
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-11 10:42:22 +01:00
Vaclav Dolezal 910a879f3d tests: mbsencode - removed emoji, added control unicode character
Emojis are apparently too recent to be reliably recognised as printable
on test machines.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-11 10:38:43 +01:00
Karel Zak b0feeab5e2 Merge branch 'fixes' of https://github.com/rudimeier/util-linux 2018-01-11 10:09:48 +01:00
Tony Asleson f82b085c31 libblkid: Add support for stratis
Initial support for stratis, ref.
https://github.com/stratis-storage

[kzak@redhat.com: - remove C++ comment]

Signed-off-by: Tony Asleson <tasleson@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-11 10:08:24 +01:00
Vaclav Dolezal cad13ba344 tests: add tests for encode functions from lib/mbsalign.c
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2018-01-10 17:40:53 +01:00
Ruediger Meier 845dac5f8e misc: fix printf i386 compiler warnings
sys-utils/lsns.c:683:2: error: format ‘%lu’ expects argument of type ‘long unsigned int’, but argument 4 has type ‘ino_t’ [-Werror=format=]

Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
2018-01-09 23:12:19 +01:00
Karel Zak 6ebc37854d libfdisk: (script) support R (RAID) and V (LVM) shortcuts
Addresses: https://github.com/karelzak/util-linux/issues/560
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-09 12:12:50 +01:00
Karel Zak af846e1ff9 libfdisk: (gpt) add VMware specific UUIDs
Addresses: https://github.com/karelzak/util-linux/issues/559
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-08 12:43:22 +01:00
Karel Zak b5cc232362 libmount: fix mnt_table_is_fs_mounted() for rbind
There is no difference between "bind" and "rbind" if we want to FS
root to search for the FS in mountinfo file.

fstab:

 /dev/sdc1       /mnt/foo        xfs     defaults        0 0
 /mnt/foo        /mnt/test       none    rw,rbind        0 0

use -a more than once:

  mount -a
  mount -a

/proc/mounts (the current result):

 /dev/sdc1 /mnt/foo xfs rw,relatime,attr2,inode64,noquota 0 0
 /dev/sdc1 /mnt/test xfs rw,relatime,attr2,inode64,noquota 0 0
 /dev/sdc1 /mnt/test xfs rw,relatime,attr2,inode64,noquota 0 0
 /dev/sdc1 /mnt/foo xfs rw,relatime,attr2,inode64,noquota 0 0

expected (fixed version) result:

 /dev/sdc1 /mnt/foo xfs rw,relatime,attr2,inode64,noquota 0 0
 /dev/sdc1 /mnt/test xfs rw,relatime,attr2,inode64,noquota 0 0

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1528959
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-03 14:02:27 +01:00
Karel Zak 280b975475 libfdisk: (dos) fix max heads
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-02 16:50:31 +01:00
Karel Zak 2dd2880f12 libfdisk: extend API to provide label specific geometry ranges
Now fdisk provides DOS specific geometry ranges in expert menu.

Addresses: https://github.com/karelzak/util-linux/issues/556
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-02 16:43:22 +01:00
Sami Kerola c8ff2e5562 rtcwake: wait stdin to settle down before entering a system sleep
This can delay entering to system sleep up to 0.28 seconds while discarding
input, when stdin is interactive device.

[kzak@redhat.com: - add note to the man page]

Reference: https://github.com/karelzak/util-linux/issues/527
See-also: a85c390134
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-02 15:14:37 +01:00
Karel Zak a60d6b5217 sfdisk: wait before re-read
The original old (v2.13) fdisk had sleep(2) beany ideafore re-read ioctl. It
seems overkill, but short sleep is probably a good idea as we call
re-read on sfdisk start and at the end. It's possible that sfdisk is
too fast and the initial re-read is not gone yet.

It would be nice to have something more elegant than sleep, any idea?

Addresses: https://github.com/karelzak/util-linux/issues/557
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-02 14:48:01 +01:00
Karel Zak 701ad607a5 Merge branch 'patch-1' of https://github.com/kenyon/util-linux 2018-01-02 14:06:40 +01:00
Karel Zak 4f1d6870b5 Merge branch 'master' of https://github.com/yurchor/util-linux 2018-01-02 14:05:37 +01:00
Karel Zak 4ff4b1106e lib/sha1: use proper WORDS_BIGENDIAN macro
The original code uses BYTE_ORDER, but we use WORDS_BIGENDIAN in
utl-linux.

Reported-by: Andreas Schwab <schwab@linux-m68k.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2018-01-02 11:08:03 +01:00
Yuri Chornoivan e2215a8545 Fix minor typo: priorty -> priority 2017-12-31 13:07:43 +02:00
Kenyon Ralph deff4975a1
rename.1: fix typo, where -> were 2017-12-23 13:44:34 -08:00
Vaclav Dolezal 2ba65f379d lib/mbsalign: escape "\x" when HAVE_WIDECHAR not defined
Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-12-22 12:32:36 +01:00
Karel Zak 43afa84581 lib/mbsalign: encode \x to \xecx
Don't encode stand alone '\', our encoding is about \x<hex>, so we
need to care about \x prefix only.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-20 13:01:43 +01:00
Karel Zak 760942e284 libfdisk: (gpt) use fdisk_warn() for failed name setting
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-20 12:31:10 +01:00
Karel Zak 33d2e5a1ed Merge branch 'gpt-part-name' of https://github.com/yontalcar/util-linux
* 'gpt-part-name' of https://github.com/yontalcar/util-linux:
  libfdisk: return bytes processed from gpt_entry_set_name(), process rc
  libfdisk: allocate enough bytes for ucs2 to utf8 encoding
  libfdisk: gpt: properly encode string on rename
  lib/mbsalign: encode backslash to prevent ambiguity
2017-12-20 12:29:16 +01:00
Karel Zak 03700127a7 tests: don't use mount.<type> helpers in mount-by-pattern tests
The test behavior is fragile if depends on external helpers. Let's
keep it based on mount(2) only. The test will be faster too.

Note that "mount -t <pattern>" does not behaviour as expected with
helpers. We need to try another helper if the current one ends with
status=1 (waitpid()). Now it returns status from the first helper.

Reported-by: Ruediger Meier <sweet_f_a@gmx.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-19 13:51:12 +01:00
Vaclav Dolezal c116524184 libfdisk: return bytes processed from gpt_entry_set_name(), process rc
Made gpt_entry_set_name() return number of utf8 bytes processed on
success, so info message about change can be accurate.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-12-19 10:48:13 +01:00
Vaclav Dolezal f069f6fe69 libfdisk: allocate enough bytes for ucs2 to utf8 encoding
Allocate 3*number_of_ucs2_characters bytes for utf8 output.

Also as we are using calloc there's no need to write terminating null
byte.

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-12-18 16:18:44 +01:00
Vaclav Dolezal 5be3df4afd libfdisk: gpt: properly encode string on rename
GPT partition name entry should be recorded as little endian UCS2, so I have
written proper conversion (assuming UTF8 input).

Signed-off-by: Vaclav Dolezal <vdolezal@redhat.com>
2017-12-18 16:17:49 +01:00
Karel Zak cf9b16f1d4 build-sys: don't check for swapon() number of arguments
The syscall swapon() with two arguments is supported since Linux 1.3.2
and it's really long time ago... Let's assume that all libc header files
have been already fixed.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-18 13:57:20 +01:00
Karel Zak 10211619dc libblkid: (bcache) cleanup magic string definition
Reported-by: Sami Kerola <kerolasa@iki.fi>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-18 13:03:46 +01:00
Karel Zak 6ce7eca36c cal: fix multi-byte comment, explain in better way
On Sun, Dec 17, 2017 at 07:47:49PM -0500, J William Piggott wrote
> * it contains multi-byte characters (which is what drew me to reading it).
> * it truncates one very important piece of the formula: ". . . (mod 7)."
> * it explains the values for 'e', but there is no 'e' in the code.
> * it doesn't include a row resolving 'e' in the table, so it is not
>    obvious what it relates to in the code.
> * without citing it as an external reference, the comment language is confusing.

Co-Author: J William Piggott <elseifthen@gmx.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-18 12:44:03 +01:00
Karel Zak 7468a8d106 whereis: fix typo in debug message
Reported-by: Matthew White <mehw.is.me@inventati.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-14 15:52:57 +01:00
Karel Zak b9c650106b Revert "cal: simplify leap year rule"
It was mistake, we use extra rule for date < 1752 from the beginning
and another calculations depends on this.

This reverts commit b9bd8dc267.
2017-12-14 13:19:08 +01:00
Karel Zak 3c49b23ad6 cal: explain magic values for day of week calculation
Based on BERNDT E.SCHWERDTFEGER papers.

Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-13 19:09:56 +01:00
Masatake YAMATO 616e75c02c fincore: fix a typo in fincore.1
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2017-12-13 13:06:54 +01:00
Karel Zak 68452bb568 tests: update libsmartcols/title
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-13 12:57:22 +01:00
Karel Zak 3fa48b118a libsmartcols: don't add blank padding after left aligned title
Let's use the same semantic for the title as for the last column in
the table. If aligned on left, table is not "maxout" and title padding
symbol is undefined (or blank) then keep title as short as possible.

Addresses: https://github.com/karelzak/util-linux/issues/549
Signed-off-by: Karel Zak <kzak@redhat.com>
2017-12-12 13:19:36 +01:00