]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
7 weeks agoMerge branch 'lsns--Q' of https://github.com/masatake/util-linux
Karel Zak [Tue, 2 Apr 2024 10:58:02 +0000 (12:58 +0200)] 
Merge branch 'lsns--Q' of https://github.com/masatake/util-linux

* 'lsns--Q' of https://github.com/masatake/util-linux:
  tests: (lsns) add a case testing -Q, --filter option
  tests: (test_mkfds::userns) add a new factory
  tests: (test_mkfds::multiplexing) fix the factory description
  lsns: add -H, --list-columns option
  lsns: implement -Q, --filter option
  lsfd: (man) fix the decoration of an optional parameter
  lsns: add a missing '=' character in the help message
  lsns: (man) make the namespace parameter optional
  lsblk: (refactor) refer to a parameter instead of a file static var

7 weeks agoMerge branch 'meson-fix-crypt-dep' of https://github.com/jwillikers/util-linux
Karel Zak [Tue, 2 Apr 2024 06:49:48 +0000 (08:49 +0200)] 
Merge branch 'meson-fix-crypt-dep' of https://github.com/jwillikers/util-linux

* 'meson-fix-crypt-dep' of https://github.com/jwillikers/util-linux:
  meson: Only require the crypt library when necessary

7 weeks agoMerge branch 'meson-detect-mempcpy' of https://github.com/jwillikers/util-linux
Karel Zak [Tue, 2 Apr 2024 06:47:34 +0000 (08:47 +0200)] 
Merge branch 'meson-detect-mempcpy' of https://github.com/jwillikers/util-linux

* 'meson-detect-mempcpy' of https://github.com/jwillikers/util-linux:
  meson: Fix false positive detection of mempcpy on macOS

7 weeks agopam_lastlog2: link against liblastlog
Thomas Weißschuh [Mon, 1 Apr 2024 20:53:32 +0000 (22:53 +0200)] 
pam_lastlog2: link against liblastlog

While at it also drop the duplicated include path.

Fixes #2897
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
7 weeks agomeson: Fix false positive detection of mempcpy on macOS
Jordan Williams [Fri, 29 Mar 2024 19:00:01 +0000 (14:00 -0500)] 
meson: Fix false positive detection of mempcpy on macOS

The has_function check incorrectly detects mempcpy on macOS.
This function is not available on macOS and should not be detected.
Likely, this has to do with Meson's detection of compiler built-ins.
Using a specific prefix and defining _GNU_SOURCE fixes the detection.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
7 weeks agoMerge branch 'meson-fix-def-environ' of https://github.com/jwillikers/util-linux
Karel Zak [Mon, 1 Apr 2024 10:25:36 +0000 (12:25 +0200)] 
Merge branch 'meson-fix-def-environ' of https://github.com/jwillikers/util-linux

* 'meson-fix-def-environ' of https://github.com/jwillikers/util-linux:
  meson: Don't define HAVE_ENVIRON_DECL when environ is unavailable

7 weeks agoMerge branch 'dist/meson' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 1 Apr 2024 10:21:36 +0000 (12:21 +0200)] 
Merge branch 'dist/meson' of https://github.com/t-8ch/util-linux

* 'dist/meson' of https://github.com/t-8ch/util-linux:
  autotools: distribute pam_lastlog2/meson.build

7 weeks agoMerge branch 'meson/generate-cargs' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 1 Apr 2024 10:20:09 +0000 (12:20 +0200)] 
Merge branch 'meson/generate-cargs' of https://github.com/t-8ch/util-linux

* 'meson/generate-cargs' of https://github.com/t-8ch/util-linux:
  meson: respect c_args/CFLAGS when generating syscalls/errnos

7 weeks agoMerge branch 'blkid/csum-log' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 1 Apr 2024 10:19:10 +0000 (12:19 +0200)] 
Merge branch 'blkid/csum-log' of https://github.com/t-8ch/util-linux

* 'blkid/csum-log' of https://github.com/t-8ch/util-linux:
  libblkid: use correct logging prefix for checksum mismatch

7 weeks agolibblkid: Fix segfault when blkid.conf doesn't exist
Karel Zak [Mon, 1 Apr 2024 10:14:50 +0000 (12:14 +0200)] 
libblkid: Fix segfault when blkid.conf doesn't exist

* Move 'line' and 'uevent' to the beginning of the LIBECONF code.
* Remove unwanted space between function name and arguments.
* Check for 'line' pointer before dereferencing.

References: https://github.com/util-linux/util-linux/pull/2883
Signed-off-by: Karel Zak <kzak@redhat.com>
7 weeks agoMerge branch 'fix/libuuid/doc' of https://github.com/CismonX/util-linux
Karel Zak [Mon, 1 Apr 2024 10:06:12 +0000 (12:06 +0200)] 
Merge branch 'fix/libuuid/doc' of https://github.com/CismonX/util-linux

* 'fix/libuuid/doc' of https://github.com/CismonX/util-linux:
  libuuid: (man) fix function declarations

7 weeks agodocs: add COPYING.MIT
Karel Zak [Mon, 1 Apr 2024 10:04:47 +0000 (12:04 +0200)] 
docs: add COPYING.MIT

Signed-off-by: Karel Zak <kzak@redhat.com>
7 weeks agoMerge branch 'master' of https://github.com/rpurdie/util-linux
Karel Zak [Mon, 1 Apr 2024 10:02:42 +0000 (12:02 +0200)] 
Merge branch 'master' of https://github.com/rpurdie/util-linux

* 'master' of https://github.com/rpurdie/util-linux:
  README.licensing/flock: Add MIT license mention

7 weeks agowall: fix escape sequence Injection [CVE-2024-28085]
Karel Zak [Thu, 21 Mar 2024 10:16:20 +0000 (11:16 +0100)] 
wall: fix escape sequence Injection [CVE-2024-28085]

Let's use for all cases the same output function.

Reported-by: Skyler Ferrante <sjf5462@rit.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 404b0781f52f7c045ca811b2dceec526408ac253)

7 weeks agoautotools: distribute pam_lastlog2/meson.build
Thomas Weißschuh [Sat, 30 Mar 2024 16:46:19 +0000 (17:46 +0100)] 
autotools: distribute pam_lastlog2/meson.build

Otherwise building the dist tarball via meson doesn't work.

Fixes #2875
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
7 weeks agomeson: respect c_args/CFLAGS when generating syscalls/errnos
Thomas Weißschuh [Sat, 30 Mar 2024 16:29:18 +0000 (17:29 +0100)] 
meson: respect c_args/CFLAGS when generating syscalls/errnos

Fixes #2891

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
7 weeks agolibblkid: use correct logging prefix for checksum mismatch
Thomas Weißschuh [Sat, 30 Mar 2024 11:48:10 +0000 (12:48 +0100)] 
libblkid: use correct logging prefix for checksum mismatch

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
7 weeks agomeson: Don't define HAVE_ENVIRON_DECL when environ is unavailable
Jordan Williams [Fri, 29 Mar 2024 21:56:43 +0000 (16:56 -0500)] 
meson: Don't define HAVE_ENVIRON_DECL when environ is unavailable

HAVE_ENVIRON_DECL is being defined to 0 by cfg_data.set10().
The code only checks whether or not is defined.
This leads to it not being declared appropriately.
Use cfg_data.set() instead of cfg_data.set10() to define it when true.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
7 weeks agomeson: Only require the crypt library when necessary
Jordan Williams [Fri, 29 Mar 2024 15:31:27 +0000 (10:31 -0500)] 
meson: Only require the crypt library when necessary

The `crypt` library is only necessary for two executables.
These are build-newgrp and build-sulogin.
Don't otherwise require this dependency.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
7 weeks agolibuuid: (man) fix function declarations
CismonX [Thu, 28 Mar 2024 23:26:35 +0000 (07:26 +0800)] 
libuuid: (man) fix function declarations

7 weeks agoREADME.licensing/flock: Add MIT license mention
Richard Purdie [Thu, 28 Mar 2024 12:16:57 +0000 (12:16 +0000)] 
README.licensing/flock: Add MIT license mention

Looking at the license text, flock.c is under the MIT license (see
https://spdx.org/licenses/MIT).

Add an SPDX license identifier header and add to the list of licenses the
source so everything is correctly listed/identified.

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
8 weeks agoMerge branch 'libmount' of https://github.com/thkukuk/util-linux
Karel Zak [Wed, 27 Mar 2024 10:53:02 +0000 (11:53 +0100)] 
Merge branch 'libmount' of https://github.com/thkukuk/util-linux

* 'libmount' of https://github.com/thkukuk/util-linux:
  libmount: don't initialize variable twice (#2714)

8 weeks agoMerge branch 'PR/ipcs-fix-counters' of github.com:karelzak/util-linux-work
Karel Zak [Wed, 27 Mar 2024 10:51:04 +0000 (11:51 +0100)] 
Merge branch 'PR/ipcs-fix-counters' of github.com:karelzak/util-linux-work

* 'PR/ipcs-fix-counters' of github.com:karelzak/util-linux-work:
  lsipc: improve variable naming
  lsipc: fix semaphore USED counter

8 weeks agoMerge branch 'blkid/json' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 27 Mar 2024 10:46:01 +0000 (11:46 +0100)] 
Merge branch 'blkid/json' of https://github.com/t-8ch/util-linux

* 'blkid/json' of https://github.com/t-8ch/util-linux:
  blkid: add json output format
  blkid: (tests) test output formats
  blkid: (tests) use correct blkid binary

8 weeks agotests: (lsns) add a case testing -Q, --filter option
Masatake YAMATO [Fri, 8 Mar 2024 01:57:15 +0000 (10:57 +0900)] 
tests: (lsns) add a case testing -Q, --filter option

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
8 weeks agoautotools: add dependence on libsmartcols for lsclocks
Karel Zak [Tue, 26 Mar 2024 15:17:29 +0000 (16:17 +0100)] 
autotools: add dependence on libsmartcols for lsclocks

Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 272c3639d7bdb5f455717d8ce7cd9638419754b6)

8 weeks agotests: (test_mkfds::userns) add a new factory
Masatake YAMATO [Fri, 8 Mar 2024 01:27:08 +0000 (10:27 +0900)] 
tests: (test_mkfds::userns) add a new factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
8 weeks agotests: (test_mkfds::multiplexing) fix the factory description
Masatake YAMATO [Thu, 7 Mar 2024 22:38:35 +0000 (07:38 +0900)] 
tests: (test_mkfds::multiplexing) fix the factory description

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
8 weeks agolsns: add -H, --list-columns option
Masatake YAMATO [Thu, 7 Mar 2024 20:42:34 +0000 (05:42 +0900)] 
lsns: add -H, --list-columns option

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
8 weeks agolsns: implement -Q, --filter option
Masatake YAMATO [Fri, 1 Mar 2024 01:07:10 +0000 (10:07 +0900)] 
lsns: implement -Q, --filter option

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
8 weeks agolsfd: (man) fix the decoration of an optional parameter
Masatake YAMATO [Thu, 7 Mar 2024 21:01:08 +0000 (06:01 +0900)] 
lsfd: (man) fix the decoration of an optional parameter

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
8 weeks agolsns: add a missing '=' character in the help message
Masatake YAMATO [Thu, 7 Mar 2024 13:34:32 +0000 (22:34 +0900)] 
lsns: add a missing '=' character in the help message

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
8 weeks agolsns: (man) make the namespace parameter optional
Masatake YAMATO [Thu, 7 Mar 2024 20:57:19 +0000 (05:57 +0900)] 
lsns: (man) make the namespace parameter optional

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
8 weeks agolsblk: (refactor) refer to a parameter instead of a file static var
Masatake YAMATO [Fri, 1 Mar 2024 01:07:24 +0000 (10:07 +0900)] 
lsblk: (refactor) refer to a parameter instead of a file static var

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
8 weeks agolibmount: don't initialize variable twice (#2714)
Thorsten Kukuk [Tue, 26 Mar 2024 13:00:57 +0000 (14:00 +0100)] 
libmount: don't initialize variable twice (#2714)

Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
8 weeks agoMerge branch 'more' of https://github.com/thkukuk/util-linux
Karel Zak [Tue, 26 Mar 2024 12:11:06 +0000 (13:11 +0100)] 
Merge branch 'more' of https://github.com/thkukuk/util-linux

* 'more' of https://github.com/thkukuk/util-linux:
  more: remove second check for EOF (#2714)

8 weeks agoMerge branch 'uuidgen' of https://github.com/thkukuk/util-linux
Karel Zak [Tue, 26 Mar 2024 12:10:52 +0000 (13:10 +0100)] 
Merge branch 'uuidgen' of https://github.com/thkukuk/util-linux

* 'uuidgen' of https://github.com/thkukuk/util-linux:
  uuidgen: use xmalloc instead of malloc (#2714)

8 weeks agoMerge branch 'lscpu' of https://github.com/thkukuk/util-linux
Karel Zak [Tue, 26 Mar 2024 12:10:39 +0000 (13:10 +0100)] 
Merge branch 'lscpu' of https://github.com/thkukuk/util-linux

* 'lscpu' of https://github.com/thkukuk/util-linux:
  lscpu: initialize all variables (#2714)

8 weeks agolsipc: improve variable naming
Karel Zak [Tue, 26 Mar 2024 11:56:50 +0000 (12:56 +0100)] 
lsipc: improve variable naming

* Life is too short to use long variable names
* Reduce the possibility of making typos between "xyz" and "xyzp"

Signed-off-by: Karel Zak <kzak@redhat.com>
8 weeks agolsipc: fix semaphore USED counter
Karel Zak [Tue, 26 Mar 2024 11:45:24 +0000 (12:45 +0100)] 
lsipc: fix semaphore USED counter

The code incorrectly counts only with the first item in the linked
list (due to a typo). It seems rather fragile to use "semds" and
"semdsp" as variable names in the same code ...

 # lsipc -gs

Old:

 KEY ID PERMS OWNER NSEMS RESOURCE DESCRIPTION                                LIMIT USED  USE%
                          SEMMNI   Number of semaphore identifiers            32000    3 0.01%
                          SEMMNS   Total number of semaphores            1024000000  369 0.00%
                          SEMMSL   Max semaphores per semaphore set.          32000    -     -
                          SEMOPM   Max number of operations per semop(2)        500    -     -
                          SEMVMX   Semaphore max value                        32767    -     -

Fixed:

 KEY ID PERMS OWNER NSEMS RESOURCE DESCRIPTION                                LIMIT USED  USE%
                          SEMMNI   Number of semaphore identifiers            32000    3 0.01%
                          SEMMNS   Total number of semaphores            1024000000  156 0.00%
                          SEMMSL   Max semaphores per semaphore set.          32000    -     -
                          SEMOPM   Max number of operations per semop(2)        500    -     -
                          SEMVMX   Semaphore max value                        32767    -     -

Addresses: https://issues.redhat.com/browse/RHEL-30269
Signed-off-by: Karel Zak <kzak@redhat.com>
8 weeks agomore: remove second check for EOF (#2714)
Thorsten Kukuk [Tue, 26 Mar 2024 09:50:30 +0000 (10:50 +0100)] 
more: remove second check for EOF (#2714)

The second EOF check (c == EOF) will never be reached.

Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
8 weeks agouuidgen: use xmalloc instead of malloc (#2714)
Thorsten Kukuk [Tue, 26 Mar 2024 08:49:22 +0000 (09:49 +0100)] 
uuidgen: use xmalloc instead of malloc (#2714)

Use xmalloc to make sure we don't reference a NULL pointer in error
case.

Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
8 weeks agolscpu: initialize all variables (#2714)
Thorsten Kukuk [Tue, 26 Mar 2024 08:33:32 +0000 (09:33 +0100)] 
lscpu: initialize all variables (#2714)

cpu->bookid got initialized twice instead of drawerid

Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
8 weeks agorev: Check for wchar conversion errors
Tim Hallmann [Sun, 24 Mar 2024 19:14:30 +0000 (20:14 +0100)] 
rev: Check for wchar conversion errors

Commit c9cc84621ca98ef85499e83ca56f05f12055f193 introduced a regression
where only the actual EOF is handled, not other error conditions
returning WEOF. This leads to an infinite loop upon encountering
conversion errors. For example (using LC_CTYPE="en_US.UTF-8"):

$ printf '\x80' | rev

Signed-off-by: Tim Hallmann <tim@t8w.de>
8 weeks agoMerge branch 'clang-18' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 25 Mar 2024 09:03:58 +0000 (10:03 +0100)] 
Merge branch 'clang-18' of https://github.com/t-8ch/util-linux

* 'clang-18' of https://github.com/t-8ch/util-linux:
  ci: use clang 18
  lscpu: restructure op-mode printing

8 weeks agosys-utils: hwclock-rtc: fix pointer usage
Karthikeyan Krishnasamy [Sat, 23 Mar 2024 08:09:55 +0000 (13:39 +0530)] 
sys-utils: hwclock-rtc: fix pointer usage

passing double pointer doesn't fill param value

Signed-off-by: Karthikeyan Krishnasamy <karthikeyan@linumiz.com>
2 months agoMerge branch 'PR/libmount-sepnodata' of github.com:karelzak/util-linux-work
Karel Zak [Fri, 22 Mar 2024 10:33:32 +0000 (11:33 +0100)] 
Merge branch 'PR/libmount-sepnodata' of github.com:karelzak/util-linux-work

* 'PR/libmount-sepnodata' of github.com:karelzak/util-linux-work:
  libmount: make sure "option=" is used as string

2 months agomeson: Only build blkzone and blkpr if the required linux header exists
Jordan Williams [Wed, 20 Mar 2024 16:41:49 +0000 (11:41 -0500)] 
meson: Only build blkzone and blkpr if the required linux header exists

Checks for the required headers for blkzone and blkptr are done for
 Autotools.
This logic wasn't carried over to Meson.
This PR just adds the same checks.

Fixes #2850.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 months agolibmount: make sure "option=" is used as string
Karel Zak [Wed, 20 Mar 2024 15:08:16 +0000 (16:08 +0100)] 
libmount: make sure "option=" is used as string

mount(8) cares about case when option specified as "name=" (it means
without data). See for example 727c689908c5e68c92aa1dd65e0d3bdb6d91c1e5.

We need this also for new mount API and use FSCONFIG_SET_STRING rather
than FSCONFIG_SET_FLAG.

strace -e fsconfig ./mount -o usrjquota= /dev/sdc1 /mnt/test

Old:
fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sdc1", 0) = 0
fsconfig(3, FSCONFIG_SET_FLAG, "usrjquota", NULL, 0) = -1 EINVAL (Invalid argument)

Fixed:
fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sdc1", 0) = 0
fsconfig(3, FSCONFIG_SET_STRING, "usrjquota", "", 0) = 0

Fixes: https://github.com/util-linux/util-linux/issues/2837
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agochcpu(8): document limitations of -g
Stanislav Brabec [Mon, 18 Mar 2024 17:39:36 +0000 (18:39 +0100)] 
chcpu(8): document limitations of -g

Document that chcpu -g is not supported on IBM z/VM because the detach cpu
would CLEAR the running zVM guest memory.

References:
https://www.ibm.com/docs/en/linux-on-z?topic=mc-changing-state-1
https://www.ibm.com/docs/en/zvm/7.3?topic=commands-detach-cpu

Reported-by: Heikki Ylipiessa <heikki.ylipiessa@suse.com>
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2 months agolib/sha1: fix for old glibc
Karel Zak [Wed, 20 Mar 2024 14:03:05 +0000 (15:03 +0100)] 
lib/sha1: fix for old glibc

Fixes: https://github.com/util-linux/util-linux/issues/2830
References: http://github.com/util-linux/util-linux/commit/a8902e4cdd6149e5124383b25db8688dcdacd790
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agolscpu: don't use NULL sharedmap
Karel Zak [Wed, 20 Mar 2024 13:42:28 +0000 (14:42 +0100)] 
lscpu: don't use NULL sharedmap

Fixes: https://github.com/util-linux/util-linux/issues/2846
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoci: reduce aslr level to avoid issues with ASAN
Thomas Weißschuh [Tue, 19 Mar 2024 21:21:54 +0000 (22:21 +0100)] 
ci: reduce aslr level to avoid issues with ASAN

As we have multiple different configurations using ASAN just disable it
for all of them.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agolast: avoid out of bounds array access
biubiuzy [Fri, 23 Feb 2024 09:44:12 +0000 (17:44 +0800)] 
last: avoid out of bounds array access

2 months agofindmnt: remove deleted option from manual
Chris Hofstaedtler [Fri, 15 Mar 2024 16:54:17 +0000 (17:54 +0100)] 
findmnt: remove deleted option from manual

Bug-Debian: 1066843
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
Reported-by: Francesco Potortì <Potorti@isti.cnr.it>
2 months agolib/pty-session: Don't ignore SIGHUP.
Kuniyuki Iwashima [Mon, 11 Mar 2024 18:12:02 +0000 (18:12 +0000)] 
lib/pty-session: Don't ignore SIGHUP.

The blamed commit converted script to use the generic pty code that
was added by commit 6954895cae34 ("lib/pty-session: add generic PTY
container code").

Commit ec10634e7ec4 says the new pty stuff is based on script.
However, there is difference in signal handling.

Before the commit, only the signals that the script was interested
in were blocked and handled by signalfd.

After the commit, all signals are blocked and only the interested
signals are handled.

This causes regression in the following scenario:

  1. run `script` via /etc/profile.d for ssh session
  2. login to a ssh session using bash
  3. run `sudo -i`
  4. wait until ssh session timeout

After 3., the process tree will be like this.

  $ pstree -p | grep script
  |-sshd(2652)-sshd(637993)---sshd(637996)---bash(637997)---script(638028)---bash(638029)---sudo(638057)---sudo(638059)-+

The notable thing here is that script is in the parent's process
group (637997).

  $ ps -eo pid,pgid,ppid,stat,sig,comm | grep script
  638028  637997  637997 S+   0000000000000000 script

Thus, the parent bash will send SIGHUP to script, when the timeout
occurs at 4.

  $ sudo /usr/share/bcc/tools/killsnoop
  TIME      PID      COMM             SIG  TPID     RESULT
  18:46:57  637997   bash             1    637997   0

  $ ps -eo pid,pgid,ppid,stat,sig,comm | grep script
  638028  637997       1 S    0000000000020001 script

However, this is not handled, so the script is reaped but remains
forever.

  $ pstree -p | grep script
  |-script(638028)---bash(638029)

To avoid such a situation, we need to handle SIGHUP in script.

With this patch, script will receive SIGHUP from the parrent and
kill its child processes.

  $ pstree -p | grep script
  |-sshd(2652)-sshd(638400)---sshd(638404)---bash(638405)---script(638436)---bash(638437)---sudo(638465)---sudo(638467)-+

  $ sudo /usr/share/bcc/tools/killsnoop
  TIME      PID      COMM             SIG  TPID     RESULT
  18:50:11  638405   bash             1    638405   0
  18:50:11  638436   script           15   638437   0
  18:50:11  638436   script           15   638437   0
  18:50:13  638436   script           9    638437   0

Fixes: ec10634e7ec4 ("script: use lib/pty-session")
Reported-by: Ayame Suzuki <ayameszk@amazon.co.jp>
Signed-off-by: Kuniyuki Iwashima <kuniyu@amazon.com>
2 months agodmesg: print object closing brace while waiting for next message
Thomas Weißschuh [Sun, 10 Mar 2024 09:43:20 +0000 (10:43 +0100)] 
dmesg: print object closing brace while waiting for next message

Allow incremental parsers to process the full object as it is written by
dmesg.

Closes #2833

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agojsonwrt: add ul_jsonwrt_flush
Thomas Weißschuh [Sun, 10 Mar 2024 06:17:25 +0000 (07:17 +0100)] 
jsonwrt: add ul_jsonwrt_flush

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agoci: use clang 18
Thomas Weißschuh [Tue, 19 Mar 2024 21:25:29 +0000 (22:25 +0100)] 
ci: use clang 18

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agolscpu: restructure op-mode printing
Thomas Weißschuh [Tue, 19 Mar 2024 21:49:31 +0000 (22:49 +0100)] 
lscpu: restructure op-mode printing

The existing logic can confuse ASAN.
Restructure it so it is shorter and easer to understand for humans.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agolibmount: Fix export of mnt_context_is_lazy and mnt_context_is_onlyonce
Matt Turner [Tue, 19 Mar 2024 01:29:13 +0000 (21:29 -0400)] 
libmount: Fix export of mnt_context_is_lazy and mnt_context_is_onlyonce

[kzak@redhat.com: - fix also function docs]

Bug: https://bugs.gentoo.org/927258
Closes: https://github.com/util-linux/util-linux/issues/2844
Fixes: 3d1c41c8c ("libmount: add --onlyonce")
Signed-off-by: Matt Turner <mattst88@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoblkid: add json output format
Thomas Weißschuh [Wed, 6 Mar 2024 16:36:52 +0000 (17:36 +0100)] 
blkid: add json output format

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
2 months agoblkid: (tests) test output formats
Thomas Weißschuh [Wed, 6 Mar 2024 16:36:47 +0000 (17:36 +0100)] 
blkid: (tests) test output formats

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
2 months agoblkid: (tests) use correct blkid binary
Thomas Weißschuh [Wed, 6 Mar 2024 16:36:41 +0000 (17:36 +0100)] 
blkid: (tests) use correct blkid binary

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
2 months agoMerge branch 'blockdev' of https://github.com/EvgeniyRogov/util-linux
Karel Zak [Tue, 5 Mar 2024 09:14:08 +0000 (10:14 +0100)] 
Merge branch 'blockdev' of https://github.com/EvgeniyRogov/util-linux

* 'blockdev' of https://github.com/EvgeniyRogov/util-linux:
  - Fixed report error code in blockdev. - Minor: Added a period at the end of "--rereadpt" description.

2 months agosu: fix use after free in run_shell
Tanish Yadav [Mon, 4 Mar 2024 19:21:41 +0000 (00:51 +0530)] 
su: fix use after free in run_shell

Do not free tmp for non login branch as basename may return a pointer to
some part of it.

[kzak@redhat.com: - improve coding style of the function]

Signed-off-by: Tanish Yadav <devtany@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months ago- Fixed report error code in blockdev.
EvgeniyRogov [Fri, 1 Mar 2024 11:13:11 +0000 (14:13 +0300)] 
- Fixed report error code in blockdev.
- Minor: Added a period at the end of "--rereadpt" description.

2 months agosu, agetty: don't use program_invocation_short_name for openlog()
Karel Zak [Mon, 4 Mar 2024 12:30:10 +0000 (13:30 +0100)] 
su, agetty: don't use program_invocation_short_name for openlog()

Make sure the program name is hardcoded when write to the log.

Reported-by: "Serge E. Hallyn" <serge@hallyn.com>
Reported-by: "Skyler Ferrante (RIT Student)" <sjf5462@rit.edu>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'spelling' of https://github.com/jwilk-forks/util-linux
Karel Zak [Mon, 4 Mar 2024 11:53:42 +0000 (12:53 +0100)] 
Merge branch 'spelling' of https://github.com/jwilk-forks/util-linux

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

2 months agoMerge branch 'lsfd--github-issue-2819' of https://github.com/masatake/util-linux
Karel Zak [Mon, 4 Mar 2024 11:38:35 +0000 (12:38 +0100)] 
Merge branch 'lsfd--github-issue-2819' of https://github.com/masatake/util-linux

* 'lsfd--github-issue-2819' of https://github.com/masatake/util-linux:
  tests: (lsfd::mkfds-inotify) consider environments not having / as a mount point

2 months agobuild-sys: make sure everywhere is localstatedir
Karel Zak [Mon, 4 Mar 2024 11:35:09 +0000 (12:35 +0100)] 
build-sys: make sure everywhere is localstatedir

_PATH_LOCALSTATEDIR and @localstatedir@ are defined by build-systems
and it's necessary to use it everywhere to keep things consistent.

Reference: https://github.com/util-linux/util-linux/pull/2825
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agotests: (lsfd::mkfds-inotify) consider environments not having / as a mount point
Masatake YAMATO [Sat, 2 Mar 2024 21:51:15 +0000 (06:51 +0900)] 
tests: (lsfd::mkfds-inotify) consider environments not having / as a mount point

Close #2819.

In the original test case, test_mkfds monitored / and /etc/fstab.

As reported in #2819, if a test platform doesn't have / as a
mount point, the test case doesn't work.

So we use /proc and /proc/cmdnline instead.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
Acked-by: Chris Hofstaedtler <zeha@debian.org>
2 months agodocs: fix typos
Jakub Wilk [Fri, 1 Mar 2024 09:33:46 +0000 (10:33 +0100)] 
docs: fix typos

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2 months agodocs: add note about stable branches
Karel Zak [Thu, 29 Feb 2024 22:00:10 +0000 (23:00 +0100)] 
docs: add note about stable branches

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agolslocks: fix buffer overflow
Karel Zak [Thu, 29 Feb 2024 19:43:35 +0000 (20:43 +0100)] 
lslocks: fix buffer overflow

* don't use memset() to init variables
* use xreaddir() to reduce code
* use ssize_t for readlinkat() return value to avoid buffer overflow

Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit f030775ffeaa8627c88434f7d0cba1a454aa0ffa)

2 months agosetterm: Document behavior of redirection
Stanislav Brabec [Wed, 28 Feb 2024 14:06:14 +0000 (15:06 +0100)] 
setterm: Document behavior of redirection

Debugging an error of setterm, I realized that setterm --powerdown operates
on stdout but setterm --powersave operates on stdin. Such unexpected
behavior should be documented.

I prefer a less accurate generic "always redirect both stdin and stdout"
over recommending of the correct I/O stream for each option separately.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
2 months agomeson: fix LIBBLKID_VERSION definition
Karel Zak [Thu, 29 Feb 2024 10:09:11 +0000 (11:09 +0100)] 
meson: fix LIBBLKID_VERSION definition

Fixes: https://github.com/util-linux/util-linux/issues/2802
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'lsfd--btrfs' of https://github.com/masatake/util-linux
Karel Zak [Thu, 29 Feb 2024 08:50:59 +0000 (09:50 +0100)] 
Merge branch 'lsfd--btrfs' of https://github.com/masatake/util-linux

* 'lsfd--btrfs' of https://github.com/masatake/util-linux:
  tests: (lsfd::mkfds-inotify-btrfs) test INOTIFY.INODES cooked output
  lsfd: extend nodev table to decode "btrfs" on SOURCE column
  lsfd: (refactor) rename a member of struct proc
  lsfd: (refactor) rename a local variable and a parameter
  lsfd: (refactor) split the function processing mountinfo file
  lsfd: (refactor) store a mnt_namespace object to struct process
  lsfd: (refactor) use a binary tree as the implementation for mnt_namespaces
  lsfd: read /proc/$pid/ns/mnt earlier
  lsfd: (refactor) rename add_nodevs to read_mountinfo
  lsfd: make the way to read /proc/$pid/mountinfo robust
  lsfd: (cosmetic) normalize whitespaces

2 months agobuild-sys: introduce localstatedir
Karel Zak [Wed, 28 Feb 2024 12:07:39 +0000 (13:07 +0100)] 
build-sys: introduce localstatedir

The directory is already used by ./configure.ac, but it has never been
exported to the Makefile.am or used by meson.

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Christian Hesse <mail@eworm.de>
2 months agolastlog2: rename tmpfiles
Christian Hesse [Tue, 27 Feb 2024 21:36:13 +0000 (22:36 +0100)] 
lastlog2: rename tmpfiles

Signed-off-by: Christian Hesse <mail@eworm.de>
2 months agotmpfiles: depend on systemd...
Christian Hesse [Thu, 22 Feb 2024 07:50:52 +0000 (08:50 +0100)] 
tmpfiles: depend on systemd...

... as systemd-tmpfiles is required to handle this.

Signed-off-by: Christian Hesse <mail@eworm.de>
2 months agouuidd.rc: create localstatedir in init script
Christian Hesse [Tue, 27 Feb 2024 12:07:30 +0000 (13:07 +0100)] 
uuidd.rc: create localstatedir in init script

Signed-off-by: Christian Hesse <mail@eworm.de>
2 months agotmpfiles: add and install for uuidd, generate /run/uuidd & /var/lib/libuuid
Christian Hesse [Thu, 22 Feb 2024 07:48:55 +0000 (08:48 +0100)] 
tmpfiles: add and install for uuidd, generate /run/uuidd & /var/lib/libuuid

These directories are requird for uuidd, so let systemd-tmpfiles create them.

Signed-off-by: Christian Hesse <mail@eworm.de>
2 months agodocs: move GPL-2.0 license text to Docimentation directory
Karel Zak [Wed, 28 Feb 2024 13:37:25 +0000 (14:37 +0100)] 
docs: move GPL-2.0 license text to Docimentation directory

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agodocs: use proper XSPD identifier for GPL-2.0
Karel Zak [Wed, 28 Feb 2024 12:22:51 +0000 (13:22 +0100)] 
docs: use proper XSPD identifier for GPL-2.0

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'PR/hexdump-overflow' of github.com:karelzak/util-linux-work
Karel Zak [Wed, 28 Feb 2024 11:16:25 +0000 (12:16 +0100)] 
Merge branch 'PR/hexdump-overflow' of github.com:karelzak/util-linux-work

* 'PR/hexdump-overflow' of github.com:karelzak/util-linux-work:
  hexdump: check blocksize when display data

2 months agoMerge branch 'enosys/dump' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 28 Feb 2024 10:49:51 +0000 (11:49 +0100)] 
Merge branch 'enosys/dump' of https://github.com/t-8ch/util-linux

* 'enosys/dump' of https://github.com/t-8ch/util-linux:
  enosys: allow dumping to file
  codeql: don't report world-writable files

2 months agoMerge branch 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work
Karel Zak [Wed, 28 Feb 2024 10:49:37 +0000 (11:49 +0100)] 
Merge branch 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work

* 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work:
  libmount: report kernel message from new API

2 months agoenosys: allow dumping to file
Thomas Weißschuh [Thu, 22 Feb 2024 21:54:41 +0000 (22:54 +0100)] 
enosys: allow dumping to file

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agocodeql: don't report world-writable files
Thomas Weißschuh [Tue, 27 Feb 2024 19:54:33 +0000 (20:54 +0100)] 
codeql: don't report world-writable files

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agohexdump: check blocksize when display data
Karel Zak [Tue, 27 Feb 2024 17:38:02 +0000 (18:38 +0100)] 
hexdump: check blocksize when display data

hexdump(1) stores input to buffer and apply format unit when prints
the output. The unit can move pointer which points to the buffer, but
code does not check for limits.

Fixes: https://github.com/util-linux/util-linux/issues/2806
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'PR/dmesg-2807' of github.com:karelzak/util-linux-work
Karel Zak [Tue, 27 Feb 2024 15:10:22 +0000 (16:10 +0100)] 
Merge branch 'PR/dmesg-2807' of github.com:karelzak/util-linux-work

* 'PR/dmesg-2807' of github.com:karelzak/util-linux-work:
  dmesg: fix wrong size calculation

2 months agolibmount: report kernel message from new API
Karel Zak [Mon, 26 Feb 2024 11:44:10 +0000 (12:44 +0100)] 
libmount: report kernel message from new API

This is a very minimalistic implementation for v2.40 designed to print
error messages from the kernel. It exclusively displays errors, and
the patch does not introduce any new library interface for this
purpose. Instead, it simply replaces hardcoded messages within
libmount with kernel messages.

It's worth noting that the final implementation will necessitate
per-hook error handling in libmount and likely a new library API to
access other types of messages (warnings, notices, etc.).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'patch-1' of https://github.com/ThomasKaiser/util-linux
Karel Zak [Tue, 27 Feb 2024 13:28:48 +0000 (14:28 +0100)] 
Merge branch 'patch-1' of https://github.com/ThomasKaiser/util-linux

* 'patch-1' of https://github.com/ThomasKaiser/util-linux:
  Adding Neoverse-V3/-N3 ARM cores

2 months agomeson: avoid future-deprecated feature
Thomas Weißschuh [Mon, 26 Feb 2024 19:01:45 +0000 (20:01 +0100)] 
meson: avoid future-deprecated feature

Avoid the following message from meson:

  NOTICE: Future-deprecated features used:
   * 1.1.0: {'"boolean option" keyword argument "value" of type str'}

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 months agodmesg: fix wrong size calculation
Karel Zak [Mon, 26 Feb 2024 13:30:55 +0000 (14:30 +0100)] 
dmesg: fix wrong size calculation

* don't use string based function strspn() if work with non-zero terminated
  buffer

* make sure that message size is calculated from within buffer pointers

Fixes: https://github.com/util-linux/util-linux/issues/2807
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoAdding Neoverse-V3/-N3 ARM cores
Thomas Kaiser [Mon, 26 Feb 2024 11:20:11 +0000 (12:20 +0100)] 
Adding Neoverse-V3/-N3 ARM cores

2 months agoMerge branch 'meson/gnu-source' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 26 Feb 2024 08:51:54 +0000 (09:51 +0100)] 
Merge branch 'meson/gnu-source' of https://github.com/t-8ch/util-linux

* 'meson/gnu-source' of https://github.com/t-8ch/util-linux:
  meson: run compiler checks with -D_GNU_SOURCE when necessary

2 months agolibmount: don't hold write fd to mounted device
Jan Kara [Wed, 21 Feb 2024 17:30:50 +0000 (18:30 +0100)] 
libmount: don't hold write fd to mounted device

Avoid holding writeable fd to a loop device that is being mounted. In
the hardened configurations (CONFIG_BLK_DEV_WRITE_MOUNTED = n) the
kernel wants to make sure nobody else has the block device writeably
open when mounting so this makes the mount fail.

Reported-by: JunChao Sun <sunjunchao2870@gmail.com>
Signed-off-by: Jan Kara <jack@suse.cz>
Acked-by: Christian Brauner <brauner@kernel.org>
2 months agotests: (lsfd::mkfds-inotify-btrfs) test INOTIFY.INODES cooked output
Masatake YAMATO [Sat, 24 Feb 2024 17:46:37 +0000 (02:46 +0900)] 
tests: (lsfd::mkfds-inotify-btrfs) test INOTIFY.INODES cooked output

Signed-off-by: Masatake YAMATO <yamato@redhat.com>