]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
7 years agocolumns: add note about width
Karel Zak [Tue, 11 Apr 2017 10:40:39 +0000 (12:40 +0200)] 
columns: add note about width

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: use NOEXTREMES for the last column
Karel Zak [Mon, 3 Apr 2017 12:43:13 +0000 (14:43 +0200)] 
column: use NOEXTREMES for the last column

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: add support for trees
Karel Zak [Fri, 31 Mar 2017 13:09:45 +0000 (15:09 +0200)] 
column: add support for trees

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: clean up man page
Karel Zak [Wed, 29 Mar 2017 12:46:07 +0000 (14:46 +0200)] 
column: clean up man page

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: clean up usage() and options order
Karel Zak [Wed, 29 Mar 2017 12:45:44 +0000 (14:45 +0200)] 
column: clean up usage() and options order

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: add --table-order
Karel Zak [Wed, 29 Mar 2017 12:08:14 +0000 (14:08 +0200)] 
column: add --table-order

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: fix typo
Karel Zak [Wed, 29 Mar 2017 11:17:12 +0000 (13:17 +0200)] 
column: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: add --table-hide
Karel Zak [Wed, 29 Mar 2017 10:52:41 +0000 (12:52 +0200)] 
column: add --table-hide

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: add --table-wrap
Karel Zak [Wed, 29 Mar 2017 10:46:54 +0000 (12:46 +0200)] 
column: add --table-wrap

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: add --table-noextreme
Karel Zak [Wed, 29 Mar 2017 10:38:52 +0000 (12:38 +0200)] 
column: add --table-noextreme

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: add --table-truncate
Karel Zak [Wed, 29 Mar 2017 10:26:35 +0000 (12:26 +0200)] 
column: add --table-truncate

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: rename options
Karel Zak [Wed, 29 Mar 2017 10:00:48 +0000 (12:00 +0200)] 
column: rename options

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: fix greedy initialization
Karel Zak [Mon, 6 Mar 2017 12:32:52 +0000 (13:32 +0100)] 
column: fix greedy initialization

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: add --table-colright
Karel Zak [Mon, 6 Mar 2017 11:57:24 +0000 (12:57 +0100)] 
column: add --table-colright

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: use err_exclusive_options()
Karel Zak [Mon, 6 Mar 2017 11:09:59 +0000 (12:09 +0100)] 
column: use err_exclusive_options()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: make mbs/wcs conversions more robust
Karel Zak [Mon, 6 Mar 2017 11:05:09 +0000 (12:05 +0100)] 
column: make mbs/wcs conversions more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: add --json
Karel Zak [Mon, 6 Mar 2017 10:58:15 +0000 (11:58 +0100)] 
column: add --json

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: add --table-colnames
Karel Zak [Mon, 6 Mar 2017 10:37:01 +0000 (11:37 +0100)] 
column: add --table-colnames

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: rename too generic macro
Karel Zak [Fri, 3 Mar 2017 11:20:47 +0000 (12:20 +0100)] 
column: rename too generic macro

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: use libsmartcols for --table
Karel Zak [Fri, 3 Mar 2017 11:17:44 +0000 (12:17 +0100)] 
column: use libsmartcols for --table

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: clean up multi-byte #ifelse
Karel Zak [Thu, 2 Mar 2017 13:50:03 +0000 (14:50 +0100)] 
column: clean up multi-byte #ifelse

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: reorder functions
Karel Zak [Thu, 2 Mar 2017 13:41:22 +0000 (14:41 +0100)] 
column: reorder functions

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: rename functions
Karel Zak [Thu, 2 Mar 2017 13:38:04 +0000 (14:38 +0100)] 
column: rename functions

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: add column(1) table test
Karel Zak [Thu, 2 Mar 2017 13:34:08 +0000 (14:34 +0100)] 
tests: add column(1) table test

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: add column(1) columnate test
Karel Zak [Thu, 2 Mar 2017 13:21:16 +0000 (14:21 +0100)] 
tests: add column(1) columnate test

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: don't ignore mbs_to_wcs() errors
Karel Zak [Thu, 2 Mar 2017 13:04:47 +0000 (14:04 +0100)] 
column: don't ignore mbs_to_wcs() errors

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: add column/files directory
Karel Zak [Thu, 2 Mar 2017 13:00:53 +0000 (14:00 +0100)] 
tests: add column/files directory

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: make input() more generic
Karel Zak [Wed, 1 Mar 2017 14:05:47 +0000 (15:05 +0100)] 
column: make input() more generic

* remove line size limit
* use multi-byte rather than wchar when read input
* prepare for future libsmartcols use in input() for table

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: use colntrol struct on more places
Karel Zak [Wed, 1 Mar 2017 12:58:00 +0000 (13:58 +0100)] 
column: use colntrol struct on more places

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumns: add control struct
Karel Zak [Wed, 1 Mar 2017 12:11:59 +0000 (13:11 +0100)] 
columns: add control struct

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agocolumn: split old and new code
Karel Zak [Fri, 24 Feb 2017 13:05:59 +0000 (14:05 +0100)] 
column: split old and new code

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'master' of https://github.com/pali/util-linux
Karel Zak [Tue, 2 May 2017 09:28:42 +0000 (11:28 +0200)] 
Merge branch 'master' of https://github.com/pali/util-linux

* 'master' of https://github.com/pali/util-linux:
  tests: Add UDF hdd images created by Linux mkudffs 1.3
  tests: Rename udf-hdd-mkudffs* images to indicate used mkudffs version
  libblkid: udf: For better readibility use one snprintf call instead multiple in loop

7 years agoMerge branch '170419' of github.com:jwpi/util-linux
Karel Zak [Tue, 2 May 2017 09:12:33 +0000 (11:12 +0200)] 
Merge branch '170419' of github.com:jwpi/util-linux

* '170419' of github.com:jwpi/util-linux:
  hwclock: use a consistent name for --predict
  hwclock: remove unneeded braces
  hwclock: make clock test mode message consistent
  hwclock: extra messages for debug only

7 years agotests: Add UDF hdd images created by Linux mkudffs 1.3
Pali Rohár [Mon, 1 May 2017 08:03:08 +0000 (10:03 +0200)] 
tests: Add UDF hdd images created by Linux mkudffs 1.3

$ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-1.img bs=1M count=10
$ mkudffs -l Label -b 512 udf-hdd-mkudffs-1.3-1.img

$ dd if=/dev/zero of=udf-hdd-mkudffs-1.3-2.img bs=1M count=10
$ mkudffs -l Label udf-hdd-mkudffs-1.3-2.img

7 years agotests: Rename udf-hdd-mkudffs* images to indicate used mkudffs version
Pali Rohár [Mon, 1 May 2017 07:32:01 +0000 (09:32 +0200)] 
tests: Rename udf-hdd-mkudffs* images to indicate used mkudffs version

7 years agolibblkid: udf: For better readibility use one snprintf call instead multiple in loop
Pali Rohár [Mon, 1 May 2017 07:28:22 +0000 (09:28 +0200)] 
libblkid: udf: For better readibility use one snprintf call instead multiple in loop

7 years agolib/timer: add comment
Karel Zak [Fri, 28 Apr 2017 11:25:41 +0000 (13:25 +0200)] 
lib/timer: add comment

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'timer' of https://github.com/Villemoes/util-linux
Karel Zak [Fri, 28 Apr 2017 11:02:02 +0000 (13:02 +0200)] 
Merge branch 'timer' of https://github.com/Villemoes/util-linux

7 years agolibmount: (docs) remove unwanted tag
Karel Zak [Fri, 28 Apr 2017 10:39:21 +0000 (12:39 +0200)] 
libmount: (docs) remove unwanted tag

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agotests: update libmount outputs
Karel Zak [Fri, 28 Apr 2017 09:19:59 +0000 (11:19 +0200)] 
tests: update libmount outputs

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: add read-only warning
Karel Zak [Fri, 28 Apr 2017 09:03:24 +0000 (11:03 +0200)] 
libmount: add read-only warning

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoinclude/exitcodes: remove mount(8) exit codes
Karel Zak [Thu, 27 Apr 2017 12:26:45 +0000 (14:26 +0200)] 
include/exitcodes: remove mount(8) exit codes

All defined by libmount now.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agofstrim: use MNT_EX_* from libmount
Karel Zak [Thu, 27 Apr 2017 12:26:16 +0000 (14:26 +0200)] 
fstrim: use MNT_EX_* from libmount

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agomount: use MNT_EX_* from libmount
Karel Zak [Thu, 27 Apr 2017 12:26:02 +0000 (14:26 +0200)] 
mount: use MNT_EX_* from libmount

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoumount: use MNT_EX_* from libmount
Karel Zak [Thu, 27 Apr 2017 12:25:57 +0000 (14:25 +0200)] 
umount: use MNT_EX_* from libmount

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: (docs) add unused declarations
Karel Zak [Thu, 27 Apr 2017 12:17:50 +0000 (14:17 +0200)] 
libmount: (docs) add unused declarations

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agomount, umount: use mnt_context_get_excode()
Karel Zak [Thu, 27 Apr 2017 12:11:50 +0000 (14:11 +0200)] 
mount, umount: use mnt_context_get_excode()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibmount: add mnt_context_get_excode()
Karel Zak [Thu, 27 Apr 2017 12:01:26 +0000 (14:01 +0200)] 
libmount: add mnt_context_get_excode()

It's pretty complex task to make mount(8) and umount(8) return code
and generate error message. It seems better to do that in the libmount
rather than force all library users to duplicate mount(8) mk_exit_code()
functions. It also means that all the messages will be translated only
once. Changes:

* all error messages are printed by warn()
* no more multi-line messages
* all messages prefixed by mount target (mountpoint)
* library provides mount(8) compatible MNT_EX_* codes

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1429531
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agohwclock: use a consistent name for --predict
J William Piggott [Thu, 20 Apr 2017 13:34:33 +0000 (09:34 -0400)] 
hwclock: use a consistent name for --predict

The predict function name is documented as '--predict', but the
code uses '--predict-hc'. This works okay, except that the
'mutually exclusive' error message prints the undocumented name.

* sys-utils/hwclock.c: rename 'predict-hc' to 'predict' so that
    it matches the man-page. This should not be a problem because
    'predict-hc' was never documented.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: remove unneeded braces
J William Piggott [Thu, 20 Apr 2017 00:27:53 +0000 (20:27 -0400)] 
hwclock: remove unneeded braces

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: make clock test mode message consistent
J William Piggott [Wed, 19 Apr 2017 23:54:28 +0000 (19:54 -0400)] 
hwclock: make clock test mode message consistent

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: extra messages for debug only
J William Piggott [Wed, 19 Apr 2017 23:29:26 +0000 (19:29 -0400)] 
hwclock: extra messages for debug only

Only print extra save_adjtime() messages in debug mode. This makes
the --test mode output consistent accross functions.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agolibmount: support MS_RDONLY on write-protected devices
Karel Zak [Wed, 26 Apr 2017 15:27:02 +0000 (17:27 +0200)] 
libmount: support MS_RDONLY on write-protected devices

This feature is supported by mount(8) only. It seems better move
this code to libmount. The results is more simple mount(8) and the
feature is accessible for all libmount users.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolib/timer.c: prevent pathological race condition
Rasmus Villemoes [Wed, 26 Apr 2017 11:03:10 +0000 (13:03 +0200)] 
lib/timer.c: prevent pathological race condition

flock(1) uses the timer facility to interrupt a blocking flock(2)
call. However, in a pathological case (or with a sufficiently short
timeout), the timer may fire and the signal be delivered after the
timer is set up, but before we get around to doing the flock(2)
call. In that case, we'd block forever. Checking timeout_expired right
before calling flock(2) does not eliminate that race, so the only
option is to make the timer fire repeatedly. Having the timer fire
after we've returned from flock(2) is not a problem, since we only
check timeout_expired in case of EINTR (also, this firing after return
could also happen with the current code).

There is currently one other user of setup_timer (misc-utils/uuidd.c),
but in that case the signal handler simply exits. Future users of
setup_timer obviously need to ensure that they can tolerate multiple
signal deliveries.

Choosing 1% of the initial timeout as the repeating interval is
somewhat arbitrary. However, I put a lower bound of 0.01s, since
setting the interval much smaller than this may end up effectively
live-locking the process, handling a never-ending stream of signals.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
7 years agolib/timer.c: remove bogus SA_SIGINFO from timer_settime call
Rasmus Villemoes [Wed, 26 Apr 2017 10:56:08 +0000 (12:56 +0200)] 
lib/timer.c: remove bogus SA_SIGINFO from timer_settime call

The only valid flag for timer_settime is TIMER_ABSTIME, which we
certainly don't want here. This seems to be harmless since
timer_settime doesn't validate the flags parameter, TIMER_ABSTIME is
universally 0x1, and no architecture has SA_SIGINFO == 1.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
7 years agoumount: fix typo
Karel Zak [Wed, 26 Apr 2017 10:34:48 +0000 (12:34 +0200)] 
umount: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoswitch_root: unlink files without _DIRENT_HAVE_D_TYPE
Patrick Steinhardt [Sun, 23 Apr 2017 00:33:04 +0000 (02:33 +0200)] 
switch_root: unlink files without _DIRENT_HAVE_D_TYPE

When _DIRENT_HAVE_D_TYPE is not defined, we need to always fstat the
directory entry in order to determine whether it is a directory or not.
If we determine that the file is indeed a directory on the same device,
we proceed to recursively remove its contents as well. Otherwise, we
simply skip removing the entry altogether.

This logic is not entirely correct though. Note that we actually skip
deletion of the entry if it is either not a directory or if it is not on
the same device. The second condition is obviously correct here, as we
do not want to delete files on other mounts here. But skipping deletion
of the entry itself if it is not a directory is wrong.

When _DIRENT_HAVE_D_TYPE is defined, this condition should never be
triggered, as we have already determined that the entry is a directory.
But if it is not, we will always do the fstat and check. Because of
this, we will now skip deletion of all files which are not directories,
which is wrong.

Fix the issue by disentangling both conditions. We now first check
whether we are still on the same device - if not, we skip recursive
deletion as well as deletion of the directory entry. Afterwards, we
check whether it is a directory - if so, we do delete its contents
recursively. And finally, we will now unlink the entry disregarding
whether it is a directory or not.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
7 years agoMerge branch '170415' of github.com:jwpi/util-linux
Karel Zak [Wed, 26 Apr 2017 09:17:46 +0000 (11:17 +0200)] 
Merge branch '170415' of github.com:jwpi/util-linux

* '170415' of github.com:jwpi/util-linux:
  optutils.h: don't print non-graph characters
  hwclock: improve audit control
  hwclock: --set and --predict segmentation fault
  hwclock: make epoch functions alpha only
  hwclock: improve default function handling

7 years agolibfdisk: fix NLS support
Karel Zak [Tue, 25 Apr 2017 15:05:09 +0000 (17:05 +0200)] 
libfdisk: fix NLS support

The current libfdisk code uses gettext() to translate strings. It
means it follows the default text domain (as set by textdomain(3)
usually in the main program). This is useless for public shared
library.

We have call private bindtextdomain() and use dgettext() with private
domain name to be independent on the main program. For this purpose
include/nls.h supports UL_TEXTDOMAIN_EXPLICIT to use dgettext().

Note that libfdisk will continue to use util-linux.po, rather than
keep the texts in the separate file.

The nls.h has to be included only from fdiskP.h to be sure that
nls.h works as expected for the library.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsblk: don't duplicate columns
Karel Zak [Wed, 19 Apr 2017 12:28:16 +0000 (14:28 +0200)] 
lsblk: don't duplicate columns

$ lsblk --discard --perms
NAME   DISC-ALN DISC-GRAN DISC-MAX DISC-ZERO NAME     SIZE OWNER GROUP MODE
sdb           0        0B       0B         0 sdb     74.5G root  disk  brw-rw----
└─sdb1        0        0B       0B         0 └─sdb1  74.5G root  disk  brw-rw----
sda           0      512B       2G         0 sda    223.6G root  disk  brw-rw----
├─sda4        0      512B       2G         0 ├─sda4    50G root  disk  brw-rw----
├─sda2        0      512B       2G         0 ├─sda2   200M root  disk  brw-rw----
├─sda5        0      512B       2G         0 ├─sda5  35.1G root  disk  brw-rw----
├─sda3        0      512B       2G         0 ├─sda3 130.3G root  disk  brw-rw----
├─sda1        0      512B       2G         0 ├─sda1   200M root  disk  brw-rw----
└─sda6        0      512B       2G         0 └─sda6   7.8G root  disk  brw-rw----

... see NAME column.

It's fine to support duplicated columns when requested by user (e.g.
-o NAME,NAME,SIZE), but it does not make sense for the default output
when multiple command options specified.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsblk: add ZONED column
Damien Le Moal [Wed, 19 Apr 2017 00:25:58 +0000 (09:25 +0900)] 
lsblk: add ZONED column

Add the column "ZONED" to the output to display block devices zone
model information.

Example output:

> lsblk -o+ZONED
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT ZONED
sda      8:0    0 111.8G  0 disk            none
├─sda1   8:1    0   500M  0 part /boot      none
├─sda2   8:2    0  87.3G  0 part /          none
└─sda3   8:3    0    24G  0 part [SWAP]     none
sdb      8:16   0  12.8T  0 disk            host-managed
sdc      8:32   0   5.5T  0 disk            host-managed

or:

> lsblk --zoned
NAME   ZONED
sda    none
├─sda1 none
├─sda2 none
└─sda3 none
sdb    host-managed
sdc    host-managed

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
7 years agolibfdisk: (gpt) rename to gpt_entry_is_used()
Karel Zak [Wed, 19 Apr 2017 12:00:07 +0000 (14:00 +0200)] 
libfdisk: (gpt) rename to gpt_entry_is_used()

The current function name is inconsistent with the rest of the code.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibfdisk: allow to change an existing extended partition
Pavel Butsykin [Tue, 18 Apr 2017 15:59:18 +0000 (18:59 +0300)] 
libfdisk: allow to change an existing extended partition

Signed-off-by: Pavel Butsykin <pbutsykin@virtuozzo.com>
7 years agooptutils.h: don't print non-graph characters
J William Piggott [Wed, 19 Apr 2017 00:57:27 +0000 (20:57 -0400)] 
optutils.h: don't print non-graph characters

There is no eloquent way to exclude/include arch dependent arguments
from the ul_excl_t array. So when an arch dependent argument is left
undefined err_exclusive_options() was printing out-of-bounds values.
This commit cause them to be skipped instead.

err_exclusive_options() shouldn't be printing out-of-bounds values
in any case.

Also change the error massage from 'options' to 'arguments' as some
programs, like hwclock, distinguish between options and functions.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: improve audit control
J William Piggott [Tue, 18 Apr 2017 22:51:43 +0000 (18:51 -0400)] 
hwclock: improve audit control

Move audit control to option parsing. This fixes non-alpha build
error and cleans up an unruly 'if' statement.

Having audit control in option parsing may also draw awareness to
the audit system when adding new functions, which could easily be
overlooked otherwise.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: --set and --predict segmentation fault
J William Piggott [Tue, 18 Apr 2017 14:42:02 +0000 (10:42 -0400)] 
hwclock: --set and --predict segmentation fault

Segmentation fault for --set or --predict when the
--date option is not included.

* sys-utils/hwclock.c: exit with an error message when
    the required --date option is missing.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: make epoch functions alpha only
J William Piggott [Mon, 17 Apr 2017 22:39:56 +0000 (18:39 -0400)] 
hwclock: make epoch functions alpha only

It's been 19.1315 years since the comment below was written and the kernel
has actually gone further away from allowing an RTC epoch on ISA machines.

/*
 * Maintenance note: This should work on non-Alpha machines, but the
 * evidence today (98.03.04) indicates that the kernel only keeps the epoch
 * value on Alphas. If that is ever fixed, this function should be changed.
 */

The current behavior is to accept the epoch options on ISA machines
only to print a lengthy message explaining that you cannot use them.

This patch removes that behavior, making the epoch functions truly Alpha
only, as the man-page states that they are.

* sys-utils/hwclock.c: make epoch function alpha only.
* sys-utils/hwclock.h: same.

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: improve default function handling
J William Piggott [Sun, 16 Apr 2017 23:10:48 +0000 (19:10 -0400)] 
hwclock: improve default function handling

Removes long default function test. Instead handle the
default when the options are parsed.

Also fixes the non-linux build failure reported by Rudi:
http://marc.info/?l=util-linux-ng&m=149189833115871

Reported-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agotests: update script(1) tests
Karel Zak [Tue, 18 Apr 2017 10:42:58 +0000 (12:42 +0200)] 
tests: update script(1) tests

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoscript: always write stat and done message to typescript file
Karel Zak [Tue, 18 Apr 2017 10:12:44 +0000 (12:12 +0200)] 
script: always write stat and done message to typescript file

And remove usec from timestamp.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'script_newline' of https://github.com/renyuneyun/util-linux
Karel Zak [Tue, 18 Apr 2017 10:02:01 +0000 (12:02 +0200)] 
Merge branch 'script_newline' of https://github.com/renyuneyun/util-linux

* 'script_newline' of https://github.com/renyuneyun/util-linux:
  fix the position of newline in the time output of 'script'

7 years agoMerge branch 'bash-completion' of git://github.com/kerolasa/lelux-utiliteetit
Karel Zak [Tue, 18 Apr 2017 09:35:27 +0000 (11:35 +0200)] 
Merge branch 'bash-completion' of git://github.com/kerolasa/lelux-utiliteetit

* 'bash-completion' of git://github.com/kerolasa/lelux-utiliteetit:
  bash-completion: update text-utils
  bash-completion: update term-utils
  bash-completion: update sys-utils
  bash-completion: update schedutils
  bash-completion: update misc-utils
  bash-completion: update login-utils
  bash-completion: update disk-utils

7 years agoblkzone: Fix zone condition strings handling
Damien Le Moal [Wed, 12 Apr 2017 09:20:32 +0000 (18:20 +0900)] 
blkzone: Fix zone condition strings handling

Fixed the condition strings for implicit open and explicit open to
match the man page defined strings ("oi" and "oe"). Also while at it,
correct the condition_str array entries adding the reserved "xC" case
so that the read_only, full and offline conditions match the condition
codes. This increases the array size to 16, so also fix the condition
code masking when displaying the result.

Signed-off-by: Damien Le Moal <damien.lemoal@wdc.com>
7 years agolscpu: use macro for path to DMI
Karel Zak [Tue, 18 Apr 2017 09:18:36 +0000 (11:18 +0200)] 
lscpu: use macro for path to DMI

Just to be consistent with lscpu.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolscpu: use sysfs for table access if available
Ard Biesheuvel [Wed, 12 Apr 2017 09:11:29 +0000 (10:11 +0100)] 
lscpu: use sysfs for table access if available

On ARM systems, accessing SMBIOS tables via /dev/mem using read()
calls is not supported. The reason is that such tables are usually
located in EFI_RUNTIME_SERVICE_DATA memory, which is not covered
by the linear mapping on those systems, and so read() calls will
fail.

So instead, use the /sys/firmware/dmi/tables/DMI sysfs file, which
contains the entire structure table array, and will be available
on any recent Linux system, even on ones that only export the rev3
SMBIOS entry point, which is currently ignored by lscpu.

Note that the max 'num' value is inferred from the size. This is not
a limitation of the sysfs interface, but a limitation of the rev3
entry point, which no longer carries a number of array elements.

Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Tested-by: Alexander Graf <agraf@suse.de>
Reviewed-by: Alexander Graf <agraf@suse.de>
7 years agolibmount: Ensure utab.lock mode 644
Stanislav Brabec [Tue, 11 Apr 2017 14:12:52 +0000 (16:12 +0200)] 
libmount: Ensure utab.lock mode 644

If utab.lock is created by a process with a restricted umask, utab.lock is
created with restricted permissions. It breaks userspace monitor.

Ensure that the mode is always 644.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
7 years agobash-completion: update fincore
Sami Kerola [Tue, 11 Apr 2017 10:04:12 +0000 (11:04 +0100)] 
bash-completion: update fincore

Add RES column to --output completions.

Commit: e4e8b57be2b63fed82647e4d5efd0e0eaf36b19e
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agobash-completion: update hwclock
Sami Kerola [Tue, 11 Apr 2017 10:01:06 +0000 (11:01 +0100)] 
bash-completion: update hwclock

Add --udate-drift [1], remove --badyear [2], and use the same argument
for --date as in manual page[3].

Commit [1]: f276d71a3ef6a65299deb5e14a188e0a786ecebd
Commit [2]: f6374e1fb33d5ca726b72212b787e11fea78c0ca
Commit [3]: cc5ec6936ea3c218b3e8c46880659db5ee01329f
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agoMerge branch '170409' of github.com:jwpi/util-linux
Karel Zak [Tue, 18 Apr 2017 09:07:09 +0000 (11:07 +0200)] 
Merge branch '170409' of github.com:jwpi/util-linux

* '170409' of github.com:jwpi/util-linux:
  hwclock: remove residual 'compare' from man-page
  hwclock: fix whitespace in hwclock-rtc.c
  docs: parse-date.txt fix whitespace
  parse-date: remove extraneous form feed
  hwclock: use errtryhelp()

7 years agobash-completion: update text-utils
Sami Kerola [Tue, 11 Apr 2017 20:37:40 +0000 (21:37 +0100)] 
bash-completion: update text-utils

hexdump:

Add --color option.

Commit: 098ab0778f5a46ab4519c8404fd4ba8ec137368b

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agobash-completion: update term-utils
Sami Kerola [Wed, 12 Apr 2017 09:48:31 +0000 (10:48 +0100)] 
bash-completion: update term-utils

scriptreplay:

Add --maxdelay option.

Commit: 7f1d48363823f7da47ca56f84eb4b2155c5ed36b

setterm:

Add --resize coption.

Commit: 5d795999511adc455d223be8281948796bd7d087

write:

List only users who are online and determine tty based on given user
name.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agobash-completion: update sys-utils
Sami Kerola [Tue, 11 Apr 2017 18:02:21 +0000 (19:02 +0100)] 
bash-completion: update sys-utils

blkdiscard:

Add --step [1] and --zeroout [2] options.

Commit [1]: c472a7e35ae40652bdcf66c08a23bd50d48d1884
Commit [2]: 7154cc892688f3c58cbbcdc2055f2635c1d0ef5b

chmem:

Commit: 30e1ea8ba1984488fdb16506ebafe4dc23280e5a

dmesg:

Add --time-format.

Commit: babf605d2ca969a434f2f14579ddf44252adff4f

fallocate:

Add --insert-range [1], --collapse-range [2], --zero-range [3], and
--posix [4] options.  Also make the options to be in same order as
usage() output.

Commit [1]: b439065634e693dda385a6e5269e1d9258d6d471
Commit [2]: 83cc932d7412cb9d23bf9f06a9a54c8566e1a788
Commit [3]: 1fd4f609ee65be0f376ed28322fc3593026d39e4
Commit [4]: 833f9a7aae713278eec5f85266597482f18c7370
Command [5]: fallocate --help | awk '/--/ {print "\t\t\t\t" $2}'

flock:

Add --no-fork option.

Commit: 703251401cb11ee5d00a6b8f8bd9dc80c160f476

hwclock:

Add --udate-drift [1], remove --badyear [2], and use the same
argument for --date as in manual page[3].

Commit [1]: f276d71a3ef6a65299deb5e14a188e0a786ecebd
Commit [2]: f6374e1fb33d5ca726b72212b787e11fea78c0ca
Commit [3]: cc5ec6936ea3c218b3e8c46880659db5ee01329f

ldattach:

Add --intro-command and --pause.

Commit: 8596f6391461bac53f5bab48f8c8b17a7c459f28

losetup:

Add --nooverlap [1], --json [2], --noheadings and --raw [3] options,
and direct io aka DIO output field [4].

Commit [1]: 9a94b634a343e83bfa2a9d311074e3e520abdddd
Commit [2]: 4827093d4b3090389ae0cabb7d8b522cf794ef90
Commit [3]: 9f56106df6b49864ba604f6824f9fad5aeabd17a
Commit [4]: faeef4d2e9d5e38bed57846ba903009990f24422

lscpu:

Add --json [1] and --physical [2] options.  Add DRAWER [3] to output
fields.

Commit [1]: 19a5510b964c6163e7117913d3de35aba3cd0006
Commit [2]: 0d2b5d2a72bc6619229a4d7456fbb70eda561825
Commit [3]: b3adf6ef6676ca8c10ecdda3e1c92a861df3b885

lsipc:

Update output columns (earlier field names were almost completely
incorrect).  Remove --colon-separate and --print0 [1] options.  Add
--time-format, --bytes, --numeric-perms [2], and --list [3] options.

Commit [1]: 2a7150ac2e57418f471cca0aae259b7bcd0b90db
Commit [2]: 9d20ffda794208d26e6b3ed09fbc38d94d0b8fc6
Commit [3]: 2916afa3f510182987f88c17bade5dffb4aaf0b8

lsmem:

Commit: cad2d1ac9291112bd9199b36a12335f6770356f3

lsns:

Add cgroup --type argument.

Commit: 2b8889c44b6752e92bfb982a5eaa2255a129e072

mount:

Use /proc and kernel module listing for --type argument list.  Some
of the items in the lists do not make much sense, but this is still
better than a static list provided by package maintainer.

mountpoint:

Remove fixme item that was left in place when this completion was
originally wrote.

nsenter:

Add --cgroup [1], --setuid, --setgid [2], --preserve-credentials
[3] and, --all [4] option.

Commit [1]: f9e7b66dbded19d798b883be68b0613749d7b8bb
Commit [2]: 6b9e5bf670c70690d44b8ce4055e1997fb0b6496
Commit [3]: e99a6626d6262266f012a20ae69c8e4573ee22fd
Commit [4]: 974cc006f122f36e2187cedb9d3e58dc2d24814c

rtcwake:

Add --auto [1], --adjfile [2], and --list-modes [3] options.

Commit [1]: 49ebda9b89fc7360d15ca651b8492633b3bbc1d7
Commit [2]: 3a2f3e82bba616c93d80fd88938b38144e66eee7
Commit [3]: 43a44bfc6da8f4666c5dd6bc03c89713e6c4bd46

setarch:

Add --list [1] option.

Commit [1]: 5edb0ea6bbd57dd916417737f98c9109dc1ecb5b

setsid:

Add --wait option.

Commit: 0dde19974bcbb07ce977992ab04b7dfa752d99b3

umount:

Use /proc and kernel module listing for --type argument list.

unshare:

Add --cgroup [1], --fork [2], --mount-proc [3], --map-root-user,
--setgroups [4], and --propagation [5] options.

Commit [1]: f9e7b66dbded19d798b883be68b0613749d7b8bb
Commit [2]: 5088ec338fe5dcd7e9a2d8daf7e7fa7dd6f87c27
Commit [3]: 6728ca101e7edc223a8eb99201197831d8daa61f
Commit [4]: fbceefded6645de693d576cd988a703a6f60d207
Commit [5]: f0f22e9c6f109f8c1234caa3173368ef43b023eb

zramctl:

Add new output fields MEM-LIMIT, MEM-USED, and MIGRATED.

Commit: bffc9174b89d8d9fefe7a77b9350ab8f0dbef54f

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agobash-completion: update schedutils
Sami Kerola [Tue, 11 Apr 2017 20:50:09 +0000 (21:50 +0100)] 
bash-completion: update schedutils

ionice:

Add --pgid and --uid options.

Commit: bd2ff3d2d952d75a6707846831623455647a9a8d

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agobash-completion: update misc-utils
Sami Kerola [Tue, 11 Apr 2017 10:02:25 +0000 (11:02 +0100)] 
bash-completion: update misc-utils

fincore:

Add RES column to --output completions.

Commit: e4e8b57be2b63fed82647e4d5efd0e0eaf36b19e

findfs:

Commit: 940817b736bceccca9be6b9b73e4dd7da0d89142

logger:

Add --socket-errors [1] and --tcp [2] options.

Commit [1]: d77dc29e6e18d39b1845282e8039ac7117f3bd1c
Commit [2]: 68265d070d3041d16ab074ba25c610d6ef6c842e

lsblk:

Add HOTPLUG [1], SERIAL [2], and SUBSYSTEMS [3] output fields.  Add
--json [4], --output-all [5], and --paths [6] options.

Commit [1]: 483987c275e461f4118a89d3be013698845d702b
Commit [2]: 460c7afb79075bd5b39e7d4bc153aa41c939bab3
Commit [3]: 7f14ee1b551e839a4ae081c8d2b7633ca40a5823
Commit [4]: 4a102a4871fdb415f4de5af9ffb7a2fb8926b5d1
Commit [5]: 1b4d2a4a4aa7df52033d293f26cd4fa79f95578d
Commit [6]: c7e76cd145b0c40e1d346203f3222f5937146939

lslocks:

Add --noinaccessible option.  Remove file argument completion, this
command does not use that sort of command line input.

Commit: f29bc6e1cc4ed9f76bded543c6ab393f674ec3ed

mcookie:

Add --max-size option.

Commit: f7bac5731bf559216aa2f0e8be1d7f477e7cf41a

wipefs:

Add --backup option.

Commit: 7e658c15a2c1fc5092a790afbe7d9d395d04b098

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agobash-completion: update login-utils
Sami Kerola [Tue, 11 Apr 2017 21:11:13 +0000 (22:11 +0100)] 
bash-completion: update login-utils

last:

Broken since first commit.
Commit: 41e5a92cf1cd8950df8b02fdd2ea8be571dbab02

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agobash-completion: update disk-utils
Sami Kerola [Tue, 11 Apr 2017 19:30:02 +0000 (20:30 +0100)] 
bash-completion: update disk-utils

fdformat:

Add --from, --to, and --repair options.

Commit: e0402441a143533d33d3c450471b2cd655407d77

fdisk:

Add --output [1], --bytes [2], --wipe [3], --wipe-partition [4], and
remove --geom- from from --cylinders, --heads, --sector options [5].

Commit [1]: fff8ad5882308825a131c645e4d28bcaef943351
Commit [2]: 354f8cc8cf06de44656fb83705c57062d04d1565
Commit [3]: cb9a4b0033eca429689a403be2a192fe2842f2e9
Commit [4]: ba465623d84b9e330f248a477d078b5f280b7943
Commit [5]: 4b4e391a28b4dfeb69781c20190bffe8622d1907

fsck.cramfs:

Broken since first commit.

Commit: bf60993cf2442f67bd47bcfcf6bd49c7392c2ba1

mkswap:

Provide random uuid when completing --uuid argument.

partx:

Add --sector-size option.  Fix also list of known partition types to
match with libblkid blkid_idinfo names.  The fix is also applied to
manual page.

Commit: f8a4a0d4f2fd569252029bd004e24ee433b43fe8

Reference: git grep -A 4 blkid_idinfo libblkid/src/partitions | grep name

sfdisk:

Add --reoder, --delete, --mode-dataa, -no-tell-kernel, --wipe, and
--wipe-partitions options.  In same go fix some option argument
completions.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
7 years agofix the position of newline in the time output of 'script'
Rui Zhao (renyuneyun) [Fri, 14 Apr 2017 16:43:41 +0000 (17:43 +0100)] 
fix the position of newline in the time output of 'script'

- move '\n' to fprintf
- use `timeutils/strtime_iso()` instead of `strtime()`

Signed-off-by: Rui Zhao (renyuneyun) <renyuneyun@gmail.com>
7 years agoscript: don't call strftime() if not necessary
Karel Zak [Thu, 13 Apr 2017 13:06:52 +0000 (15:06 +0200)] 
script: don't call strftime() if not necessary

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agoMerge branch 'script_quiet' of https://github.com/renyuneyun/util-linux
Karel Zak [Thu, 13 Apr 2017 13:04:54 +0000 (15:04 +0200)] 
Merge branch 'script_quiet' of https://github.com/renyuneyun/util-linux

* 'script_quiet' of https://github.com/renyuneyun/util-linux:
  script: fix start message showing in output file when -q is on

7 years agolibsmartcols: fix typo
Karel Zak [Thu, 13 Apr 2017 09:47:43 +0000 (11:47 +0200)] 
libsmartcols: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsblk: fix --inverse --list
Karel Zak [Thu, 13 Apr 2017 09:39:22 +0000 (11:39 +0200)] 
lsblk: fix --inverse --list

Let's follow --inverse dependencies although --list output requested.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1441175
Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolibsmartcols: add scols_sort_table_by_tree()
Karel Zak [Thu, 13 Apr 2017 09:19:59 +0000 (11:19 +0200)] 
libsmartcols: add scols_sort_table_by_tree()

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agolsblk: move scols_flags to lsblk control struct
Karel Zak [Thu, 13 Apr 2017 08:17:36 +0000 (10:17 +0200)] 
lsblk: move scols_flags to lsblk control struct

Signed-off-by: Karel Zak <kzak@redhat.com>
7 years agohwclock: remove residual 'compare' from man-page
J William Piggott [Mon, 10 Apr 2017 18:57:01 +0000 (14:57 -0400)] 
hwclock: remove residual 'compare' from man-page

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: fix whitespace in hwclock-rtc.c
J William Piggott [Mon, 10 Apr 2017 18:50:32 +0000 (14:50 -0400)] 
hwclock: fix whitespace in hwclock-rtc.c

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agodocs: parse-date.txt fix whitespace
J William Piggott [Mon, 10 Apr 2017 18:41:46 +0000 (14:41 -0400)] 
docs: parse-date.txt fix whitespace

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agoparse-date: remove extraneous form feed
J William Piggott [Mon, 10 Apr 2017 18:26:12 +0000 (14:26 -0400)] 
parse-date: remove extraneous form feed

* lib/parse-date.y: Remove extraneous form feed (FF, 0x0C, ^L).

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agohwclock: use errtryhelp()
J William Piggott [Mon, 10 Apr 2017 17:39:49 +0000 (13:39 -0400)] 
hwclock: use errtryhelp()

* sys-utils/hwclock.c: use errtryhelp() instead of usage().

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agoagetty: various man-page fixes
J William Piggott [Thu, 6 Apr 2017 14:21:07 +0000 (10:21 -0400)] 
agetty: various man-page fixes

Signed-off-by: J William Piggott <elseifthen@gmx.com>
7 years agochmem: don't use scanf format for printf
Ruediger Meier [Fri, 7 Apr 2017 11:35:59 +0000 (13:35 +0200)] 
chmem: don't use scanf format for printf

The compiler had not complained here because both macros are
probably the same.

But gettext issued a funny warning:
sys-utils/chmem.c:67: warning: Although being used in a format string position, the msgid is not a valid C format string. Reason: The string ends in the middle of a directive.

CC: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>