Commit Graph

13248 Commits

Author SHA1 Message Date
Karel Zak 7c90efa384 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>
2019-03-05 11:06:41 +01:00
Karel Zak bb872a239c tests: add missing TS_CMD_UMOUNT check
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-04 17:32:03 +01:00
Karel Zak 2fadcded53 tests: (kill) do not use shell build-in
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-04 17:28:15 +01:00
Karel Zak 43b4a4d3c7 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>
2019-03-04 17:14:12 +01:00
Karel Zak 19e00ec9e9 tests: add missing ts_check_test_command calls
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-04 16:42:30 +01:00
Karel Zak 0b07e2682f 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>
2019-03-04 13:13:30 +01:00
Karel Zak b6c2665e4d 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
2019-03-04 11:48:20 +01:00
Karel Zak 3cd5e33b5c 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
2019-03-04 11:46:16 +01:00
Patrick Steinhardt 72aa1db70c 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>
2019-03-04 11:38:28 +01:00
Stanislav Brabec 89342e0406 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>
2019-03-04 11:38:28 +01:00
Stanislav Brabec dcf03ffb37 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>
2019-03-04 11:38:28 +01:00
Stanislav Brabec 5de9751997 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>
2019-03-04 11:38:17 +01:00
Marcos Paulo de Souza 3bb960c7b5 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>
2019-03-03 09:15:13 -03:00
Karel Zak 09fc947089 tests: make sure TS_HELPER_MBSENCODE compiled
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-03-01 15:04:54 +01:00
Karel Zak c9fbfcfc49 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>
2019-02-28 14:08:23 +01:00
Karel Zak 777c159353 tests: use subtests in fdisk/mbr-nondos-mode
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-27 12:22:33 +01:00
Karel Zak ca614ef8c7 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>
2019-02-27 12:03:28 +01:00
Erwan Velu b24c7d585d 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>
2019-02-27 10:16:27 +01:00
Karel Zak 69e0e554d7 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
2019-02-26 12:25:21 +01:00
Juerg Haefliger 834b3d07e4 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>
2019-02-25 14:08:56 +01:00
Karel Zak adea904a61 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>
2019-02-25 13:59:50 +01:00
dana 1ec4c065a2 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>
2019-02-22 14:42:58 -06:00
Karel Zak 911e694528 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>
2019-02-21 13:49:39 +01:00
Karel Zak 65ba9a8ccd 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>
2019-02-20 13:19:23 +01:00
Karel Zak b9c088f2f3 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>
2019-02-20 12:49:24 +01:00
Karel Zak ebb6368990 libsmartcols: print tree also for empty cells
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-20 12:47:24 +01:00
Karel Zak 3c21e32245 libfdisk: (dos) improve first unused sector for logical partitions
Make sure we probe within extended partition.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-18 16:38:11 +01:00
Sami Kerola 110260830d docs: fix typos [codespell]
Reference: https://github.com/codespell-project/codespell
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-02-18 13:22:43 +01:00
Sami Kerola fcb89ba7bb include/path.h: remove duplicate header inclusion
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-02-18 13:21:46 +01:00
Sami Kerola e73456dfbb 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>
2019-02-18 13:21:23 +01:00
Sami Kerola 123eb9ef8c 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>
2019-02-18 13:20:34 +01:00
Sami Kerola 4813a5210f 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>
2019-02-18 13:19:24 +01:00
Karel Zak d135e1a1e3 cal: fix Sexit and Senter
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-18 13:10:58 +01:00
Tobias Stoeckmann a6fb1ce79d 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>
2019-02-18 13:05:14 +01:00
Fabian.Kirsch@dlr.de 9a76780f86 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>
2019-02-18 12:58:07 +01:00
Karel Zak a57c9865f8 libmount: (tabdiff) use list_add_tail() in more robust way
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-18 12:35:51 +01:00
Karel Zak 1882b3a617 libfdisk: use list_add_tail() in more robust way
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-18 12:35:33 +01:00
Karel Zak ebc2397ec4 libsmartcols: use list_add_tail() in more robust way
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-18 12:33:12 +01:00
Karel Zak 84084dc324 libblkid: tiny code simplification
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-18 12:32:25 +01:00
Tim Hildering beb60dbd6f 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>
2019-02-18 11:50:52 +01:00
Karel Zak 3de236340d 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>
2019-02-14 10:41:59 +01:00
Karel Zak f920f73d83 tests: update fdisk outputs
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-12 14:22:49 +01:00
Karel Zak 39f37044b3 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>
2019-02-12 14:21:54 +01:00
Karel Zak 07b94c9f32 lib/strutils: support two decimal places in size_to_human_string() output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-12 14:20:55 +01:00
Karel Zak 3b9dc305ee tests: (hardlink) update noregex
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 14:53:51 +01:00
Karel Zak 985421192d hardlink: add long options
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 14:01:55 +01:00
Karel Zak c8ca29beb2 hardlink: rename function
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 13:30:46 +01:00
Karel Zak bd7722af02 hardlink: make code more readable
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 13:25:04 +01:00
Karel Zak 0b05aab402 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>
2019-02-11 13:18:35 +01:00
Karel Zak 3807e71af4 hardlink: remove typedefs
- remove typedefs
- use long names for structs

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-02-11 13:00:18 +01:00