thirdparty/util-linux.git
4 days agotests: fix TS_ENABLE_ASAN usage master
Karel Zak [Wed, 17 Apr 2019 08:38:50 +0000 (10:38 +0200)]
tests: fix TS_ENABLE_ASAN usage

Signed-off-by: Karel Zak <kzak@redhat.com>
4 days agotests: use TS_ENABLE_ASAN in tests to detect ASAN
Karel Zak [Wed, 17 Apr 2019 08:10:46 +0000 (10:10 +0200)]
tests: use TS_ENABLE_ASAN in tests to detect ASAN

It seems better to not use any random ASAN variable.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agomisc: consolidate version printing and close_stdout()
Karel Zak [Tue, 16 Apr 2019 13:14:13 +0000 (15:14 +0200)]
misc: consolidate version printing and close_stdout()

Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agoinclude/c: add print_version() macro
Karel Zak [Tue, 16 Apr 2019 11:47:17 +0000 (13:47 +0200)]
include/c: add print_version() macro

Let's consolidate the version printing code. It also seems better to
use exit() after --version, because it's handled in different way by
ASAN.

It's strange, but ASAN reports leaks after return in main(). Note that
we do not use free-before-exit.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agoinclude/closestream: add close_stdout_atexit()
Karel Zak [Tue, 16 Apr 2019 11:42:34 +0000 (13:42 +0200)]
include/closestream: add close_stdout_atexit()

It seems better to have a way to control when atexit(close_stdout()) is
used, because close stdout means that for example ASAN (or another
into binary integrated tool) is not able to print the final summary.

Signed-off-by: Karel Zak <kzak@redhat.com>
5 days agochcpu: fix memory leak
Karel Zak [Tue, 16 Apr 2019 08:51:35 +0000 (10:51 +0200)]
chcpu: fix memory leak

The CPU set has been allocated more than once.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agolibmount: fix compiler warning [-Wsometimes-uninitialized]
Karel Zak [Mon, 15 Apr 2019 11:35:21 +0000 (13:35 +0200)]
libmount: fix compiler warning [-Wsometimes-uninitialized]

Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agobuild-sys: enable ASAN on travis-ci
Karel Zak [Mon, 15 Apr 2019 11:05:33 +0000 (13:05 +0200)]
build-sys: enable ASAN on travis-ci

Addresses: Addresses: https://github.com/systemd/systemd/pull/12252
Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agobuild-sys: add ASAN_LDFLAGS
Karel Zak [Mon, 15 Apr 2019 11:01:21 +0000 (13:01 +0200)]
build-sys: add ASAN_LDFLAGS

Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agotests: ignore errors with enabled ASAN in python bindings
Karel Zak [Mon, 15 Apr 2019 10:58:48 +0000 (12:58 +0200)]
tests: ignore errors with enabled ASAN in python bindings

temporary solution... as it ends with
undefined symbol: __asan_option_detect_stack_use_after_return

Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agolibmount: fix memleak on parse errors
Karel Zak [Mon, 15 Apr 2019 10:55:46 +0000 (12:55 +0200)]
libmount: fix memleak on parse errors

Addresses: https://github.com/systemd/systemd/pull/12252
Signed-off-by: Karel Zak <kzak@redhat.com>
6 days agofstrim: get realpath before trim ioctl
Wang Shilong [Sun, 14 Apr 2019 03:31:56 +0000 (12:31 +0900)]
fstrim: get realpath before trim ioctl

Original motivation is we want to run fstrim command
on Lustre[1] osd server mount point directly, however
our server mount point doesn't export osd directory
to users, and it will cause following command fail:

 $fstrim -v /mnt/mds/

But following succeed:

 $fstrim -v /mnt/mds

We could improve this a bit by getting realpath
before trapping kernel, this also give benifits
to normal use cases.

Cc: Andreas Dilger <adilger@dilger.ca>
Cc: Shuichi Ihara <sihara@ddn.com>
[1] http://wiki.lustre.org/Main_Page
Signed-off-by: Wang Shilong <wshilong@ddn.com>
10 days agotests: update lscpu due to 'Vulnerability' fields
Karel Zak [Thu, 11 Apr 2019 11:55:51 +0000 (13:55 +0200)]
tests: update lscpu due to 'Vulnerability' fields

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolscpu: wrap default output long lines on terminal
Karel Zak [Thu, 11 Apr 2019 11:53:03 +0000 (13:53 +0200)]
lscpu: wrap default output long lines on terminal

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolscpu: report CPU vulnerabilities
Karel Zak [Thu, 11 Apr 2019 11:45:29 +0000 (13:45 +0200)]
lscpu: report CPU vulnerabilities

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agoinclude/strutils: add functions to replace and remove chars from string
Karel Zak [Thu, 11 Apr 2019 11:13:06 +0000 (13:13 +0200)]
include/strutils: add functions to replace and remove chars from string

Signed-off-by: Karel Zak <kzak@redhat.com>
10 days agolib/fileutils: add xreaddir()
Karel Zak [Thu, 11 Apr 2019 11:11:53 +0000 (13:11 +0200)]
lib/fileutils: add xreaddir()

Remove duplicate code and keep only one implementation in
include/fileutils.h.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 days agosetarch: add new e2k subarches
Andrew Savchenko [Fri, 23 Mar 2018 14:40:22 +0000 (17:40 +0300)]
setarch: add new e2k subarches

Signed-off-by: Karel Zak <kzak@redhat.com>
13 days agotests: add /mnt/test/foo^Mbar to mountinfo tests
Karel Zak [Mon, 8 Apr 2019 11:33:04 +0000 (13:33 +0200)]
tests: add /mnt/test/foo^Mbar to mountinfo tests

Addresses: https://github.com/karelzak/util-linux/issues/780
Signed-off-by: Karel Zak <kzak@redhat.com>
13 days agolibmount: don't use sscanf() for swaps parsing
Karel Zak [Mon, 8 Apr 2019 11:33:04 +0000 (13:33 +0200)]
libmount: don't use sscanf() for swaps parsing

Addresses: https://github.com/karelzak/util-linux/issues/780
Signed-off-by: Karel Zak <kzak@redhat.com>
13 days agolibmount: don't use sscanf() for mountinfo parsing
Karel Zak [Mon, 8 Apr 2019 11:33:04 +0000 (13:33 +0200)]
libmount: don't use sscanf() for mountinfo parsing

Addresses: https://github.com/karelzak/util-linux/issues/780
Signed-off-by: Karel Zak <kzak@redhat.com>
13 days agolibmount: don't use sscanf() for fstab parsing
Karel Zak [Mon, 8 Apr 2019 11:33:04 +0000 (13:33 +0200)]
libmount: don't use sscanf() for fstab parsing

Addresses: https://github.com/karelzak/util-linux/issues/780
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoMerge branch 'spelling' of https://github.com/jwilk-forks/util-linux
Karel Zak [Tue, 2 Apr 2019 10:05:25 +0000 (12:05 +0200)]
Merge branch 'spelling' of https://github.com/jwilk-forks/util-linux

* 'spelling' of https://github.com/jwilk-forks/util-linux:
  docs: fix typo

2 weeks agofstrim.c: Remove commnet about vfat not supporting fstrim
Marcos Paulo de Souza [Mon, 1 Apr 2019 21:38:31 +0000 (18:38 -0300)]
fstrim.c: Remove commnet about vfat not supporting fstrim

Commit f663b5b38f ("fat: add FITRIM ioctl for FAT file system") in
linux kernel added support for using fstrim with vfat filesystem.

Signed-off-by: Marcos Paulo de Souza <marcos.souza.org@gmail.com>
3 weeks agotastset: (man) add :N stride for CPU lists
Karel Zak [Fri, 29 Mar 2019 12:00:42 +0000 (13:00 +0100)]
tastset: (man) add :N stride for CPU lists

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agofsck: (man) labels are available for all filesystems
Karel Zak [Thu, 28 Mar 2019 14:29:09 +0000 (15:29 +0100)]
fsck: (man) labels are available for all filesystems

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agosu: change error message
Karel Zak [Mon, 25 Mar 2019 15:39:43 +0000 (16:39 +0100)]
su: change error message

We use PAM and if pam_strerror() returns nothing we have no clue why
authentication failed. It's mistake to blame incorrect password if
there are many possible reason...

Addresses: https://github.com/karelzak/util-linux/issues/778
Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agodocs: fix typo
Jakub Wilk [Fri, 22 Mar 2019 12:27:33 +0000 (13:27 +0100)]
docs: fix typo

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
4 weeks agotaskset: fix cpuset list parser
Karel Zak [Wed, 20 Mar 2019 12:12:25 +0000 (13:12 +0100)]
taskset: fix cpuset list parser

taskset hangs when executed with badly formatted cpuset list, for
example:

 $ taskset -c 0--1 true

The current cpuset list parser is pretty weak as based on scanf()
without strings verification ("-1" as input for "%u" returns
unexpected number). It seems faster and better to use strtoul() and
isdigit().

Addresses: https://github.com/karelzak/util-linux/issues/77
Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolscpu: (man) tiny changes
Karel Zak [Tue, 19 Mar 2019 16:00:01 +0000 (17:00 +0100)]
lscpu: (man) tiny changes

4 weeks agolscpu: fix excl[] array order
Karel Zak [Tue, 19 Mar 2019 15:56:28 +0000 (16:56 +0100)]
lscpu: fix excl[] array order

It (rows and columns) must be in ASCII order.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolscpu: fix and document --output-all
Karel Zak [Tue, 19 Mar 2019 15:47:55 +0000 (16:47 +0100)]
lscpu: fix and document --output-all

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolscpu: define libsmartcols flags for -e
Karel Zak [Tue, 19 Mar 2019 15:40:51 +0000 (16:40 +0100)]
lscpu: define libsmartcols flags for -e

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolscpu: fix --caches order
Karel Zak [Tue, 19 Mar 2019 15:24:54 +0000 (16:24 +0100)]
lscpu: fix --caches order

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolscpu: (man) make SYNOPSIS compatible with another utils
Karel Zak [Tue, 19 Mar 2019 13:22:33 +0000 (14:22 +0100)]
lscpu: (man) make SYNOPSIS compatible with another utils

In this case is really no reason to duplicate all options in SYNOPSIS.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolscpu: add --bytes
Karel Zak [Tue, 19 Mar 2019 13:21:02 +0000 (14:21 +0100)]
lscpu: add --bytes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolscpu: add --caches
Karel Zak [Tue, 19 Mar 2019 12:47:11 +0000 (13:47 +0100)]
lscpu: add --caches

$ lscpu -C
NAME ONE-SIZE ALL-SIZE WAYS TYPE        LEVEL
L3         8M       8M   16 Unified         3
L2       256K       1M    8 Unified         2
L1i       32K     128K    8 Instruction     1
L1d       32K     128K    8 Data            1

The patch also updates extra caches (s390) output in lsblk summary to
be compatible with output about normal caches.

Addresses: https://github.com/karelzak/util-linux/issues/663
Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolib/path: remove extra semi-colons
Karel Zak [Tue, 19 Mar 2019 11:40:49 +0000 (12:40 +0100)]
lib/path: remove extra semi-colons

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolscpu: rename macros and functions
Karel Zak [Tue, 19 Mar 2019 10:36:43 +0000 (11:36 +0100)]
lscpu: rename macros and functions

We need to differentiate between output about CPUs and another stuff
(caches in future). Let's make it more obvious in code.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agotests: update lscpu output
Karel Zak [Tue, 19 Mar 2019 12:56:26 +0000 (13:56 +0100)]
tests: update lscpu output

Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks agolscpu: report more usable cache sizes
Karel Zak [Tue, 19 Mar 2019 10:09:02 +0000 (11:09 +0100)]
lscpu: report more usable cache sizes

The current version reports cache size as reported by /sys, it means
real size of the one piece of the cache. This way provides minimal
overview about all system as the cache is often shared between CPUs.

It seems better to report all size of the caches in the summary
output. It also does not make sense to report sizes per core (or
socket) as CPU topology may be pretty complicated.

The final solution (not implemented yet) will be to have --list-caches
where we can report all details like all-size, item-size, per-core size,
ways, type, etc.

Addresses: https://github.com/karelzak/util-linux/issues/663
Signed-off-by: Karel Zak <kzak@redhat.com>
4 weeks 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>
4 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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 weeks 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

6 weeks 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>
6 weeks 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

6 weeks 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

6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks agoUpdate mount.8
MeggyCal [Thu, 7 Mar 2019 16:24:22 +0000 (17:24 +0100)]
Update mount.8

xfs is widely supported today

6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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

6 weeks 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

6 weeks 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>
6 weeks 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>
6 weeks 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>
6 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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>
7 weeks 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

7 weeks 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>
7 weeks 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>
8 weeks 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>
8 weeks 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>
8 weeks 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>
8 weeks 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>
8 weeks 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>
2 months 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>