]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
5 weeks agoall_errnos/all_syscalls: don't warn during cleanup
Thomas Weißschuh [Tue, 16 Apr 2024 07:14:28 +0000 (09:14 +0200)] 
all_errnos/all_syscalls: don't warn during cleanup

On failure the output files may not have been created.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agoall_errnos/all_syscalls: fail if any step fails
Thomas Weißschuh [Tue, 16 Apr 2024 07:00:41 +0000 (09:00 +0200)] 
all_errnos/all_syscalls: fail if any step fails

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
5 weeks agoaudit-arch.h: add defines for m68k, sh
Chris Hofstaedtler [Tue, 9 Apr 2024 08:34:59 +0000 (10:34 +0200)] 
audit-arch.h: add defines for m68k, sh

John Paul Adrian Glaubitz points out that libseccomp needs to release 2.6.0,
too.

Reviewed-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
6 weeks agolsns: fix ul_path_stat() error handling [coverity scan]
Karel Zak [Tue, 9 Apr 2024 11:45:50 +0000 (13:45 +0200)] 
lsns: fix ul_path_stat() error handling [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
6 weeks agoMerge branch 'logger/fixes' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 9 Apr 2024 10:16:21 +0000 (12:16 +0200)] 
Merge branch 'logger/fixes' of https://github.com/t-8ch/util-linux

* 'logger/fixes' of https://github.com/t-8ch/util-linux:
  logger: correctly format tv_usec
  logger: rework error handling in logger_gettimeofday()
  logger: handle failures of gettimeofday()

6 weeks agoMerge branch 'lsfd--verify-proc-syscall-for-master' of https://github.com/masatake...
Karel Zak [Tue, 9 Apr 2024 10:07:12 +0000 (12:07 +0200)] 
Merge branch 'lsfd--verify-proc-syscall-for-master' of https://github.com/masatake/util-linux

* 'lsfd--verify-proc-syscall-for-master' of https://github.com/masatake/util-linux:
  tests: (lsfd::mkfds-multiplexing) skip if /proc/$pid/syscall is broken

6 weeks agoMerge branch 'missing-pam' of https://github.com/jwillikers/util-linux
Karel Zak [Tue, 9 Apr 2024 10:04:33 +0000 (12:04 +0200)] 
Merge branch 'missing-pam' of https://github.com/jwillikers/util-linux

* 'missing-pam' of https://github.com/jwillikers/util-linux:
  meson: Disable targets requiring pam when it is missing

6 weeks agoMerge branch 'meson-python-embed-dep' of https://github.com/jwillikers/util-linux
Karel Zak [Tue, 9 Apr 2024 10:02:35 +0000 (12:02 +0200)] 
Merge branch 'meson-python-embed-dep' of https://github.com/jwillikers/util-linux

* 'meson-python-embed-dep' of https://github.com/jwillikers/util-linux:
  meson: Require Python dependency which can be embedded for pylibmount

6 weeks agoMerge branch 'sqlite-dep-liblastlog2' of https://github.com/jwillikers/util-linux
Karel Zak [Tue, 9 Apr 2024 10:00:53 +0000 (12:00 +0200)] 
Merge branch 'sqlite-dep-liblastlog2' of https://github.com/jwillikers/util-linux

* 'sqlite-dep-liblastlog2' of https://github.com/jwillikers/util-linux:
  meson: Enforce sqlite dependency for liblastlog2

6 weeks agologger: correctly format tv_usec
Thomas Weißschuh [Tue, 9 Apr 2024 09:00:26 +0000 (11:00 +0200)] 
logger: correctly format tv_usec

tv_usec is an unspecified signed integer type.
The format string %u assumes an unsigned int, which is incorrect.
Especially on 32bit big-endian, where it can lead to invalid values.

Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/util-linux/afef1b770ad80d50660bb2c53a0a8330b88d1049.camel@physik.fu-berlin.de/
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
6 weeks agologger: rework error handling in logger_gettimeofday()
Thomas Weißschuh [Tue, 9 Apr 2024 09:00:08 +0000 (11:00 +0200)] 
logger: rework error handling in logger_gettimeofday()

* Fail when LOGGER_TEST_TIMEOFDAY is set to an invalid value
* Fail with return -1 and errno, the same as normal gettimeofday()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
6 weeks agologger: handle failures of gettimeofday()
Thomas Weißschuh [Tue, 9 Apr 2024 08:58:19 +0000 (10:58 +0200)] 
logger: handle failures of gettimeofday()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
6 weeks agofindmnt: revise the code for -I and -D option
Masatake YAMATO [Fri, 5 Apr 2024 13:40:36 +0000 (22:40 +0900)] 
findmnt: revise the code for -I and -D option

Fixes #2913.

3dd79293b5b655da9d913dedd8facb08959a7826 added -I option.
However, the code used bit flags (FL_DF and FL_DF_INODES) wrongly;
the code broke the output of -D option.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 weeks agotests: (lsfd::mkfds-multiplexing) skip if /proc/$pid/syscall is broken
Masatake YAMATO [Thu, 4 Apr 2024 19:00:45 +0000 (04:00 +0900)] 
tests: (lsfd::mkfds-multiplexing) skip if /proc/$pid/syscall is broken

Close #2867
Close #2887

We should skip the test case on the platforms where /proc/$pid/syscall
doesn't report correct system call number. On such platforms,

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
(cherry picked from commit e199a933058ae052b1dfa2fcb457791f47b60b11)

6 weeks agomeson: Disable targets requiring pam when it is missing
Jordan Williams [Mon, 8 Apr 2024 15:12:17 +0000 (10:12 -0500)] 
meson: Disable targets requiring pam when it is missing

Several executables require the pam library.
The current behavior in Meson only requires this library when these
executables are explicitly enabled.
Unfortunately, by default, Meson will not throw an error when the
required pam library is missing while still trying to build these
executables.
To fix this, make the pam library a disabler which automatically
disables these executables if it is not found.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
6 weeks agomeson: Require Python dependency which can be embedded for pylibmount
Jordan Williams [Mon, 8 Apr 2024 14:33:19 +0000 (09:33 -0500)] 
meson: Require Python dependency which can be embedded for pylibmount

Meson doesn't properly check that the necessary Python.h header file is
available for the pylibmount module.
Passing true for the embed keyword argument for the Python dependency
method ensures that this header file is available.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
6 weeks agomeson: Enforce sqlite dependency for liblastlog2
Jordan Williams [Mon, 8 Apr 2024 13:30:24 +0000 (08:30 -0500)] 
meson: Enforce sqlite dependency for liblastlog2

liblastlog2 requires the sqlite dependency.
Currently, Meson enforces this dependency to be available only when the
build-liblastlog2 feature is explicitly enabled.
liblastlog2 is built by default, so if sqlite is not available, the
build will be configured correctly, but fail to compile.
This commit fixes this case by automatically disabling the
build-liblastlog2 feature when it is auto and sqlite is not found.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
6 weeks agofindfs: (man) be more accurate in describing non-tags
Karel Zak [Mon, 8 Apr 2024 08:19:56 +0000 (10:19 +0200)] 
findfs: (man) be more accurate in describing non-tags

Addresses: https://github.com/util-linux/util-linux/discussions/2914
Signed-off-by: Karel Zak <kzak@redhat.com>
6 weeks agoMerge branch 'spelling' of https://github.com/jwilk-forks/util-linux
Karel Zak [Mon, 8 Apr 2024 07:59:23 +0000 (09:59 +0200)] 
Merge branch 'spelling' of https://github.com/jwilk-forks/util-linux

* 'spelling' of https://github.com/jwilk-forks/util-linux:
  enosys: (man) add missing word

6 weeks agoMerge branch 'test_mkfds-sockdiag-for-master' of https://github.com/masatake/util...
Karel Zak [Mon, 8 Apr 2024 07:55:59 +0000 (09:55 +0200)] 
Merge branch 'test_mkfds-sockdiag-for-master' of https://github.com/masatake/util-linux

* 'test_mkfds-sockdiag-for-master' of https://github.com/masatake/util-linux:
  tests: (test_mkfds::sockdiag) verify the recieved message to detect whether the socket is usable or not
  lsfd: add LSFD_DEBUG env var for debugging
  tests: (lsfd) skip some cases if NETLINK_SOCK_DIAG for AF_UNIX is not available
  tests: (test_mkfds::sockdiag) new factory
  tests: (lsfd-functions.bash,cosmetic) unify the style to define functions
  tests: (lsfd) fix typoes in an error name

6 weeks agoMerge branch 'xry111/pidfs' of https://github.com/xry111/util-linux
Karel Zak [Mon, 8 Apr 2024 07:48:10 +0000 (09:48 +0200)] 
Merge branch 'xry111/pidfs' of https://github.com/xry111/util-linux

* 'xry111/pidfs' of https://github.com/xry111/util-linux:
  lsfd: test: Adapt test cases for pidfs
  lsfd: Support pidfs
  lsfd: Refactor the pidfd logic into lsfd-pidfd.c
  include: Include <unistd.h> in pidfd-utils.h for syscall()

6 weeks agoMerge branch 'meson-make-libmount-optional' of https://github.com/jwillikers/util...
Karel Zak [Mon, 8 Apr 2024 07:43:15 +0000 (09:43 +0200)] 
Merge branch 'meson-make-libmount-optional' of https://github.com/jwillikers/util-linux

* 'meson-make-libmount-optional' of https://github.com/jwillikers/util-linux:
  meson: Only build libmount when required
  meson: Use libblkid as a dependency
  meson: Use libmount as a dependency

6 weeks agoMerge branch 'lsns--opened-ns' of https://github.com/masatake/util-linux
Karel Zak [Mon, 8 Apr 2024 07:41:03 +0000 (09:41 +0200)] 
Merge branch 'lsns--opened-ns' of https://github.com/masatake/util-linux

* 'lsns--opened-ns' of https://github.com/masatake/util-linux:
  lsns: show namespaces only kept alive by open file descriptors
  lsns: (refactor) use ul_new_path and procfs_process_init_path

6 weeks agoenosys: (man) add missing word
Jakub Wilk [Mon, 8 Apr 2024 06:50:39 +0000 (08:50 +0200)] 
enosys: (man) add missing word

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
6 weeks agomeson: use signed chars
Thomas Weißschuh [Sun, 7 Apr 2024 09:15:29 +0000 (11:15 +0200)] 
meson: use signed chars

This matches what the autotools build is doing.
Also see https://github.com/util-linux/util-linux/pull/2768 .

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
6 weeks agomeson: Only build libmount when required
Jordan Williams [Fri, 5 Apr 2024 14:49:17 +0000 (07:49 -0700)] 
meson: Only build libmount when required

It is not currently possible to build any part of util-linux without
building libmount when using Meson.
The libuuid library is commonly used on macOS, where it is not possible
to build libmount.
To address this, this PR makes it possible to build without libmount and
 libblkid.

Options have been added to allow toggling whether to build targets that
require libmount.
This makes it possible to fully disable building libmount.

The python object had to be defined outside of the meson.build file in
libmount/python since this may no longer be included.
The python object is used for tests.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
6 weeks agomeson: Use libblkid as a dependency
Jordan Williams [Fri, 5 Apr 2024 15:30:02 +0000 (08:30 -0700)] 
meson: Use libblkid as a dependency

Several utilities depend on libblkid internally.
Currently, link_with and global include directories are used to
associate targets with libblkid.
This PR uses Meson's dependencies argument for targets to define this
relationship instead.
This carries include directories along with the library to link.

An additional dependency is declared for the static libblkid library.
A couple of executables use this dependency explicitly.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
6 weeks agomeson: Use libmount as a dependency
Jordan Williams [Fri, 5 Apr 2024 15:33:22 +0000 (08:33 -0700)] 
meson: Use libmount as a dependency

Several utilities depend on libmount internally.
Currently, link_with and global include directories are used to
associate targets with libmount.
This PR uses Meson's dependencies argument for targets to define this
relationship instead.
This carries include directories along with the library to link.

An additional dependency is declared for the static libmount library.
A couple of executables use this dependency explicitly.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
6 weeks agotests: (test_mkfds::sockdiag) verify the recieved message to detect whether the socke...
Masatake YAMATO [Mon, 1 Apr 2024 21:34:40 +0000 (06:34 +0900)] 
tests: (test_mkfds::sockdiag) verify the recieved message to detect whether the socket is usable or not

Close #2822 again.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
(cherry picked from commit f98a4c12b366ae2b5e01fa30d72eef34f3bab681)

6 weeks agolsfd: add LSFD_DEBUG env var for debugging
Masatake YAMATO [Sat, 30 Mar 2024 09:47:03 +0000 (18:47 +0900)] 
lsfd: add LSFD_DEBUG env var for debugging

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
(cherry picked from commit fbdbf44752b1b8fe5caeae168809fe2e4629752f)

6 weeks agotests: (lsfd) skip some cases if NETLINK_SOCK_DIAG for AF_UNIX is not available
Masatake YAMATO [Sat, 16 Mar 2024 13:20:00 +0000 (22:20 +0900)] 
tests: (lsfd) skip some cases if NETLINK_SOCK_DIAG for AF_UNIX is not available

Close #2822.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 weeks agotests: (test_mkfds::sockdiag) new factory
Masatake YAMATO [Sat, 16 Mar 2024 13:07:43 +0000 (22:07 +0900)] 
tests: (test_mkfds::sockdiag) new factory

The factory is for detecting whether a platform provides
NETLINK_SOCK_DIAG sockets for a given family.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 weeks agotests: (lsfd-functions.bash,cosmetic) unify the style to define functions
Masatake YAMATO [Sat, 16 Mar 2024 13:05:48 +0000 (22:05 +0900)] 
tests: (lsfd-functions.bash,cosmetic) unify the style to define functions

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 weeks agotests: (lsfd) fix typoes in an error name
Masatake YAMATO [Sat, 16 Mar 2024 15:38:17 +0000 (00:38 +0900)] 
tests: (lsfd) fix typoes in an error name

6 weeks agoMerge branch 'meson-optional-rt' of https://github.com/jwillikers/util-linux
Karel Zak [Fri, 5 Apr 2024 08:57:13 +0000 (10:57 +0200)] 
Merge branch 'meson-optional-rt' of https://github.com/jwillikers/util-linux

* 'meson-optional-rt' of https://github.com/jwillikers/util-linux:
  meson: Only pick up the rt library once
  meson: Add build-lsfd option and make rt dependency optional

6 weeks agoMerge branch 'PR/libsmartcols-json-empty' of github.com:karelzak/util-linux-work
Karel Zak [Fri, 5 Apr 2024 07:40:48 +0000 (09:40 +0200)] 
Merge branch 'PR/libsmartcols-json-empty' of github.com:karelzak/util-linux-work

* 'PR/libsmartcols-json-empty' of github.com:karelzak/util-linux-work:
  libsmartcols: print empty arrays in better way
  lib/jsonwrt: introduce ul_jsonwrt_empty()

6 weeks agoMerge branch 'fix/opal_luks_blkid_scan' of https://github.com/oldium/util-linux
Karel Zak [Fri, 5 Apr 2024 07:33:40 +0000 (09:33 +0200)] 
Merge branch 'fix/opal_luks_blkid_scan' of https://github.com/oldium/util-linux

* 'fix/opal_luks_blkid_scan' of https://github.com/oldium/util-linux:
  libblkid: check OPAL lock only when necessary
  libblkid: introduce luks opal prober

6 weeks agoMerge branch 'blkid/topology-ioctl' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 5 Apr 2024 06:49:48 +0000 (08:49 +0200)] 
Merge branch 'blkid/topology-ioctl' of https://github.com/t-8ch/util-linux

* 'blkid/topology-ioctl' of https://github.com/t-8ch/util-linux:
  libblkid: topology/ioctl: simplify ioctl handling

6 weeks agolibblkid: topology/ioctl: simplify ioctl handling
Thomas Weißschuh [Thu, 4 Apr 2024 05:24:58 +0000 (07:24 +0200)] 
libblkid: topology/ioctl: simplify ioctl handling

Coverity complains about the data copy within the union.
Instead unroll the loop which is less code and easier to follow.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
6 weeks agomount: (man) add note about -o bind,rw
Karel Zak [Thu, 4 Apr 2024 10:19:09 +0000 (12:19 +0200)] 
mount: (man) add note about -o bind,rw

Signed-off-by: Karel Zak <kzak@redhat.com>
6 weeks agosys-utils/irq-common: fix SPDX typos
Karel Zak [Thu, 4 Apr 2024 09:54:27 +0000 (11:54 +0200)] 
sys-utils/irq-common: fix SPDX typos

Reported-by: oliver Fendt <ofendt@googlemail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 weeks agoMerge branch 'blkid/topology-ioctl' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 3 Apr 2024 12:10:06 +0000 (14:10 +0200)] 
Merge branch 'blkid/topology-ioctl' of https://github.com/t-8ch/util-linux

* 'blkid/topology-ioctl' of https://github.com/t-8ch/util-linux:
  libblkid: topology/ioctl: correctly handle kernel types

6 weeks agolibsmartcols: print empty arrays in better way
Karel Zak [Wed, 3 Apr 2024 12:00:45 +0000 (14:00 +0200)] 
libsmartcols: print empty arrays in better way

Use "[]" rather than "[null]" to print empty array.

Old version:
         "mountpoints": [
             null
         ],
New version:
"mountpoints": [],

Fixes: https://github.com/util-linux/util-linux/issues/2871
Signed-off-by: Karel Zak <kzak@redhat.com>
6 weeks agolib/jsonwrt: introduce ul_jsonwrt_empty()
Karel Zak [Wed, 3 Apr 2024 11:57:18 +0000 (13:57 +0200)] 
lib/jsonwrt: introduce ul_jsonwrt_empty()

The new function optimizes the printing of empty objects and arrays in
a "pretty" way, instead of using the ul_jsonwrt_..._open() and
ul_jsonwrt_..._close() functions, which add extra line breaks to the
output.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 weeks agolibblkid: topology/ioctl: correctly handle kernel types
Thomas Weißschuh [Tue, 2 Apr 2024 16:55:29 +0000 (18:55 +0200)] 
libblkid: topology/ioctl: correctly handle kernel types

Commit 5d71d711d07a ("libblkid: topolicy/ioctl: use union for multiple data types")
incorrectly assumed that set_ulong and set_int refer to the type
returned by the kernel. Instead the different function pointer names
refer to the types of the function pointers.
However all ioctls, except for the later added BLKGETDISKSEQ, return
32bit integers.
This made libblkid also interpret the upper 32bits too, leading to
garbage values.

Introduce a new member 'kernel_size' to also handle the 64bit
BLKGETDISKSEQ.

Drop data.ul as it is no actually used.

Closes #2904
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
6 weeks agolsfd: test: Adapt test cases for pidfs
Xi Ruoyao [Wed, 27 Mar 2024 20:01:02 +0000 (04:01 +0800)] 
lsfd: test: Adapt test cases for pidfs

On Linux >= 6.9, pidfds are from pidfs instead of anonymous inode.
Thus:

STTYPE is REG on Linux >= 6.9, UNKN on Linux < 6.9.

KNAME is pidfd:[inode number] on Linux >= 6.9, anon_inode:[pidfd] on
Linux < 6.9.

And ainode_class test cannot work on Linux >= 6.9, just skip this sub
test if STTYPE is REG.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
6 weeks agolsfd: Support pidfs
Xi Ruoyao [Wed, 3 Apr 2024 07:46:57 +0000 (15:46 +0800)] 
lsfd: Support pidfs

In Linux 6.9 pidfds are moved from the anonymous inode infrastructure to
a tiny pseudo filesystem named pidfs.  Recognize it properly.

Fixes #2865.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
6 weeks agolsfd: Refactor the pidfd logic into lsfd-pidfd.c
Xi Ruoyao [Wed, 3 Apr 2024 07:29:34 +0000 (15:29 +0800)] 
lsfd: Refactor the pidfd logic into lsfd-pidfd.c

We'll reuse these logic for pidfd support on Linux >= 6.9.  This should
be a no-functional change.

Besides moving the code, this change also renames anon_pidfd_data to
pidfd_data, and removes a redundant nullity check for free (because
free(NULL) will just do nothing per the C standard).

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
6 weeks agotests: (test_mkfds::netlink) pass a correct file descriptor to bind(2)
Masatake YAMATO [Tue, 2 Apr 2024 15:01:27 +0000 (00:01 +0900)] 
tests: (test_mkfds::netlink) pass a correct file descriptor to bind(2)

Close #2901

The original code passed a closed file descriptor to bind(2).

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 weeks agolsns: show namespaces only kept alive by open file descriptors
Masatake YAMATO [Sat, 24 Feb 2024 19:56:51 +0000 (04:56 +0900)] 
lsns: show namespaces only kept alive by open file descriptors

Close #1884.

Quoted from the original issue comment submitted by @hesch:

  It can happen, that a namespace is only kept alive by an open file
  descriptor of a program as ilustrated by A.B:

    1. 'ip netns add foo' - add a namespace
    2. 'sleep 999 4< /run/netns/foo & sleep 2' - open the fd to the
       namespace in a background job
    3. 'ip netns delete foo' - delete the namespace (only deletes
       the /run/netns/foo)

  Now there exists a namespace with no process running in it and it has
  no bind mount so it does not show up in /proc/mounts, but it is still
  there and could be mounted back.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 weeks agolsns: (refactor) use ul_new_path and procfs_process_init_path
Masatake YAMATO [Sun, 25 Feb 2024 16:18:26 +0000 (01:18 +0900)] 
lsns: (refactor) use ul_new_path and procfs_process_init_path

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
7 weeks agoMerge branch 'master' of https://github.com/BinBashBanana/util-linux
Karel Zak [Tue, 2 Apr 2024 11:19:03 +0000 (13:19 +0200)] 
Merge branch 'master' of https://github.com/BinBashBanana/util-linux

* 'master' of https://github.com/BinBashBanana/util-linux:
  add static partx

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: Only pick up the rt library once
Jordan Williams [Mon, 1 Apr 2024 17:18:52 +0000 (12:18 -0500)] 
meson: Only pick up the rt library once

Require the rt library for the build-lsfd feature.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
7 weeks agomeson: Add build-lsfd option and make rt dependency optional
Jordan Williams [Fri, 29 Mar 2024 17:14:44 +0000 (12:14 -0500)] 
meson: Add build-lsfd option and make rt dependency optional

A dependency on the rt library is unnecessarily required when checking
for the clock_gettime and timer_create functions.
This causes the build to fail if the rt library is not found.
This should not fail the build as rt is only required for the checks.
Additionally, the lsfd executable and some tests require rt.
There is currently no option to toggle building lsfd.

This PR makes it possible to build without the rt library.
Function checks no longer require rt for the build.
The function checks for the rt library only run when rt is available.
This PR adds an option to allow building without lsfd.
This makes it possible to build without the executable that requires rt.
To not require rt for the test, a additional check has been added.
The effected tests won't be built unless rt has been found.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
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 agolibblkid: check OPAL lock only when necessary
Oldřich Jedlička [Sat, 30 Mar 2024 13:45:10 +0000 (14:45 +0100)] 
libblkid: check OPAL lock only when necessary

When the HW OPAL encryption is used, the LUKS2 subsystem field is "HW-OPAL"
(see also [1]). Finish the probe only in case LUKS2 is set to use HW OPAL
and the disk is locked.

[1] https://gitlab.com/cryptsetup/cryptsetup/-/issues/874#note_1838835551

Signed-off-by: Oldřich Jedlička <oldium.pro@gmail.com>
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 agoinclude: Include <unistd.h> in pidfd-utils.h for syscall()
Xi Ruoyao [Sat, 30 Mar 2024 16:42:03 +0000 (00:42 +0800)] 
include: Include <unistd.h> in pidfd-utils.h for syscall()

In Glibc, <sys/syscall.h> only contains SYS_* macros and the syscall()
function is in <unistd.h>.  So include it.

Signed-off-by: Xi Ruoyao <xry111@xry111.site>
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 agolibblkid: introduce luks opal prober
Thomas Weißschuh [Sat, 30 Mar 2024 10:14:47 +0000 (11:14 +0100)] 
libblkid: introduce luks opal prober

Accesses to a disk locked with OPAL trigger IO errors logged by the
kernel which should be avoided.
Running the normal luks prober first breaks the ordering of probers
leading to incorrect detections, for example detecting mdadm superblocks
before version 1.1 as luks.

Introduce a new prober that only runs on OPAL-locked disks to avoid
these false-positives.

See #2061, #2373 and #2882.

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>
7 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)

7 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

7 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

7 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>
7 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)

7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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>
7 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)

7 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)

7 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)

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