]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
12 months agolibblkid: bitlocker: fix version on big-endian systems
Victor Westerhuis [Thu, 25 Jul 2024 13:10:16 +0000 (15:10 +0200)] 
libblkid: bitlocker: fix version on big-endian systems

12 months agoagetty: fix ambiguous ‘else’ [-Werror=dangling-else]
Karel Zak [Wed, 24 Jul 2024 07:13:08 +0000 (09:13 +0200)] 
agetty: fix ambiguous ‘else’ [-Werror=dangling-else]

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoagetty: Prevent cursor escape
Stanislav Brabec [Sun, 21 Jul 2024 13:01:42 +0000 (15:01 +0200)] 
agetty: Prevent cursor escape

Starting with 5de97519, it is possible to escape the login dialog on the
screen by arrow characters or using escape sequences.

Since full processing of escape sequences and ignore them would be
complicated, use a work around: instead of sending ESC to output, send a
printable character.

It could cause a rendering regression in a very obscure condition: compiled
without IUTF8, encoding is ISO-11548-1 and BRAILLE PATTERN DOTS-1245 is
part of login name. I believe that it is out of supported combinations.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
12 months agoMerge branch 'PR/coverity-misc' of github.com:karelzak/util-linux-work
Karel Zak [Tue, 23 Jul 2024 12:07:10 +0000 (14:07 +0200)] 
Merge branch 'PR/coverity-misc' of github.com:karelzak/util-linux-work

* 'PR/coverity-misc' of github.com:karelzak/util-linux-work:
  cal: make sure day_in_week() does not overrun array size [coverity scan]

12 months agoscriptlive: add --echo <never|always|auto>
Karel Zak [Tue, 23 Jul 2024 11:57:46 +0000 (13:57 +0200)] 
scriptlive: add --echo <never|always|auto>

It would be beneficial to have a method for controlling the ECHO flag.

References: https://github.com/util-linux/util-linux/pull/3133
Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoMerge branch 'scriptlive_echo' of https://github.com/werekraken/util-linux
Karel Zak [Tue, 23 Jul 2024 11:44:48 +0000 (13:44 +0200)] 
Merge branch 'scriptlive_echo' of https://github.com/werekraken/util-linux

* 'scriptlive_echo' of https://github.com/werekraken/util-linux:
  scriptlive: echo re-run commands from in stream

12 months agolibuuid: fix gcc15 warnings
Cristian Rodríguez [Fri, 19 Jul 2024 00:40:33 +0000 (20:40 -0400)] 
libuuid: fix gcc15 warnings

gcc15 complains that the initialization is too long, indeed it is not
counting the last null byte, fix by simply not using an explicit count

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoscriptlive: echo re-run commands from in stream
Matt Cover [Sat, 20 Jul 2024 21:49:35 +0000 (14:49 -0700)] 
scriptlive: echo re-run commands from in stream

12 months agolibuuid: set variant in the corrrect byte: __uuid_set_variant_and_version
oittaa [Tue, 16 Jul 2024 01:35:58 +0000 (03:35 +0200)] 
libuuid: set variant in the corrrect byte: __uuid_set_variant_and_version

12 months agoMerge branch 'mes2' of https://github.com/neheb/util-linux
Karel Zak [Mon, 15 Jul 2024 10:16:16 +0000 (12:16 +0200)] 
Merge branch 'mes2' of https://github.com/neheb/util-linux

* 'mes2' of https://github.com/neheb/util-linux:
  meson: add options for more utilities

12 months agoMerge branch 'kill--decode' of https://github.com/masatake/util-linux
Karel Zak [Mon, 15 Jul 2024 10:15:28 +0000 (12:15 +0200)] 
Merge branch 'kill--decode' of https://github.com/masatake/util-linux

* 'kill--decode' of https://github.com/masatake/util-linux:
  kill: (test) add a case for testing -l 0xSIGMASK and -d $PID options
  kill: add a feature decoding signal masks

12 months agocal: make sure day_in_week() does not overrun array size [coverity scan]
Karel Zak [Thu, 11 Jul 2024 12:15:44 +0000 (14:15 +0200)] 
cal: make sure day_in_week() does not overrun array size [coverity scan]

It's very theoretical, but protect against this possibility.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoagetty: add "systemd" to --version output
Karel Zak [Thu, 11 Jul 2024 11:26:30 +0000 (13:26 +0200)] 
agetty: add "systemd" to --version output

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agouuidd: fix typo in tmpfiles.conf
Karel Zak [Wed, 10 Jul 2024 13:55:35 +0000 (15:55 +0200)] 
uuidd: fix typo in tmpfiles.conf

Let's change 2755 to 2775. The directory must be writable for the
'uuidd' group.

Addresses: http://github.com/util-linux/util-linux/commit/e0c41735aa13a7a62e42c0428823537d3edc02a8
Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoMerge branch 'bug3120' of https://github.com/dgibson/util-linux
Karel Zak [Wed, 10 Jul 2024 09:31:54 +0000 (11:31 +0200)] 
Merge branch 'bug3120' of https://github.com/dgibson/util-linux

* 'bug3120' of https://github.com/dgibson/util-linux:
  unshare: Add options to identity map the user's subordinate uids and gids

12 months agoMerge branch 'mess' of https://github.com/neheb/util-linux
Karel Zak [Wed, 10 Jul 2024 09:22:05 +0000 (11:22 +0200)] 
Merge branch 'mess' of https://github.com/neheb/util-linux

* 'mess' of https://github.com/neheb/util-linux:
  meson: po: disable if nls is disabled

12 months agoMerge branch 'tos_basic_data' of https://github.com/uweseimet/util-linux
Karel Zak [Wed, 10 Jul 2024 08:07:34 +0000 (10:07 +0200)] 
Merge branch 'tos_basic_data' of https://github.com/uweseimet/util-linux

* 'tos_basic_data' of https://github.com/uweseimet/util-linux:
  Add GPT type "Atari TOS basic data" (734E5AFE-F61A-11E6-BC64-92361F002671)

12 months agolsmem: improve coding style
Karel Zak [Wed, 10 Jul 2024 08:06:54 +0000 (10:06 +0200)] 
lsmem: improve coding style

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoMerge branch 'lsmem' of https://github.com/biubiuzy/util-linux
Karel Zak [Wed, 10 Jul 2024 08:05:20 +0000 (10:05 +0200)] 
Merge branch 'lsmem' of https://github.com/biubiuzy/util-linux

* 'lsmem' of https://github.com/biubiuzy/util-linux:
  lsmem: make lsmem to check for the nodes more robust

12 months agouuidd: fix /var/lib/libuuid mode uuidd-tmpfiles.conf
Karel Zak [Tue, 9 Jul 2024 15:04:09 +0000 (17:04 +0200)] 
uuidd: fix /var/lib/libuuid mode uuidd-tmpfiles.conf

The directory can be directly used by libuuid, for example, by running
"uuidgen --time" as root, even if the uuidd daemon is not installed.
In this case, we must create a clock.txt file with the uuidd group to
prevent any potential ownership mismatch if the uuidd daemon is
installed later. The 2xxx mode (setgid) forces open(O_CREAT) in
libuuid to create the file with the uuidd group.

Please note that mode 2755 is the standard used for years in RHEL.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoAdd GPT type "Atari TOS basic data" (734E5AFE-F61A-11E6-BC64-92361F002671)
Uwe Seimet [Tue, 9 Jul 2024 10:23:14 +0000 (12:23 +0200)] 
Add GPT type "Atari TOS basic data" (734E5AFE-F61A-11E6-BC64-92361F002671)

12 months agoMerge branch 'spaces' of https://github.com/emperor06/util-linux
Karel Zak [Tue, 9 Jul 2024 08:42:58 +0000 (10:42 +0200)] 
Merge branch 'spaces' of https://github.com/emperor06/util-linux

* 'spaces' of https://github.com/emperor06/util-linux:
  column: Adds option -S <num> so whitespaces are used instead of tabs in non table mode.

12 months agounshare: Add options to identity map the user's subordinate uids and gids
David Gibson [Tue, 9 Jul 2024 05:44:31 +0000 (15:44 +1000)] 
unshare: Add options to identity map the user's subordinate uids and gids

--map-users=auto, --map-groups=auto and --map-auto allow automatically
mapping the first block of user or group IDs owned by the effective user
from /etc/sub[ug]id to a block starting at user ID 0.  Add options
--map-users=subids, --map-groups=subids and --map-subids to perform a
mapping of the same IDs, but as an identity mapping instead of to UID 0.

This is useful in similar situations to --map-current-user, but preserves
access to the user's subordinate IDs.  That allows nested namespaces to
be created with more complex user mappings, either with unshare or with
a container runtime such as podman.

Fixes: https://github.com/util-linux/util-linux/issues/3120
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
12 months agomeson: add options for more utilities
Rosen Penev [Tue, 2 Jul 2024 19:52:13 +0000 (12:52 -0700)] 
meson: add options for more utilities

Allows using -Dauto_features=disabled to disable most utilities.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
12 months agoliblastlog2: tests: provide fallback PATH_MAX definition
Pino Toscano [Mon, 8 Jul 2024 17:16:30 +0000 (19:16 +0200)] 
liblastlog2: tests: provide fallback PATH_MAX definition

... by including the helper "c.h", which will do the right job.

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
12 months agoMerge branch 'patch-1' of https://github.com/tbertels/util-linux
Karel Zak [Mon, 8 Jul 2024 11:17:35 +0000 (13:17 +0200)] 
Merge branch 'patch-1' of https://github.com/tbertels/util-linux

* 'patch-1' of https://github.com/tbertels/util-linux:
  Prevent problems with period after the URL

12 months agomeson: add missing sample-mount-overwrite
Karel Zak [Mon, 8 Jul 2024 11:15:05 +0000 (13:15 +0200)] 
meson: add missing sample-mount-overwrite

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agocolumn: Adds option -S <num> so whitespaces are used instead of tabs in non table...
drax [Sat, 6 Jul 2024 23:29:27 +0000 (01:29 +0200)] 
column: Adds option -S <num> so whitespaces are used instead of tabs in non table mode.

Entries are padded with whitespaces, then <num> spaces are added to separate the columns.
This should fix https://github.com/util-linux/util-linux/issues/1551

12 months agoMerge branch 'build-only-linux' of https://github.com/pinotree/util-linux
Karel Zak [Mon, 8 Jul 2024 10:44:04 +0000 (12:44 +0200)] 
Merge branch 'build-only-linux' of https://github.com/pinotree/util-linux

* 'build-only-linux' of https://github.com/pinotree/util-linux:
  build-sys: build sample-mount-overwrite only on Linux

12 months agotests: add mount-api-utils.h to linux only ifdef
Karel Zak [Mon, 8 Jul 2024 10:41:34 +0000 (12:41 +0200)] 
tests: add mount-api-utils.h to linux only ifdef

This is a cosmetic change. Let's use the already defined Linux-only
ifdef for mount-api-utils.h too.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agokill: (test) add a case for testing -l 0xSIGMASK and -d $PID options
Masatake YAMATO [Sun, 7 Jul 2024 17:53:52 +0000 (02:53 +0900)] 
kill: (test) add a case for testing -l 0xSIGMASK and -d $PID options

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
12 months agotests: include <sys/mount.h> only on Linux
Pino Toscano [Sun, 7 Jul 2024 07:08:06 +0000 (09:08 +0200)] 
tests: include <sys/mount.h> only on Linux

Include <sys/mount.h> only on Linux; it is used for fsopen(), which is
available only on Linux.

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
12 months agobuild-sys: build sample-mount-overwrite only on Linux
Pino Toscano [Sun, 7 Jul 2024 06:52:45 +0000 (08:52 +0200)] 
build-sys: build sample-mount-overwrite only on Linux

This sample uses the libmnt_context API, which is available only on
Linux.

Signed-off-by: Pino Toscano <toscano.pino@tiscali.it>
12 months agoPrevent problems with period after the URL
Thomas Bertels [Thu, 4 Jul 2024 10:41:51 +0000 (12:41 +0200)] 
Prevent problems with period after the URL

Otherwise, the period gets included in the URL which makes it not work.

12 months agolsmem: make lsmem to check for the nodes more robust
zhangyao [Thu, 4 Jul 2024 08:28:51 +0000 (16:28 +0800)] 
lsmem: make lsmem to check for the nodes more robust

See #3110.

12 months agokill: add a feature decoding signal masks
Masatake YAMATO [Sun, 30 Jun 2024 12:09:44 +0000 (21:09 +0900)] 
kill: add a feature decoding signal masks

-l/--list option is extended to work well with the output of ps command:

   $ ps s $$
     UID     PID          PENDING          BLOCKED          IGNORED           CAUGHT STAT TTY        TIME COMMAND
    1000 1588189 0000000000000000 0000000000010000 0000000000384004 000000004b813efb S    pts/56     0:00 bash

   $ ./kill --list 0x000000004b813efb
   HUP
   INT
   ILL
   TRAP
   ABRT
   ...

If you know the pid you are interested in, you can skip running ps
comman with -d/--show-process-state option:

   $ ./kill --show-process-state $$
   Blocked: INT
   Ignored: TERM TSTP TTIN TTOU
   Caught: HUP INT PIPE ALRM CHLD WINCH

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
12 months agomeson: po: disable if nls is disabled
Rosen Penev [Tue, 2 Jul 2024 19:51:37 +0000 (12:51 -0700)] 
meson: po: disable if nls is disabled

Doesn't make much sense to build.

Signed-off-by: Rosen Penev <rosenp@gmail.com>
12 months agorename: use ul_basename()
Karel Zak [Tue, 2 Jul 2024 09:23:13 +0000 (11:23 +0200)] 
rename: use ul_basename()

Fixes: https://github.com/util-linux/util-linux/issues/3071
Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agolib/fileutils: add ul_basename()
Karel Zak [Tue, 2 Jul 2024 09:14:06 +0000 (11:14 +0200)] 
lib/fileutils: add ul_basename()

Unfortunately, the basename() function can be affected by the
creativity of different libc authors, resulting in varying behavior
across implementations.

Instead, use a local implementation to ensure consistency and
portability.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoMerge branch 'automake/install-dependency' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 2 Jul 2024 07:32:19 +0000 (09:32 +0200)] 
Merge branch 'automake/install-dependency' of https://github.com/t-8ch/util-linux

* 'automake/install-dependency' of https://github.com/t-8ch/util-linux:
  autotools: Properly order install dependencies of pam_lastlog2
  autotools: make pam install path configurable

12 months agomisc-utils:uuidd: Use ul_sig_err instead of errx
Cristian Rodríguez [Mon, 1 Jul 2024 22:10:49 +0000 (18:10 -0400)] 
misc-utils:uuidd: Use ul_sig_err instead of errx

Calling errx in sa_handler is as-unsafe as it is implemented using stdio.

12 months agolibfdisk: fix fdisk_partition_start_follow_default() docs
Karel Zak [Mon, 1 Jul 2024 12:35:55 +0000 (14:35 +0200)] 
libfdisk: fix fdisk_partition_start_follow_default() docs

Unfortunately, the behavior is different between DOS (original docs)
and GPT. Due to the need for backward compatibility, it is likely
impossible to change the default setting ...

Addresses: https://github.com/util-linux/util-linux/issues/3097
Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoautotools: Properly order install dependencies of pam_lastlog2
Thomas Weißschuh [Sun, 30 Jun 2024 09:23:53 +0000 (11:23 +0200)] 
autotools: Properly order install dependencies of pam_lastlog2

As pam_lastlog2 is relinked during installation, all its dependencies
need to already be installed.
This is the same issue that affected pylibmount which was fixed in
commit 324330aca644 ("build-sys: Properly order install dependencies of pylibmount").
Extend the logic added in that commit to also apply to pam_lastlog2.

Closes: #3011
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 months agoautotools: make pam install path configurable
Thomas Weißschuh [Mon, 1 Jul 2024 12:04:46 +0000 (14:04 +0200)] 
autotools: make pam install path configurable

While at it, also move the initial definition of
usesecurelib_exec_LTLIBRARIES into Makefile.am.
Also add "exec" to the target name which is recognized by automake to
mark the targets as architecture-specific.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
13 months agoMerge branch 'PR/lsblk-properties-by' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 27 Jun 2024 09:56:52 +0000 (11:56 +0200)] 
Merge branch 'PR/lsblk-properties-by' of github.com:karelzak/util-linux-work

* 'PR/lsblk-properties-by' of github.com:karelzak/util-linux-work:
  lsblk: add --properties-by option

13 months agoMerge branch 'PR/cfdisk-tiny-fixes' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 27 Jun 2024 09:56:33 +0000 (11:56 +0200)] 
Merge branch 'PR/cfdisk-tiny-fixes' of github.com:karelzak/util-linux-work

* 'PR/cfdisk-tiny-fixes' of github.com:karelzak/util-linux-work:
  lib/colors: free unnecessary ncurses resources
  cfdisk: fix possible integer overflow [coverity scan]

13 months agoMerge branch 'hexdump-build' of https://github.com/robimarko/util-linux
Karel Zak [Thu, 27 Jun 2024 09:54:37 +0000 (11:54 +0200)] 
Merge branch 'hexdump-build' of https://github.com/robimarko/util-linux

* 'hexdump-build' of https://github.com/robimarko/util-linux:
  hexdump: allow enabling with --disable-all-programs

13 months agosys-utils/setpgid: fix --help typo (foregound > foreground) + alignment
Emanuele Torre [Wed, 26 Jun 2024 07:43:43 +0000 (09:43 +0200)] 
sys-utils/setpgid: fix --help typo (foregound > foreground) + alignment

Typo reported by @yurchor on github
https://github.com/util-linux/util-linux/commit/f092076fecc7ada2911df1b34f75091573ac08a8#r139271937

13 months agosys-utils/setpgid: make -f work
Emanuele Torre [Wed, 26 Jun 2024 07:22:59 +0000 (09:22 +0200)] 
sys-utils/setpgid: make -f work

f  was missing from the getopt_long optstring so only --foreground was
working, not -f.

13 months agohexdump: allow enabling with --disable-all-programs
Robert Marko [Tue, 25 Jun 2024 15:32:08 +0000 (17:32 +0200)] 
hexdump: allow enabling with --disable-all-programs

Currently, if --disable-all-programs is used hexdump cannot be built
as --enable-hexdump is not recognized, so lets add support for it.

Signed-off-by: Robert Marko <robimarko@gmail.com>
13 months agolsblk: add --properties-by option
Karel Zak [Mon, 24 Jun 2024 10:09:38 +0000 (12:09 +0200)] 
lsblk: add --properties-by option

This new option allows for controlling the method(s) used by lsblk to
gather file system and partition data about devices.

Fixes: https://github.com/util-linux/util-linux/issues/2047
Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agoMerge branch 'PR/swapoff-oom' of github.com:karelzak/util-linux-work
Karel Zak [Mon, 24 Jun 2024 08:05:14 +0000 (10:05 +0200)] 
Merge branch 'PR/swapoff-oom' of github.com:karelzak/util-linux-work

* 'PR/swapoff-oom' of github.com:karelzak/util-linux-work:
  swapoff: avoid being killed by OOM

13 months agolib/colors: free unnecessary ncurses resources
Karel Zak [Mon, 24 Jun 2024 08:00:33 +0000 (10:00 +0200)] 
lib/colors: free unnecessary ncurses resources

Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agocfdisk: fix possible integer overflow [coverity scan]
Karel Zak [Mon, 24 Jun 2024 07:46:37 +0000 (09:46 +0200)] 
cfdisk: fix possible integer overflow [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agoMerge branch 'PR/libmount-fix-mesg' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 20 Jun 2024 10:22:06 +0000 (12:22 +0200)] 
Merge branch 'PR/libmount-fix-mesg' of github.com:karelzak/util-linux-work

* 'PR/libmount-fix-mesg' of github.com:karelzak/util-linux-work:
  libmount: improving robustness in reading kernel messages

13 months agoMerge branch 'PR/unshare-binfmt_misc' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 20 Jun 2024 10:20:07 +0000 (12:20 +0200)] 
Merge branch 'PR/unshare-binfmt_misc' of github.com:karelzak/util-linux-work

* 'PR/unshare-binfmt_misc' of github.com:karelzak/util-linux-work:
  unshare: load binfmt_misc interpreter
  unshare: mount binfmt_misc

13 months agoumount, losetup: Document loop destroy behavior
Stanislav Brabec [Wed, 19 Jun 2024 15:31:34 +0000 (17:31 +0200)] 
umount, losetup: Document loop destroy behavior

The loop device detach runs asynchronously in the background. It can cause
unexpected errors. Document the possible existence of the loop device after
exit of losetup -d or umount and need of "udevadm settle".

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
13 months agoswapoff: avoid being killed by OOM
Karel Zak [Thu, 20 Jun 2024 10:07:12 +0000 (12:07 +0200)] 
swapoff: avoid being killed by OOM

Based on patch from dparalen <vetrisko@gmail.com>.

Fixes: https://github.com/util-linux/util-linux/issues/3095
Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agounshare: load binfmt_misc interpreter
Laurent Vivier [Wed, 19 Jun 2024 08:19:51 +0000 (10:19 +0200)] 
unshare: load binfmt_misc interpreter

add -l, --load-interp <file> to load a binfmt_misc interpreter at startup.

The interpreter is loaded from the initial fileystem if the 'F' flags is
provided, otherwise from inside the new namespace
This makes possible to start a chroot of another architecture without
being root.

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
13 months agounshare: mount binfmt_misc
Laurent Vivier [Wed, 19 Jun 2024 08:19:50 +0000 (10:19 +0200)] 
unshare: mount binfmt_misc

add --mount-binfmt[=<dir>] to mount binfmt_misc filesystem,
this results in clearing inherited interpreters from the previous namespace

Signed-off-by: Laurent Vivier <laurent@vivier.eu>
13 months agolslocks: remove unnecessary code
Karel Zak [Wed, 19 Jun 2024 09:54:40 +0000 (11:54 +0200)] 
lslocks: remove unnecessary code

Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agolibmount: improving robustness in reading kernel messages
Karel Zak [Wed, 19 Jun 2024 09:19:49 +0000 (11:19 +0200)] 
libmount: improving robustness in reading kernel messages

* Ensure data termination from read() function
* Allocate space for terminator using "sizeof(buf)-1"

Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agolib/sysfs: zero-terminate result of sysfs_blkdev_get_devchain()
Thomas Weißschuh [Wed, 12 Jun 2024 21:32:15 +0000 (23:32 +0200)] 
lib/sysfs: zero-terminate result of sysfs_blkdev_get_devchain()

sysfs_blkdev_get_devchain() does not zero-terminate its result, but the
caller expects a C-string.
Use ul_buffer_get_string() which includes a trailing zero-byte.

Now it's also valid for sz and bufsz to be equal.

See #3088.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
13 months agolib/buffer: introduce ul_buffer_get_string()
Thomas Weißschuh [Thu, 13 Jun 2024 09:39:34 +0000 (11:39 +0200)] 
lib/buffer: introduce ul_buffer_get_string()

Some users need a zero-byte-terminated string.
As the buffer internally already maintains a zero-termination, add a
helper function that exposes this to users.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
13 months agolib/sysfs: abort device hierarchy walk at root of sysfs
Thomas Weißschuh [Wed, 12 Jun 2024 21:30:28 +0000 (23:30 +0200)] 
lib/sysfs: abort device hierarchy walk at root of sysfs

It does not make sense to leave the sysfs hierarchy during the walk of
the parent directories.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
13 months agoMerge branch 'lsfd--close-all' of https://github.com/masatake/util-linux
Karel Zak [Mon, 10 Jun 2024 09:10:07 +0000 (11:10 +0200)] 
Merge branch 'lsfd--close-all' of https://github.com/masatake/util-linux

* 'lsfd--close-all' of https://github.com/masatake/util-linux:
  lsfd: minimize the output related to lsfd itself

13 months agolsns: ignore ESRCH errors reported when accessing files under /proc
Masatake YAMATO [Fri, 7 Jun 2024 19:54:03 +0000 (04:54 +0900)] 
lsns: ignore ESRCH errors reported when accessing files under /proc

Fix #2799.

If a process is gone, system calls accessing files under /proc can
return ESRCH.

Suggested by Johannes Edmeier (@joshiste).
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
13 months agolsfd: minimize the output related to lsfd itself
Masatake YAMATO [Thu, 4 Jan 2024 02:33:51 +0000 (11:33 +0900)] 
lsfd: minimize the output related to lsfd itself

Copied from the test case in lib/fileutils.c.

13 months agoWall: Fix terminal flag usage
Karel Zak [Thu, 6 Jun 2024 07:36:28 +0000 (09:36 +0200)] 
Wall: Fix terminal flag usage
.
Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agoMerge branch 'ci/armv7' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 6 Jun 2024 07:32:19 +0000 (09:32 +0200)] 
Merge branch 'ci/armv7' of https://github.com/t-8ch/util-linux

* 'ci/armv7' of https://github.com/t-8ch/util-linux:
  ci: test on armv7
  lsfd: (tests) skip tests using fd flags on qemu-user

13 months agoMerge branch 'spelling' of https://github.com/scop/util-linux
Karel Zak [Thu, 6 Jun 2024 07:30:25 +0000 (09:30 +0200)] 
Merge branch 'spelling' of https://github.com/scop/util-linux

* 'spelling' of https://github.com/scop/util-linux:
  *: spelling and grammar fixes

13 months agoMerge branch 'feat/logger-sd-completions' of https://github.com/scop/util-linux
Karel Zak [Thu, 6 Jun 2024 07:27:19 +0000 (09:27 +0200)] 
Merge branch 'feat/logger-sd-completions' of https://github.com/scop/util-linux

* 'feat/logger-sd-completions' of https://github.com/scop/util-linux:
  bash-completion: add logger --sd-* completions

13 months agoMerge branch 'wdctl/compat-chardev' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 6 Jun 2024 07:26:26 +0000 (09:26 +0200)] 
Merge branch 'wdctl/compat-chardev' of https://github.com/t-8ch/util-linux

* 'wdctl/compat-chardev' of https://github.com/t-8ch/util-linux:
  wdctl: always query device node when sysfs is unavailable

13 months agoMerge branch 'PR/wall-tty-list' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 6 Jun 2024 07:25:10 +0000 (09:25 +0200)] 
Merge branch 'PR/wall-tty-list' of github.com:karelzak/util-linux-work

* 'PR/wall-tty-list' of github.com:karelzak/util-linux-work:
  wall: always use utmp as fallback

13 months ago*: spelling and grammar fixes
Ville Skyttä [Tue, 4 Jun 2024 20:44:40 +0000 (23:44 +0300)] 
*: spelling and grammar fixes

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
13 months agobash-completion: add logger --sd-* completions
Ville Skyttä [Tue, 4 Jun 2024 20:19:38 +0000 (23:19 +0300)] 
bash-completion: add logger --sd-* completions

Signed-off-by: Ville Skyttä <ville.skytta@iki.fi>
13 months agowdctl: always query device node when sysfs is unavailable
Thomas Weißschuh [Tue, 4 Jun 2024 19:06:49 +0000 (21:06 +0200)] 
wdctl: always query device node when sysfs is unavailable

When there is no sysfs at all for the watchdog, fall back to reading
from the device node.
This is also useful if the legacy compat /dev/watchdog device which
never has a sysfs interface.

Closes: #3073
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
13 months agoci: test on armv7
Thomas Weißschuh [Sun, 4 Feb 2024 20:46:48 +0000 (21:46 +0100)] 
ci: test on armv7

Currently no tests are running on 32bit ARM.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
13 months agolsfd: (tests) skip tests using fd flags on qemu-user
Thomas Weißschuh [Mon, 29 Apr 2024 06:11:57 +0000 (08:11 +0200)] 
lsfd: (tests) skip tests using fd flags on qemu-user

The flags value visible in /proc/$PID/fdinfo/ is encoded using the
platform the kernel is running on.
Not all platforms use the same numeric flag value,
making this cross-platform interpretation brittle.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
13 months agoscriptreplay: fix uninitialized value [coverity scan]
Karel Zak [Tue, 4 Jun 2024 11:19:13 +0000 (13:19 +0200)] 
scriptreplay: fix uninitialized value [coverity scan]

* fix uninitialized value "rc"

* simplify if(rc) block

Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agoMerge branch 'master' of https://github.com/jamacku/util-linux
Karel Zak [Tue, 4 Jun 2024 07:41:26 +0000 (09:41 +0200)] 
Merge branch 'master' of https://github.com/jamacku/util-linux

* 'master' of https://github.com/jamacku/util-linux:
  ci: enable dependency manager for GitHub Actions

13 months agoMerge branch 'squash' of https://github.com/BourgeoisBear/util-linux
Karel Zak [Tue, 4 Jun 2024 07:35:20 +0000 (09:35 +0200)] 
Merge branch 'squash' of https://github.com/BourgeoisBear/util-linux

* 'squash' of https://github.com/BourgeoisBear/util-linux:
  last/lastb field truncation indicator

13 months agoMerge branch 'as-safe-printf' of https://github.com/crrodriguez/util-linux
Karel Zak [Tue, 4 Jun 2024 07:29:13 +0000 (09:29 +0200)] 
Merge branch 'as-safe-printf' of https://github.com/crrodriguez/util-linux

* 'as-safe-printf' of https://github.com/crrodriguez/util-linux:
  Allow printf to be used on signal handlers

13 months agoMerge branch 'PR/libmount-fds' of github.com:karelzak/util-linux-work
Karel Zak [Tue, 4 Jun 2024 07:14:49 +0000 (09:14 +0200)] 
Merge branch 'PR/libmount-fds' of github.com:karelzak/util-linux-work

* 'PR/libmount-fds' of github.com:karelzak/util-linux-work:
  libmount: fix tree FD usage in subdir hook

13 months agoMerge branch 'master' of https://github.com/jlinton/util-linux
Karel Zak [Tue, 4 Jun 2024 07:14:22 +0000 (09:14 +0200)] 
Merge branch 'master' of https://github.com/jlinton/util-linux

* 'master' of https://github.com/jlinton/util-linux:
  lscpu: New Arm Cortex part numbers

13 months agolibmount: fix tree FD usage in subdir hook
Karel Zak [Mon, 3 Jun 2024 10:33:01 +0000 (12:33 +0200)] 
libmount: fix tree FD usage in subdir hook

* Initialize the tree file descriptor in the hook_subdir.c module if
  it has not been initialized yet. (hook_mount.c does not open the
  tree if the mount.<type> helper will be executed.)

* Move the function to open the tree to context.c to make it more
  generic and usable in more places.

Reported-by: Linus Heckemann <git@sphalerite.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
13 months agowall: always use utmp as fallback
Karel Zak [Mon, 3 Jun 2024 12:32:18 +0000 (14:32 +0200)] 
wall: always use utmp as fallback

Wall(1) can be compiled with systemd support to read the names of ttys
from the systemd session list. However, this may not work on all systems.
In case of failure, the best option is to use the traditional
utmp method as a fallback.

This commit uses strv (string vector) to collect tty names from both
sources (systemd and utmp) and then sends a message to all ttys.

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2283049
Signed-off-by: Karel Zak <kzak@redhat.com>
14 months agotests: add dump from ARM with A510+A710+A715+X3
Karel Zak [Thu, 30 May 2024 12:26:43 +0000 (14:26 +0200)] 
tests: add dump from ARM with A510+A710+A715+X3

Signed-off-by: Karel Zak <kzak@redhat.com>
14 months agotests: update lscpu vmware_fpe output
Karel Zak [Thu, 30 May 2024 12:11:38 +0000 (14:11 +0200)] 
tests: update lscpu vmware_fpe output

The cpuinfo for vmware_fpe defines two types of CPUs, which differ in
their flags.  However, this difference is ignored by lscpu. The latest
version now uses the flags that were defined later.

Signed-off-by: Karel Zak <kzak@redhat.com>
14 months agolscpu: use CPU types de-duplication
Karel Zak [Thu, 30 May 2024 11:59:16 +0000 (13:59 +0200)] 
lscpu: use CPU types de-duplication

The new CPU type was always allocated when a new relevant value for
the type was found in the cpuinfo file. However, this solution is
fragile because it can result in the parser creating a cputype struct
with incomplete information.

For instance, on ARM systems with multiple CPU types, a new CPU type
would be triggered by a different "CPU part ID". In cases where the
vendor remained the same, a new type would be created later but the
vendor would not be initialized.

The new implementation creates a new CPU type for each CPU (almost)
and then later de-duplicates the array based on vendor, model, etc.

Addresses: https://github.com/util-linux/util-linux/issues/3062
Signed-off-by: Karel Zak <kzak@redhat.com>
14 months agolscpu: New Arm Cortex part numbers
Jeremy Linton [Wed, 29 May 2024 16:04:38 +0000 (11:04 -0500)] 
lscpu: New Arm Cortex part numbers

Arm has announced the Cortex-X925 and published the TRM here:
https://developer.arm.com/documentation/102807/0001/?lang=en

As well as the Cortex-A725 with a TRM here:
https://developer.arm.com/documentation/107652/0001/?lang=en

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
14 months agoMerge branch 'PR/libmount-exec-errors' of github.com:karelzak/util-linux-work
Karel Zak [Tue, 28 May 2024 10:43:00 +0000 (12:43 +0200)] 
Merge branch 'PR/libmount-exec-errors' of github.com:karelzak/util-linux-work

* 'PR/libmount-exec-errors' of github.com:karelzak/util-linux-work:
  libmount: expose exec errors

14 months agoMerge branch 'scriptreplay/add-interactive-playback/2999' of https://github.com/jNull...
Karel Zak [Tue, 28 May 2024 10:32:49 +0000 (12:32 +0200)] 
Merge branch 'scriptreplay/add-interactive-playback/2999' of https://github.com/jNullj/util-linux

* 'scriptreplay/add-interactive-playback/2999' of https://github.com/jNullj/util-linux:
  format: fix switch case indent
  fix clang compile
  replace fgetwc with fgetc
  format: fix comments and if braces format
  format: CamelCase to SnakeCase
  Refactor convoluted switch case into if else
  fix formatting and add mising break
  Add missing author
  Add interactive playback docs
  Add right arrow key to step forward in playback
  Remove uneeded veriable
  Add support for adjusting replay speed with arrow keys
  Refactor to handle responsive input
  Add pause functionality to replay
  Refactor delay_for function signature to use const struct timeval
  Set stdin to nonblock

14 months agolibmount: expose exec errors
Karel Zak [Mon, 27 May 2024 12:04:31 +0000 (14:04 +0200)] 
libmount: expose exec errors

* Introduce special exit status 126 to inform about failed execl of
  the /sbin/[u]mount.<type> helpers.

* Introduce MNT_ERR_EXEC as an API return code to inform about failed
  execl() calls.

* Add mount and umount messages for failed execl() calls.

* Add EXIT STATUS section to umount man page.

Addresses: https://github.com/util-linux/util-linux/pull/3063
Signed-off-by: Karel Zak <kzak@redhat.com>
14 months agoformat: fix switch case indent
jNullj [Mon, 27 May 2024 16:21:48 +0000 (19:21 +0300)] 
format: fix switch case indent

Linux kernel coding style prefers switch and case at the same indent level.

14 months agofix clang compile
jNullj [Mon, 27 May 2024 16:18:15 +0000 (19:18 +0300)] 
fix clang compile

This commit fix clang compile issue.
Replace local char veriables with generic ch already used by the in function.
Reduce memory usage.

14 months agoMerge branch 'fix-unnecessary-remake' of https://github.com/ChenQi1989/util-linux
Karel Zak [Mon, 27 May 2024 09:51:46 +0000 (11:51 +0200)] 
Merge branch 'fix-unnecessary-remake' of https://github.com/ChenQi1989/util-linux

* 'fix-unnecessary-remake' of https://github.com/ChenQi1989/util-linux:
  libsmartcols/src/Makemodule.am: ensure filter-scanner/paser.c file is newer than the .h file

14 months agoMerge branch 'PR/cal-fix-weeknumber-colors' of github.com:karelzak/util-linux-work
Karel Zak [Mon, 27 May 2024 09:48:49 +0000 (11:48 +0200)] 
Merge branch 'PR/cal-fix-weeknumber-colors' of github.com:karelzak/util-linux-work

* 'PR/cal-fix-weeknumber-colors' of github.com:karelzak/util-linux-work:
  tests: add color schema to cal(1) tests
  cal: colorize --vertical output.
  cal: properly colorize the week number in vertical output.
  cal: fix --week use and colors

14 months agoMerge branch 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work
Karel Zak [Mon, 27 May 2024 09:48:13 +0000 (11:48 +0200)] 
Merge branch 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work

* 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work:
  libmount: (loop) detect and report lost loop nodes
  libmount: add mnt_context_sprintf_errmsg()
  libmount: add functions to use error buffer
  libmount: use regular function to save/reset syscalls status

14 months agolibsmartcols/src/Makemodule.am: ensure filter-scanner/paser.c file is newer than...
Chen Qi [Sat, 25 May 2024 03:41:35 +0000 (11:41 +0800)] 
libsmartcols/src/Makemodule.am: ensure filter-scanner/paser.c file is newer than the .h file

In released tarball, for filter-scanner/parser, the .h and the .c
file has the same mtime. The 'make' tool thinks .h is newer than
the .c file, thus deciding to remake it. This will not only cause
unnecessary rebuild, but also parallel make error. For example,
after 'make', when running 'make install', the libmount.la and findmnt
are both rebuilt and findmnt building will somethings error out complaining
'libmount.so: no such file or directory' or 'libmount.so: file format
not recognized'.

Touch the generated .c file to ensure it's newer than the .h file.
In this way, in new released tarballs in the future, there will
be no unnecessary remake.

fixes util-linux/util-linux#3061

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>