Commit Graph

15551 Commits

Author SHA1 Message Date
Karel Zak bb954f7658 build-sys: release++ (v2.37.1)
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 15:59:15 +02:00
Karel Zak 7169c01223 docs: update v2.37.1-ReleaseNotes
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 15:56:53 +02:00
Karel Zak 6bf2c99b2e docs: update AUTHORS file
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 15:55:04 +02:00
Karel Zak debce7468d po: merge changes
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 15:52:06 +02:00
Мирослав Николић 2349d4c090 po: update sr.po (from translationproject.org) 2021-07-22 15:46:26 +02:00
Rafael Fontenelle e5694e94b5 po: update pt_BR.po (from translationproject.org) 2021-07-22 15:46:26 +02:00
Antonio Ceballos Roa 5ba2c4317c po: update es.po (from translationproject.org) 2021-07-22 15:46:26 +02:00
Karel Zak 4fcd20534f lslogins: fix memory leak [asan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 11:35:38 +02:00
Karel Zak d1a5e99e8a lslogins: ask for supplementary groups only once [asan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 11:35:38 +02:00
Karel Zak f626170062 lslogins: use sd_journal_get_data() in proper way
man sd_journal_get_data:
    The returned data is in a read-only memory map and is only valid until the next invocation
    of sd_journal_get_data().

It means that use data after 3x sd_journal_get_data() is really bad
idea. It also seems better to not assume the fields are zero
terminated as journal API works with void* and size_t to address the
data.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1984704
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-22 11:35:22 +02:00
Karel Zak a3d73c246f login: add callback for close_range()
Let's make it more robust for old kernels where is no close_range() or
in cases when it's unsuccessful.

Reported-by: Florian Weimer <fweimer@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:53 +02:00
Karel Zak 650fca1a06 lslogins: consolidate and optimize utmp files use
* the original read_utmp() code is from GPLv3+, but lslogins is GPLv2+
  (see a6bf40ee77 (commitcomment-53407151))

* remove redundant parse_btmp() and parse_wtmp() as it does not
  provide anything

* reduce realloc() calls, allocate all in one step

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:53 +02:00
Karel Zak 22a2bce042 hardlink: remove pcre2posix.h support
It's deprecated for years. Let's rely on old good libc regex.h for now.

Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:53 +02:00
Karel Zak 937fe5d9c5 login: fix close_range() use
This new syscall comes with three arguments (see kernel commit
278a5fbaed89dacd04e9d052f4594ffd0e0585de). Not sure why util-linux
assume only two.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1981729
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:53 +02:00
Karel Zak 1bb08cfc01 tests: update sfdisk reorder test
References: commit f05a5bb2c2
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:59:05 +02:00
Karel Zak 4bea4821ab tests: skip if scsi_debug model file is not accessible
* do not print grep(1) info message

* use ts_skip rather than ts_die when scsi_debug is useless

Fixes: https://github.com/karelzak/util-linux/issues/1376
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:58:48 +02:00
Pali Rohár 18492b47b7 fdisk: move reorder diag messages to fdisk_reorder_partitions()
The function fdisk_reorder_partitions() is also used in sfdisk and cfdisk
and these commands assume info/warn messages from the library. So move all
messages from fdisk to fdisk_reorder_partitions().

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-20 11:58:13 +02:00
Luca Boccassi db4d80fcef verity: fix verity.roothashsig only working as last parameter
Parsing of verity.roothashsig did not take into consideration that other options
might follow, and used the whole string as a file path. But mnt_optstr_get_option
just returns a pointer in the mount option string, it doesn't extract it, so it
would have other subsequent options too. The length parameter has to be used.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2021-07-20 11:57:58 +02:00
Pali Rohár d501259161 fdisk: do not print error message when partition reordering is not needed
Option 'f' currently prints following RED error message:

    Nothing to do. Ordering is correct already.
    Failed to fix partitions order.

This change removes RED error message when ordering is already correct.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-20 11:57:13 +02:00
Pali Rohár ee3d6b0d4a libblkid: vfat: Fix reading FAT32 boot label
FAT32 can be formatted with boot sign 0x28 to indicate that only serial id
is present or with boot sign 0x29 which indicates that both boot label and
serial id is present.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-20 11:56:34 +02:00
Pali Rohár 9c3b9269d9 libblkid: vfat: Fix reading FAT16 boot label and serial id
Older FAT16 variants do not have to contain boot label or serial id. Boot
sign 0x28 indicates that only serial id is present and boot sign 0x29
indicates that both boot label and serial id is present. Other boot sign
values (e.g. zero) indicates older FAT16 variant without boot label and
boot sign.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-20 11:56:34 +02:00
Luca Boccassi 6a7194ea23 mount: fix roothash signature extension in manpage
The PKCS7 RFC recommends to use .p7s for detached signatures file extensions,
so use that in the example.

https://datatracker.ietf.org/doc/html/rfc5751#section-3.2.1
2021-07-20 11:55:32 +02:00
Luca Boccassi 71b98c36d4 meson: fix dlopen support for cryptsetup
dlopen is treated as a dependency, but that's not quite right, it
should be an alternative way to link to libcryptsetup.
Search for it only if cryptsetup is not disabled, and if the cryptsetup-dlopen
is explicitly set to enabled. If it is, do not link to libcryptsetup.

Add cryptsetup support status to the meson summary.
2021-07-20 11:55:21 +02:00
Luca Boccassi 8da7e26cbc meson: fix crypt_activate_by_signed_key detection
It should set HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY, rather than HAVE_CRYPTSETUP
which enables the verity features, as it needs to detect the availability of
the crypt_activate_by_signed_key API
2021-07-20 11:55:09 +02:00
Luca Boccassi 375afc17f4 build-sys: display cryptsetup status after ./configure
Signed-off-by: Luca Boccassi <bluca@debian.org>
2021-07-20 11:55:00 +02:00
Karel Zak 19dd7a1e30 lscpu: don't use DMI if executed with --sysroot
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:54:48 +02:00
Ross Burton be39647ac4 test/eject: guard asan LD_PRELOAD with use-system-commands check
This test tries to add asan to LD_PRELOAD because the just-built eject
will call the host /bin/umount, and apparently asan doesn't like this.

However, if ldd isn't present, this fails as the path to asan is the
error message saying that ldd isn't present.

As the asan workaround is only needed when executing the binaries that
have just been built and not the system binaries, only use it if the
test is on the built binaries.

Closes #1373.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-07-20 11:54:17 +02:00
Karel Zak 9ada40d3cc fstrim: clean return code on --quiet-unsupported
This feature is already supported for -a and -A. Let's support it also
when FS specified on command line.

Addresses: https://github.com/systemd/mkosi/pull/721
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:54:03 +02:00
Karel Zak 5ca73c6eef lsblk: normalize space in SERIAL and MODEL
These strings come from HW and udev does not modify it. It seems good
idea to clean up it before we print it.

Fixes: https://github.com/karelzak/util-linux/issues/1368
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:53:33 +02:00
Ross Burton 6269a5fc0d tests: mark ul/ul as a known failure
As with ul/basic, this test produces different output when ran under
different terminals, which isn't very useful.

Set TS_KNOWN_FAIL so that these problems don't cause the test to fail.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-07-20 11:53:10 +02:00
Ross Burton 89379c88db tests: check correct log file for errors in blkdiscard test
When checking if the discard ioctl is supported, look in stderr not stdout as
that is where the error appears.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-07-20 11:53:10 +02:00
Ross Burton 0be381be44 tests: don't hardcode /bin/kill in the kill tests
If the 'kill' test is executed with --use-system-commands, it calls
/bin/kill to avoid the shell's own kill command being invoked.

However, this doesn't work if the kill we want to test isn't in fact in
/bin.  Instead, use $(which kill) to find a kill on the PATH and call
that directly.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-07-20 11:52:16 +02:00
Karel Zak 54da548e02 cfdisk: optimize mountpoint detection for PARTUUID
Don't check fstab (and udev symplinks) for new UUIDs.

Fixes: https://github.com/karelzak/util-linux/issues/1331
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:51:44 +02:00
Karel Zak 2db4c7f0b3 hexdump: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:51:44 +02:00
Karel Zak 45f40a1ed8 pg: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:51:44 +02:00
Karel Zak 28941d202a misc: improve string to number conversions
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:51:02 +02:00
Karel Zak 97b7dcf32e include/strutils: consolidate string to number conversion
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:50:52 +02:00
Karel Zak cd969e8908 more: fix null-pointer dereference
The command allows executing arbitrary shell commands while viewing a file by
entering '!' followed by the command. Entering a command that contains a '%',
'!', or '\' causes a segmentation violation.

The same more(1) function has a problem when not file is specified (cat
/etc/passwd | more) on command line.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1975153
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:50:52 +02:00
Karel Zak c0617de5a4 agetty: do not use atol()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:50:52 +02:00
Karel Zak cb75cf88b8 lscpu: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:50:52 +02:00
Karel Zak 9ee95fa26a utmpdump: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:49:57 +02:00
Karel Zak 878307e960 swapon: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:49:57 +02:00
Karel Zak e4aad0a9c4 ipcs: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:49:57 +02:00
Karel Zak 0ea3e2f0ed eject: do not use atoi()
* remove unnecessary strtok() use
* remove atoi use()

Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:49:57 +02:00
Karel Zak ee021a5f9e fsck: do not use atoi()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:49:57 +02:00
Karel Zak a9768580a4 include/strutils: cleanup strto..() functions
* add ul_strtos64() and ul_strtou64()
* add simple test

Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:34:53 +02:00
Karel Zak cbfbbc44c4 blockdev: improve arguments parsing (remove atoi)
old version:
 # blockdev --setfra 4x096 /dev/sdc

new version:
 # blockdev --setfra 4x096 /dev/sdc
 blockdev: failed to parse command argument: '4x096'

Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:34:53 +02:00
Karel Zak 22cecf786f cfdisk: do not use atoi()
It's unnecessary to use atoi in this case.

Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:34:53 +02:00
Karel Zak aeba558136 readprofile: check errno after strto..()
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:34:53 +02:00
Karel Zak 9411b6ccf8 wipefs: check errno after strto..()
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-20 11:34:53 +02:00