]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
5 years agolsblk: force tree on --json --tree independently on used columns
Karel Zak [Mon, 18 Mar 2019 15:58:41 +0000 (16:58 +0100)] 
lsblk: force tree on --json --tree independently on used columns

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: TODO lscpu --list-caches
Karel Zak [Mon, 18 Mar 2019 13:14:09 +0000 (14:14 +0100)] 
docs: TODO lscpu --list-caches

Addresses: https://github.com/karelzak/util-linux/issues/663
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolscpu: add 'Frequency boost'
Karel Zak [Fri, 15 Mar 2019 12:33:40 +0000 (13:33 +0100)] 
lscpu: add 'Frequency boost'

Show turbo boost status on platforms where is available a file
/sys/devices/system/cpu/cpufreq/boost.

Addresses: https://github.com/karelzak/util-linux/issues/755
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'swapon-btrfs' of https://github.com/marcosfrm/util-linux
Karel Zak [Mon, 11 Mar 2019 11:09:30 +0000 (12:09 +0100)] 
Merge branch 'swapon-btrfs' of https://github.com/marcosfrm/util-linux

* 'swapon-btrfs' of https://github.com/marcosfrm/util-linux:
  swapon.8: mention btrfs(5)

5 years agoMerge branch 'setterm' of https://github.com/jwilk-forks/util-linux
Karel Zak [Mon, 11 Mar 2019 11:06:38 +0000 (12:06 +0100)] 
Merge branch 'setterm' of https://github.com/jwilk-forks/util-linux

* 'setterm' of https://github.com/jwilk-forks/util-linux:
  setterm: fix --hbcolor description

5 years agoblkid: (man) cleanup return code section
Karel Zak [Mon, 11 Mar 2019 11:02:31 +0000 (12:02 +0100)] 
blkid: (man) cleanup return code section

Addresses: https://github.com/karelzak/util-linux/issues/764
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoswapon.8: mention btrfs(5)
Marcos Mello [Mon, 11 Mar 2019 10:30:35 +0000 (07:30 -0300)] 
swapon.8: mention btrfs(5)

See:

https://github.com/kdave/btrfs-progs/commit/5c880c82c2044b0abae5c838c733a2e6522ed122

5 years agosetterm: fix --hbcolor description
Jakub Wilk [Fri, 8 Mar 2019 20:25:59 +0000 (21:25 +0100)] 
setterm: fix --hbcolor description

--hbcolor is for half-bright characters, which is sort of opposite of
bold.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
5 years agoMerge branch 'setterm' of https://github.com/jwilk-forks/util-linux
Karel Zak [Fri, 8 Mar 2019 12:15:29 +0000 (13:15 +0100)] 
Merge branch 'setterm' of https://github.com/jwilk-forks/util-linux

* 'setterm' of https://github.com/jwilk-forks/util-linux:
  setterm: update comments about -ulcolor/-hbcolor syntax
  setterm: fix bright colors for --ulcolor/--hbcolor
  setterm: disallow "default" for --ulcolor/--hbcolor

5 years agoMerge branch 'patch-2' of https://github.com/MeggyCal/util-linux
Karel Zak [Fri, 8 Mar 2019 11:33:10 +0000 (12:33 +0100)] 
Merge branch 'patch-2' of https://github.com/MeggyCal/util-linux

* 'patch-2' of https://github.com/MeggyCal/util-linux:
  Update mount.8

5 years agomkswap: be more explicit about maximal number of pages
Karel Zak [Fri, 8 Mar 2019 11:14:19 +0000 (12:14 +0100)] 
mkswap: be more explicit about maximal number of pages

Addresses: https://github.com/karelzak/util-linux/pull/766
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibmount: improve fs referencing in tables
Tim Hildering [Mon, 4 Mar 2019 18:15:08 +0000 (19:15 +0100)] 
libmount: improve fs referencing in tables

* Added member 'struct libmnt_table *tab' to libmnt_fs structure.
* Added 'mnt_fs_get_table()'.
* Removed overhead from 'mnt_table_{insert,move,remove}_fs().
* Added check to 'mnt_table_set_iter()' that entry is member of table.

[kzak@redhat.com: - add to libmount.sys
                  - add to docs
                  - cleanup commit message
                  - set fs->tab = NULL before mnt_unref_fs() in mnt_table_remove_fs()]

Signed-off-by: Tim Hildering <hilderingt@posteo.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosetterm: update comments about -ulcolor/-hbcolor syntax
Jakub Wilk [Thu, 7 Mar 2019 21:07:37 +0000 (22:07 +0100)] 
setterm: update comments about -ulcolor/-hbcolor syntax

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
5 years agosetterm: fix bright colors for --ulcolor/--hbcolor
Jakub Wilk [Thu, 7 Mar 2019 20:55:07 +0000 (21:55 +0100)] 
setterm: fix bright colors for --ulcolor/--hbcolor

The "bright" keyword was parsed, but it didn't actually affect the color
that was set.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
5 years agosetterm: disallow "default" for --ulcolor/--hbcolor
Jakub Wilk [Thu, 7 Mar 2019 20:42:09 +0000 (21:42 +0100)] 
setterm: disallow "default" for --ulcolor/--hbcolor

Passing "default" to --ulcolor or --hbcolor worked, but it set the color to
bright red. This was not a documented syntax, so let's forbid it.

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
5 years agoUpdate mount.8
MeggyCal [Thu, 7 Mar 2019 16:24:22 +0000 (17:24 +0100)] 
Update mount.8

xfs is widely supported today

5 years agosu: add note about ECHO on --pty
Karel Zak [Wed, 6 Mar 2019 12:12:23 +0000 (13:12 +0100)] 
su: add note about ECHO on --pty

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosu: be sensitive to another SIGCHLD ssi_codes
Karel Zak [Wed, 6 Mar 2019 11:02:30 +0000 (12:02 +0100)] 
su: be sensitive to another SIGCHLD ssi_codes

See the same issue for script: 27afe5016842c22d256ea9f88b598d637ca0df84

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosu: fix --pty terminal initialization
Karel Zak [Wed, 6 Mar 2019 10:54:51 +0000 (11:54 +0100)] 
su: fix --pty terminal initialization

* use proper winsize rather than uninitialized variable (Oops...)

* set the current terminal to the raw mode

* disable ECHO for non-terminal execution to be compatible with
  non-pty output

Addresses: https://github.com/karelzak/util-linux/issues/767
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: add missing ts_check_test_command call
Karel Zak [Tue, 5 Mar 2019 12:56:33 +0000 (13:56 +0100)] 
tests: add missing ts_check_test_command call

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobuild-sys: add check-programs make target
Karel Zak [Tue, 5 Mar 2019 10:38:44 +0000 (11:38 +0100)] 
build-sys: add check-programs make target

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: add --noskip-commands
Karel Zak [Tue, 5 Mar 2019 10:06:41 +0000 (11:06 +0100)] 
tests: add --noskip-commands

The default is SKIP missing commands on --use-system-commands, but
with --noskip-commands the test will FAIL.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: add missing TS_CMD_UMOUNT check
Karel Zak [Mon, 4 Mar 2019 16:32:03 +0000 (17:32 +0100)] 
tests: add missing TS_CMD_UMOUNT check

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: (kill) do not use shell build-in
Karel Zak [Mon, 4 Mar 2019 16:28:15 +0000 (17:28 +0100)] 
tests: (kill) do not use shell build-in

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: add --use-system-commands
Karel Zak [Mon, 4 Mar 2019 16:10:04 +0000 (17:10 +0100)] 
tests: add --use-system-commands

This change allows to use commands from $PATH rather than from
$top_builddir. There two basic use cases:

* check differences between installed and git version
  run.sh --use-system-command --show-diff

* check system binaries by upstream tests (for example tests from
  src.rpm package)

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: add missing ts_check_test_command calls
Karel Zak [Mon, 4 Mar 2019 15:42:30 +0000 (16:42 +0100)] 
tests: add missing ts_check_test_command calls

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosu/runuser: don't mark --pty as experimental, add it to runuser.1 too
Karel Zak [Mon, 4 Mar 2019 12:13:30 +0000 (13:13 +0100)] 
su/runuser: don't mark --pty as experimental, add it to runuser.1 too

* let's assume that --pty is stable enough that we do not have to remove it ;-)

* add --pty to the runuser.1 man page

Addresses: https://github.com/karelzak/util-linux/issues/760
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'mps_losetup_has_device_inline' of https://github.com/marcosps/util...
Karel Zak [Mon, 4 Mar 2019 10:48:20 +0000 (11:48 +0100)] 
Merge branch 'mps_losetup_has_device_inline' of https://github.com/marcosps/util-linux

* 'mps_losetup_has_device_inline' of https://github.com/marcosps/util-linux:
  lib/loopdev.c: Inline loopcxt_has_device

5 years agoMerge branch 'evelu-epyc' of https://github.com/ErwanAliasr1/util-linux
Karel Zak [Mon, 4 Mar 2019 10:46:16 +0000 (11:46 +0100)] 
Merge branch 'evelu-epyc' of https://github.com/ErwanAliasr1/util-linux

* 'evelu-epyc' of https://github.com/ErwanAliasr1/util-linux:
  test: Adding AMD EPYC 7451 24-Core Processor

5 years agolast: do not use non-standard __UT_NAMESIZE
Patrick Steinhardt [Fri, 1 Mar 2019 17:35:49 +0000 (18:35 +0100)] 
last: do not use non-standard __UT_NAMESIZE

In commit b22332dd4 (last: fix wtmp user name buffer overflow
[asan], 2019-01-13), we started to make sure that the `ut_user`
field of the `utmpx` struct is always NUL-terminated. The
implementation makes use of the `__UT_NAMESIZE` define to
determine the position of the last character in that array. The
problem is that this is a non-standard define that is not
necessarily available on non-glibc platforms.

As there is no standardized define, we should just use `sizeof`.
This fixes compilation on musl libc based systems.

Signed-off-by: Patrick Steinhardt <ps@pks.im>
5 years agolibmount: Recognize more fuse filesystems as pseudofs and netfs
Stanislav Brabec [Thu, 28 Feb 2019 22:09:40 +0000 (23:09 +0100)] 
libmount: Recognize more fuse filesystems as pseudofs and netfs

Add some fuse filesystems to the list of pseudofs and netfs.

There are still tens of filesystems that should be evaluated and added.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
5 years agoagetty: Switch to 8-bit processing in get_logname() for UTF-8 terminals
Stanislav Brabec [Wed, 27 Feb 2019 22:22:40 +0000 (23:22 +0100)] 
agetty: Switch to 8-bit processing in get_logname() for UTF-8 terminals

If the terminal is in the UTF-8 mode, get_logname() should use 8-bit
processing.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agoagetty: Fix input of non-ASCII characters in get_logname()
Stanislav Brabec [Wed, 27 Feb 2019 22:22:19 +0000 (23:22 +0100)] 
agetty: Fix input of non-ASCII characters in get_logname()

As login supports non-ASCII characters in the logname, agetty should be
consistent.

8b58ffdd re-activated old and ASCII-only get_logname(), which restricted
the input to ASCII only. As the code does not read whole characters,
isascii(ascval) and isprint(ascval) returns nonsenses after entering a
non-ASCII character.

As keyboard maps don't contain unprintable non-control characters, it
seems to be relatively safe to remove both checks.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Lubomir Rintel <lkundrak@v3.sk>
Tested-by: Lubomir Rintel <lkundrak@v3.sk>
5 years agolib/loopdev.c: Inline loopcxt_has_device
Marcos Paulo de Souza [Sun, 3 Mar 2019 12:15:13 +0000 (09:15 -0300)] 
lib/loopdev.c: Inline loopcxt_has_device

loopcxt_has_device is a one liner, so adding inline statement does not
hurt.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
5 years agotests: make sure TS_HELPER_MBSENCODE compiled
Karel Zak [Fri, 1 Mar 2019 14:04:54 +0000 (15:04 +0100)] 
tests: make sure TS_HELPER_MBSENCODE compiled

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoblockdev: make –-getbsz less confusing for end-users
Karel Zak [Thu, 28 Feb 2019 13:08:23 +0000 (14:08 +0100)] 
blockdev: make –-getbsz less confusing for end-users

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1684078
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: use subtests in fdisk/mbr-nondos-mode
Karel Zak [Wed, 27 Feb 2019 11:22:33 +0000 (12:22 +0100)] 
tests: use subtests in fdisk/mbr-nondos-mode

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: add fdisk (dos) first sector dialog test
Karel Zak [Wed, 27 Feb 2019 11:03:28 +0000 (12:03 +0100)] 
tests: add fdisk (dos) first sector dialog test

The test verifies that the "First sector" dialog offers relevant range
in the begin of the device if the end of the device is already used.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotest: Adding AMD EPYC 7451 24-Core Processor
Erwan Velu [Wed, 27 Feb 2019 09:16:27 +0000 (10:16 +0100)] 
test: Adding AMD EPYC 7451 24-Core Processor

This cpu is massively numa and have interesting cache organization.
This will be useful to test & implement issue #663

Signed-off-by: Erwan Velu <e.velu@criteo.com>
5 years agoMerge branch 'dana/column-x' of https://github.com/okdana/util-linux
Karel Zak [Tue, 26 Feb 2019 11:25:21 +0000 (12:25 +0100)] 
Merge branch 'dana/column-x' of https://github.com/okdana/util-linux

* 'dana/column-x' of https://github.com/okdana/util-linux:
  column: Address fill-order confusion in documentation

5 years agolibfdisk: (dos) Use strtoul to parse the label-id
Juerg Haefliger [Fri, 22 Feb 2019 16:04:12 +0000 (17:04 +0100)] 
libfdisk: (dos) Use strtoul to parse the label-id

Parsing of the label-id fails on 32-bit if the MSB is set. Fix that by
using strtoul instead of strtol.

Signed-off-by: Juerg Haefliger <juergh@canonical.com>
5 years agolibfdisk: (dos) rewrite fist/last free sector functions
Karel Zak [Mon, 25 Feb 2019 12:59:50 +0000 (13:59 +0100)] 
libfdisk: (dos) rewrite fist/last free sector functions

The current code uses first[] and last[] arrays to specify partition
ranges. This is unnecessary as we already have all in memory.

The current code offers in first and last sector dialogs ranges
without care about already used areas.

This commit makes things more readable, more user-friendly and
remove obscure first[] and last[].

Reported-by: 冰柯 <ziming_cool@126.com
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agocolumn: Address fill-order confusion in documentation
dana [Fri, 22 Feb 2019 20:11:29 +0000 (14:11 -0600)] 
column: Address fill-order confusion in documentation

Historical versions of column have described the default fill order as
rows-then-columns and the -x order as columns-then-rows. This was
misleading at best, and the util-linux implementation was updated to
clarify the actual behaviour in 3e094e5fe2 (March 2017).

However, the other implementations (used by *BSD, macOS, Debian, &al.)
continue to use the previous wording, and a user comparing them could
easily get the false impression that util-linux column has exactly the
opposite fill behaviour from BSD column.

To address this, a note is added to the man page explaining the change
and clarifying that, despite what the BSD documentation says, the two
implementations behave identically in this regard.

Signed-off-by: dana <dana@dana.is>
5 years agolibmount: add mnt_table_{find,insert,move}_fs()
Karel Zak [Thu, 21 Feb 2019 12:49:39 +0000 (13:49 +0100)] 
libmount: add mnt_table_{find,insert,move}_fs()

Add functions to insert FS into table to specified position and to
move FS between two tables.

Co-Author: Tim Hildering <hilderingt@posteo.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolscpu: document --hex output regression (since v2.30)
Karel Zak [Wed, 20 Feb 2019 12:19:23 +0000 (13:19 +0100)] 
lscpu: document --hex output regression (since v2.30)

Addresses: https://github.com/karelzak/util-linux/issues/744
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: allow to specify tree column
Karel Zak [Wed, 20 Feb 2019 11:49:24 +0000 (12:49 +0100)] 
lsblk: allow to specify tree column

* document --tree (was missing in the man page)
* add optional argument to --tree to specify tree

For example:

$ lsblk -o KNAME,SIZE,MOUNTPOINT --tree=KNAME /dev/dm-0
KNAME      SIZE MOUNTPOINT
dm-0     232.9G
└─dm-1   232.9G
  └─dm-2 232.9G

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibsmartcols: print tree also for empty cells
Karel Zak [Wed, 20 Feb 2019 11:47:24 +0000 (12:47 +0100)] 
libsmartcols: print tree also for empty cells

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: (dos) improve first unused sector for logical partitions
Karel Zak [Mon, 18 Feb 2019 15:38:11 +0000 (16:38 +0100)] 
libfdisk: (dos) improve first unused sector for logical partitions

Make sure we probe within extended partition.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: fix typos [codespell]
Sami Kerola [Mon, 14 Jan 2019 22:40:34 +0000 (22:40 +0000)] 
docs: fix typos [codespell]

Reference: https://github.com/codespell-project/codespell
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agoinclude/path.h: remove duplicate header inclusion
Sami Kerola [Fri, 25 Jan 2019 20:54:42 +0000 (20:54 +0000)] 
include/path.h: remove duplicate header inclusion

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agoinclude: add no return function attribute
Sami Kerola [Fri, 8 Feb 2019 22:01:05 +0000 (22:01 +0000)] 
include: add no return function attribute

This warning is repeated 112 times when compiling with all warnings.

xalloc.h:23:1: warning: function '__err_oom' could be declared with
attribute 'noreturn' [-Wmissing-noreturn]

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agohardlink, wall: fix variable shadowing
Sami Kerola [Sat, 9 Feb 2019 08:47:43 +0000 (08:47 +0000)] 
hardlink, wall: fix variable shadowing

misc-utils/hardlink.c:91:65: warning: declaration shadows a variable in the global scope [-Wshadow]
misc-utils/hardlink.c:73:5: note: previous declaration is here
int content_only = 0;

term-utils/wall.c:114:40: warning: declaration shadows a variable in the global scope [-Wshadow]
term-utils/wall.c:129:65: warning: declaration shadows a variable in the global scope [-Wshadow]
/usr/include/bits/getopt_core.h:36:14: note: previous declaration is here
extern char *optarg;

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agovarious: fix 'uninitialized when used' warnings [clang]
Sami Kerola [Sat, 9 Feb 2019 09:34:52 +0000 (09:34 +0000)] 
various: fix 'uninitialized when used' warnings [clang]

This change fixes "warning: variable 'var' may be uninitialized when used
here [-Wconditional-uninitialized]" warnings reported in various files.

Signed-off-by: Sami Kerola <kerolasa@iki.fi>
5 years agocal: fix Sexit and Senter
Karel Zak [Mon, 18 Feb 2019 12:10:58 +0000 (13:10 +0100)] 
cal: fix Sexit and Senter

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosfdisk: Avoid out of boundary read with readline
Tobias Stoeckmann [Sun, 17 Feb 2019 21:55:29 +0000 (22:55 +0100)] 
sfdisk: Avoid out of boundary read with readline

It is not guaranteed that the returned string of readline() actually
contains as many bytes as buf can contain.

If bufsz is larger than the allocated memory by readline, an out of
boundary read occurs and leads to undefined behaviour. Most likely
that will be a crash.

This can be reproduced when readline-support is compiled in and when
you directly enter "quit" and "n" (to not write changes back to disk)
when sfdisk was called with any given device.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
5 years agolibfdisk: sanity check, to prevent overlapping partitions from being partly reported...
Fabian.Kirsch@dlr.de [Wed, 13 Feb 2019 14:49:10 +0000 (14:49 +0000)] 
libfdisk: sanity check, to prevent overlapping partitions from being partly reported as free

i noticed wrongly reported free space when looking with cfdisk on
an USB drive prepared with the latest alpine *.iso[1].

Feel free to apply below patch, which fixed the issue for me.

Greetings
  Fabian

[1]: http://dl-cdn.alpinelinux.org/alpine/v3.9/releases/x86/alpine-extended-3.9.0-x86.iso

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibmount: (tabdiff) use list_add_tail() in more robust way
Karel Zak [Mon, 18 Feb 2019 11:35:09 +0000 (12:35 +0100)] 
libmount: (tabdiff) use list_add_tail() in more robust way

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibfdisk: use list_add_tail() in more robust way
Karel Zak [Mon, 18 Feb 2019 11:34:11 +0000 (12:34 +0100)] 
libfdisk: use list_add_tail() in more robust way

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibsmartcols: use list_add_tail() in more robust way
Karel Zak [Mon, 18 Feb 2019 11:33:12 +0000 (12:33 +0100)] 
libsmartcols: use list_add_tail() in more robust way

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibblkid: tiny code simplification
Karel Zak [Mon, 18 Feb 2019 11:31:37 +0000 (12:31 +0100)] 
libblkid: tiny code simplification

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibmount: check table membership before adding entry
Tim Hildering [Sun, 17 Feb 2019 23:01:18 +0000 (00:01 +0100)] 
libmount: check table membership before adding entry

Added validation to function 'mnt_table_add_fs()' to check that added @fs
is not already a member of another table.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agowall: remove unnecessary warning
Karel Zak [Thu, 14 Feb 2019 09:41:59 +0000 (10:41 +0100)] 
wall: remove unnecessary warning

wall(1) may be used in scripts or in pipe. In this case report failed
ttyname() does not make sense, especially if the code does not depend
on on this function.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1608176
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: update fdisk outputs
Karel Zak [Tue, 12 Feb 2019 13:22:49 +0000 (14:22 +0100)] 
tests: update fdisk outputs

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agofdisk: use 2 decimal places for size in disk summary
Karel Zak [Tue, 12 Feb 2019 13:21:54 +0000 (14:21 +0100)] 
fdisk: use 2 decimal places for size in disk summary

 In the disk summary it seems nice, but I'm not sure about lists (SIZE
 columns). It seems more readable to keep the lists with one decimal
 place only. New output:

  # sfdisk --list /dev/sda

 Old output:
  Disk /dev/sda: 223.6 GiB, 240057409536 bytes, 468862128 sectors

 New output:
  Disk /dev/sda: 223.58 GiB, 240057409536 bytes, 468862128 sectors

 The rest is unchanged:
  ...
  Device         Start       End   Sectors   Size Type
  /dev/sda1       2048    411647    409600   200M EFI System
  /dev/sda2     411648    821247    409600   200M Linux filesystem
  /dev/sda3     821248 274087935 273266688 130.3G Linux filesystem
  /dev/sda4  274087936 378945535 104857600    50G Linux filesystem
  /dev/sda5  378945536 468862094  89916559  42.9G Linux filesystem

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1673452
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolib/strutils: support two decimal places in size_to_human_string() output
Karel Zak [Tue, 12 Feb 2019 12:27:56 +0000 (13:27 +0100)] 
lib/strutils: support two decimal places in size_to_human_string() output

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: (hardlink) update noregex
Karel Zak [Mon, 11 Feb 2019 13:53:51 +0000 (14:53 +0100)] 
tests: (hardlink) update noregex

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agohardlink: add long options
Karel Zak [Mon, 11 Feb 2019 13:01:55 +0000 (14:01 +0100)] 
hardlink: add long options

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agohardlink: rename function
Karel Zak [Mon, 11 Feb 2019 12:30:46 +0000 (13:30 +0100)] 
hardlink: rename function

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agohardlink: make code more readable
Karel Zak [Mon, 11 Feb 2019 12:25:04 +0000 (13:25 +0100)] 
hardlink: make code more readable

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agohardlink: cleanup global variables
Karel Zak [Mon, 11 Feb 2019 12:18:35 +0000 (13:18 +0100)] 
hardlink: cleanup global variables

* remove NAMELEN, use PATH_MAX
* mark global variables as static
* move all global variables to the begin of the code

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agohardlink: remove typedefs
Karel Zak [Mon, 11 Feb 2019 12:00:18 +0000 (13:00 +0100)] 
hardlink: remove typedefs

- remove typedefs
- use long names for structs

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agotests: (hardlink) update summary output
Karel Zak [Mon, 11 Feb 2019 09:37:09 +0000 (10:37 +0100)] 
tests: (hardlink) update summary output

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolsblk: use ID_SCSI_SERIAL when available
Sven Wiltink [Fri, 8 Feb 2019 09:53:21 +0000 (10:53 +0100)] 
lsblk: use ID_SCSI_SERIAL when available

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agohardlink: cleanup error messages, use xalloc.h
Karel Zak [Wed, 6 Feb 2019 16:21:36 +0000 (17:21 +0100)] 
hardlink: cleanup error messages, use xalloc.h

- do not use magical doexit(), just use err()
- print summary on exit

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agohardlink: cleanup verbose and warning messages
Karel Zak [Wed, 6 Feb 2019 16:13:08 +0000 (17:13 +0100)] 
hardlink: cleanup verbose and warning messages

- use warn()
- use stdout rather than stderr

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agohardlink: (man) add AVAILABILITY
Karel Zak [Wed, 6 Feb 2019 13:37:34 +0000 (14:37 +0100)] 
hardlink: (man) add AVAILABILITY

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'hardlink' of https://github.com/rudimeier/util-linux into hardlink
Karel Zak [Wed, 6 Feb 2019 12:55:20 +0000 (13:55 +0100)] 
Merge branch 'hardlink' of https://github.com/rudimeier/util-linux into hardlink

* 'hardlink' of https://github.com/rudimeier/util-linux: (25 commits)
  hardlink: add first simple tests
  hardlink: util-linux usage
  hardlink: fix compiler warnings
  hardlink: style indentations and license header
  hardlink: enable build with and without pcre2
  fixes for the fixes
  temporal fix before re-patch (updates from Fedora repo)
  Update hardlink.1
  Fixed version number, added changelog about Todd Lewis' patch
  exclude files via pcre
  Fixed 32 bit build with gcc7 (RH Bugzilla ID 1422989)
  spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); update FSF address at .c source file
  Revert "spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file"
  spec file reflects the atomic hardlinking patch; removed cleaning buildroot (redundant); current FSF address at .c source file
  Mention -f option in the man page
  do not allow to hardlink files across filesystems by default (#786719) (use -f option to override)
  fix possible buffer overflows, integer overflows, update man page
  fix URL and remove mmap() (#676962, #672917)
  - update docs to describe highest verbosity -vv option (#210816) - use dist Resolves: 210816
  mostly spec cleanup
  ...

5 years agomount: Do not call mnt_pretty_path() on net file systems.
Stanislav Brabec [Tue, 5 Feb 2019 23:07:54 +0000 (00:07 +0100)] 
mount: Do not call mnt_pretty_path() on net file systems.

Calling mnt_pretty_path() on network file systems can cause mangling of
the output:
root# mount | grep nfs
nfs.example.com:/home on /home type nfs4 ...
root# mkdir -p nfs.example.com:/home
root# mount | grep nfs
/root/nfs.example.com:/home on /home type nfs4 ...

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
5 years agocol: improve error message, update regression test
Karel Zak [Tue, 5 Feb 2019 17:07:26 +0000 (18:07 +0100)] 
col: improve error message, update regression test

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agodocs: add col(1) to TODO
Karel Zak [Tue, 5 Feb 2019 11:13:46 +0000 (12:13 +0100)] 
docs: add col(1) to TODO

Addresses: https://github.com/karelzak/util-linux/issues/749
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agocol: make flush_line() a little bit robust
Karel Zak [Tue, 5 Feb 2019 11:06:00 +0000 (12:06 +0100)] 
col: make flush_line() a little bit robust

The code is horrible. The core of the problem are signed integers
and no check for the limits.

This patch fixes c->c_column = cur_col; where c_column is "short"
and "cur_col" is int. Let's use "int" for all the variables. It's
really not perfect as for bigger lines it can segfault again...

The patch also removes some unnecessary static variables.

Addresses: https://github.com/karelzak/util-linux/issues/749
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoMerge branch 'patch-1' of https://github.com/edupont/util-linux
Karel Zak [Tue, 5 Feb 2019 10:09:02 +0000 (11:09 +0100)] 
Merge branch 'patch-1' of https://github.com/edupont/util-linux

* 'patch-1' of https://github.com/edupont/util-linux:
  Typo in configuration help

5 years agoMerge branch 'mount-nosuid' of https://github.com/Lekensteyn/util-linux
Karel Zak [Tue, 5 Feb 2019 10:07:32 +0000 (11:07 +0100)] 
Merge branch 'mount-nosuid' of https://github.com/Lekensteyn/util-linux

* 'mount-nosuid' of https://github.com/Lekensteyn/util-linux:
  mount.8: clarify (no)suid behavior on file capabilities

5 years agolibfdisk: (gpt) add HiFive Unleashed bootloader partition UUIDs
Icenowy Zheng [Thu, 24 Jan 2019 10:33:34 +0000 (18:33 +0800)] 
libfdisk: (gpt) add HiFive Unleashed bootloader partition UUIDs

The HiFive Unleashed SBC's bootloader seeks for GPT partitions with
specific UUID for loading the next stage bootloader (ZSBL loads FSBL,
and FSBL loads BBL).

Add these partition type UUIDs.

Signed-off-by: Icenowy Zheng <icenowy@aosc.io>
5 years agocal: use standout mode on monochrome terminals
Karel Zak [Mon, 4 Feb 2019 13:16:11 +0000 (14:16 +0100)] 
cal: use standout mode on monochrome terminals

The function colors_init() checks for colors, it means it fails
on monochrome terminals, but cal(1) in this case still need to
highlight the current day.

Reported-by: Nuno Silva <nunojsilva@ist.utl.pt>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolib/colors: force to "never" mode on non-terminal output
Karel Zak [Mon, 4 Feb 2019 13:14:37 +0000 (14:14 +0100)] 
lib/colors: force to "never" mode on non-terminal output

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoTypo in configuration help
edupont [Fri, 1 Feb 2019 21:57:34 +0000 (22:57 +0100)] 
Typo in configuration help

5 years agomount.8: clarify (no)suid behavior on file capabilities
Peter Wu [Fri, 1 Feb 2019 14:40:53 +0000 (15:40 +0100)] 
mount.8: clarify (no)suid behavior on file capabilities

Clarify that the nosuid option also affects file capabilities and that
it only limits execution of programs. (setgid on directories still
inherit the group regardless of the nosuid option.) The new text is
taken from the mount(2) manual page from the man-pages project.

Addresses: https://github.com/karelzak/util-linux/issues/482
Signed-off-by: Peter Wu <peter@lekensteyn.nl>
5 years agosfdisk: fix logical partition resize when start specified
Karel Zak [Thu, 31 Jan 2019 13:16:42 +0000 (14:16 +0100)] 
sfdisk: fix logical partition resize when start specified

Addresses: https://github.com/karelzak/util-linux/issues/745
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agologger: (man) add info about rewrite and authors
Karel Zak [Tue, 29 Jan 2019 14:59:41 +0000 (15:59 +0100)] 
logger: (man) add info about rewrite and authors

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agologger: (man) make more obvious that --server/socket is required
Karel Zak [Tue, 29 Jan 2019 14:44:13 +0000 (15:44 +0100)] 
logger: (man) make more obvious that --server/socket is required

The options --tcp/udp specify only how, but no where.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agobuild-sys: fix crypt() detection without -lcrypt
Johannes Nixdorf [Tue, 22 Jan 2019 18:17:55 +0000 (19:17 +0100)] 
build-sys: fix crypt() detection without -lcrypt

The check tested whether code using crypt() links without -lcrypt, but
didn't set have_crypt to yes if it succeeded.

This fixes the check erroneously failing when compiling against musl
libc.

Signed-off-by: Johannes Nixdorf <mixi@shadowice.org>
5 years agologger: concatenate multiple lines of MESSAGE into a single field.
Karel Zak [Wed, 23 Jan 2019 10:41:43 +0000 (11:41 +0100)] 
logger: concatenate multiple lines of MESSAGE into a single field.

this is deemed a useful special case since journalctl will only show
either the first or last element of the message array if the field
appears multiple times.

Based on patch from: Kjetil Torgrim Homme <kjetil.homme@redpill-linpro.com>
https://github.com/karelzak/util-linux/pull/743

Addresses: https://github.com/karelzak/util-linux/issues/742
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolibblkid: remove dependence on libuuid
Karel Zak [Tue, 22 Jan 2019 11:33:19 +0000 (12:33 +0100)] 
libblkid: remove dependence on libuuid

Currently we use libuuid to print UUID only. This code is possible to replace
by one snprintf(). It seems better to duplicate this one snprintf than force
all distros to keep libuuid together with libblkid.

Note, this scenario has been already supported on --disable-libuuid.

Reported-by: Josh Triplett <josh@joshtriplett.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agosetarch: don't return address of automatic variable
Andreas Schwab [Sat, 19 Jan 2019 22:18:16 +0000 (23:18 +0100)] 
setarch: don't return address of automatic variable

On architectures without special personalities setarch uses the contents
of a local variable with automatic storage duration after return from
the function, causing it to report a spurious error.

$ setarch m68k
setarch: Kernel cannot set architecture to m68k

Signed-off-by: Andreas Schwab <schwab@linux-m68k.org>
5 years agolosetup: update an error message
Jeffrey Ferreira [Tue, 22 Jan 2019 10:56:16 +0000 (11:56 +0100)] 
losetup: update an error message

Update an error message to add --partscan to the list of options
only allowed during loop device setup.

Signed-off-by: Jeffrey Ferreira <jeffpferreira@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolosetup: properly use --sector-size when create a new device
Karel Zak [Tue, 22 Jan 2019 10:50:20 +0000 (11:50 +0100)] 
losetup: properly use --sector-size when create a new device

The --partscan functionality depends on sector size. Make sure
sector size is set before we force kernel to scan the device for
partitions. For example:

 losetup -f loopfile --sector-size 4KiB --partscan --show

where 'loopfile' contains GPT with 4096 sectors.

Reported-by: Jeffrey Ferreira <jeffpferreira@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolib/loopdev: set blocksize when create a new device
Karel Zak [Tue, 22 Jan 2019 10:37:35 +0000 (11:37 +0100)] 
lib/loopdev: set blocksize when create a new device

The partition scanner in kernel depends on blocksize. We need to set
the blocksize before we call LOOP_SET_STATUS64 (this ioctl triggers
the scanner).

This patch extends the internal API to save blocksize into loopdev
context to be usable later for loopcxt_setup_device().

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agolib/loopdev: differentiate between setter()s and ioctl calls
Karel Zak [Tue, 22 Jan 2019 10:12:42 +0000 (11:12 +0100)] 
lib/loopdev: differentiate between setter()s and ioctl calls

Now the internal API uses loopcxt_set_...() to set context variables
as well as to call ioctls. This patch introduces loopcxt_ioctl_...()
to makes things more obvious to readers.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 years agoswapon: be more explicit about BTRFS
Karel Zak [Tue, 22 Jan 2019 09:13:54 +0000 (10:13 +0100)] 
swapon: be more explicit about BTRFS

It seems nocow and nodatasum attributes are required.
See btrfs_swap_activate() in  https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=ed46ff3d423780fa5173b38a844bf0fdb210a2a7

Addresses: https://github.com/karelzak/util-linux/issues/633
Signed-off-by: Karel Zak <kzak@redhat.com>