]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
15 months agoMerge branch 'next'
Karel Zak [Mon, 29 May 2023 12:56:52 +0000 (14:56 +0200)] 
Merge branch 'next'

15 months agoMerge branch 'mount/ntfs-segfault' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 29 May 2023 09:29:19 +0000 (11:29 +0200)] 
Merge branch 'mount/ntfs-segfault' of https://github.com/t-8ch/util-linux

* 'mount/ntfs-segfault' of https://github.com/t-8ch/util-linux:
  mount: (tests) test mount helper with multiple filesystems
  libmount: (tests) split helper tests

15 months agotests: (lsfd) add a case for testing EVENTPOLL.TFDS column
Masatake YAMATO [Sun, 28 May 2023 03:28:13 +0000 (12:28 +0900)] 
tests: (lsfd) add a case for testing EVENTPOLL.TFDS column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agotests: (mkfds) add a factory to make an eventpoll fd
Masatake YAMATO [Sat, 27 May 2023 18:20:37 +0000 (03:20 +0900)] 
tests: (mkfds) add a factory to make an eventpoll fd

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agolsfd: print file descriptors targeted by eventpoll files
Masatake YAMATO [Sat, 27 May 2023 17:49:00 +0000 (02:49 +0900)] 
lsfd: print file descriptors targeted by eventpoll files

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agoadd the "x" wrapper for reallocarray(3)
Masatake YAMATO [Sun, 28 May 2023 03:34:21 +0000 (12:34 +0900)] 
add the "x" wrapper for reallocarray(3)

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
15 months agomount: (tests) test mount helper with multiple filesystems
Thomas Weißschuh [Thu, 25 May 2023 05:22:34 +0000 (07:22 +0200)] 
mount: (tests) test mount helper with multiple filesystems

See #2267

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
15 months agolibmount: (tests) split helper tests
Thomas Weißschuh [Thu, 25 May 2023 05:19:03 +0000 (07:19 +0200)] 
libmount: (tests) split helper tests

This splits the test introduced in
commit 06e05eb0f785 ("libmount: don't pass option "defaults" to helper")
into its own subtest.

We will have more subtests.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
15 months agolibmount: don't call hooks after mount.<type> helper
Karel Zak [Thu, 25 May 2023 09:48:24 +0000 (11:48 +0200)] 
libmount: don't call hooks after mount.<type> helper

In case more filesystems are specified (or when libmount follows
/{etc,proc}/filesystems) then the library may try to use and
initialize the new API because for some filesystems, we need
exec(/sbin/mount.<type>) and for another fsopen().

The hooks that use the API have to smart and detect that the mount
operation was done in external /sbin/mount.<type> helper. And in this
case, the new API file descriptors must be ignored.

The exception is propagation flags, mount(8) can set the flags after
exec(/sbin/mount.<type>), for example, "mount -t ntfs --make-private".

Fixes: https://github.com/util-linux/util-linux/issues/2267
Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoMerge branch 'enosys/arch-check' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 24 May 2023 09:41:59 +0000 (11:41 +0200)] 
Merge branch 'enosys/arch-check' of https://github.com/t-8ch/util-linux

* 'enosys/arch-check' of https://github.com/t-8ch/util-linux:
  enosys: add support for loongarch
  enosys: only build if AUDIT_ARCH_NATIVE is defined
  meson: require 0.57
  enosys: split audit arch detection into dedicated header
  enosys: add support for sparc

16 months agoMerge branch 'lsfd--sysvipc-shmem' of https://github.com/masatake/util-linux
Karel Zak [Wed, 24 May 2023 09:41:42 +0000 (11:41 +0200)] 
Merge branch 'lsfd--sysvipc-shmem' of https://github.com/masatake/util-linux

* 'lsfd--sysvipc-shmem' of https://github.com/masatake/util-linux:
  tests: (lsfd) add a case for testing SOURCE column for SysV shmem mappings
  tests: (mkfds) add a factory to make SysV shmem
  lsfd: add tmpfs as source of sysvipc to the the nodev_table
  lsfd: initialize pagesize in an earlier stage
  lsfd: add "nsfs" to the nodev_table to fill SOURCE column for nsfs files
  lsfd: add a helper function for adding a nodev to the nodev_table
  lsfd: add a whitespace
  lsfd: write more about nsfs in comment

16 months agotests: (lsfd) add a case for testing SOURCE column for SysV shmem mappings
Masatake YAMATO [Wed, 12 Apr 2023 00:17:02 +0000 (09:17 +0900)] 
tests: (lsfd) add a case for testing SOURCE column for SysV shmem mappings

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agotests: (mkfds) add a factory to make SysV shmem
Masatake YAMATO [Wed, 12 Apr 2023 00:14:49 +0000 (09:14 +0900)] 
tests: (mkfds) add a factory to make SysV shmem

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: add tmpfs as source of sysvipc to the the nodev_table
Masatake YAMATO [Tue, 21 Mar 2023 16:15:37 +0000 (01:15 +0900)] 
lsfd: add tmpfs as source of sysvipc to the the nodev_table

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: initialize pagesize in an earlier stage
Masatake YAMATO [Tue, 21 Mar 2023 16:03:22 +0000 (01:03 +0900)] 
lsfd: initialize pagesize in an earlier stage

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: add "nsfs" to the nodev_table to fill SOURCE column for nsfs files
Masatake YAMATO [Tue, 21 Mar 2023 16:22:18 +0000 (01:22 +0900)] 
lsfd: add "nsfs" to the nodev_table to fill SOURCE column for nsfs files

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: add a helper function for adding a nodev to the nodev_table
Masatake YAMATO [Mon, 20 Mar 2023 17:19:11 +0000 (02:19 +0900)] 
lsfd: add a helper function for adding a nodev to the nodev_table

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: add a whitespace
Masatake YAMATO [Tue, 21 Mar 2023 16:09:26 +0000 (01:09 +0900)] 
lsfd: add a whitespace

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: write more about nsfs in comment
Masatake YAMATO [Tue, 23 May 2023 15:49:24 +0000 (00:49 +0900)] 
lsfd: write more about nsfs in comment

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agoenosys: add support for loongarch
Thomas Weißschuh [Tue, 23 May 2023 14:34:47 +0000 (16:34 +0200)] 
enosys: add support for loongarch

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agoenosys: only build if AUDIT_ARCH_NATIVE is defined
Thomas Weißschuh [Mon, 22 May 2023 15:58:17 +0000 (17:58 +0200)] 
enosys: only build if AUDIT_ARCH_NATIVE is defined

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agomeson: require 0.57
Thomas Weißschuh [Tue, 23 May 2023 14:32:23 +0000 (16:32 +0200)] 
meson: require 0.57

It is needed for fs.read()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agoenosys: split audit arch detection into dedicated header
Thomas Weißschuh [Mon, 22 May 2023 15:25:15 +0000 (17:25 +0200)] 
enosys: split audit arch detection into dedicated header

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agoenosys: add support for sparc
Thomas Weißschuh [Mon, 22 May 2023 15:21:26 +0000 (17:21 +0200)] 
enosys: add support for sparc

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agolsfd: (tests) don't run mqueue test on byteorder mismatch
Thomas Weißschuh [Tue, 23 May 2023 12:27:25 +0000 (14:27 +0200)] 
lsfd: (tests) don't run mqueue test on byteorder mismatch

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agowaitpid: only build when pidfd_open is available
Thomas Weißschuh [Mon, 22 May 2023 16:24:47 +0000 (18:24 +0200)] 
waitpid: only build when pidfd_open is available

Fixes #2256

[kzak@redhat.com: - fix UL_BUILD_INIT() use]

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoMerge branch 'meson' of https://github.com/eworm-de/util-linux
Karel Zak [Tue, 23 May 2023 10:18:00 +0000 (12:18 +0200)] 
Merge branch 'meson' of https://github.com/eworm-de/util-linux

* 'meson' of https://github.com/eworm-de/util-linux:
  meson: install symlink for vigr man page
  meson: include bash-completion for write
  meson: include bash-completion for newgrp

16 months agoMerge branch 'lsfd--mqueue' of https://github.com/masatake/util-linux
Karel Zak [Tue, 23 May 2023 10:17:18 +0000 (12:17 +0200)] 
Merge branch 'lsfd--mqueue' of https://github.com/masatake/util-linux

* 'lsfd--mqueue' of https://github.com/masatake/util-linux:
  tests: (lsfd) add cases for POSIX Mqueue
  tests: (mkfds) add mqueue factory
  lsfd: fill ENDPOINTS column of POSIX Mqueue
  lsfd: add a new type "mqueue", a type for POSIX Mqueue

16 months agoMerge branch 'agetty/fileutils' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 23 May 2023 10:16:31 +0000 (12:16 +0200)] 
Merge branch 'agetty/fileutils' of https://github.com/t-8ch/util-linux

* 'agetty/fileutils' of https://github.com/t-8ch/util-linux:
  agetty: include fileutils.h

16 months agomeson: install symlink for vigr man page
Christian Hesse [Mon, 22 May 2023 14:11:18 +0000 (16:11 +0200)] 
meson: install symlink for vigr man page

16 months agomeson: include bash-completion for write
Christian Hesse [Mon, 22 May 2023 13:57:35 +0000 (15:57 +0200)] 
meson: include bash-completion for write

16 months agomeson: include bash-completion for newgrp
Christian Hesse [Mon, 22 May 2023 13:56:28 +0000 (15:56 +0200)] 
meson: include bash-completion for newgrp

16 months agolibmount: cleanup enosys returns from mount hoop
Karel Zak [Tue, 23 May 2023 10:13:02 +0000 (12:13 +0200)] 
libmount: cleanup enosys returns from mount hoop

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoMerge branch 'libmount/mount_setattr' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 23 May 2023 10:06:36 +0000 (12:06 +0200)] 
Merge branch 'libmount/mount_setattr' of https://github.com/t-8ch/util-linux

* 'libmount/mount_setattr' of https://github.com/t-8ch/util-linux:
  libmount: check for availability of mount_setattr

16 months agofstab: add hint about systemd reload
Karel Zak [Tue, 23 May 2023 09:34:19 +0000 (11:34 +0200)] 
fstab: add hint about systemd reload

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agomount: improve code readability
Karel Zak [Tue, 23 May 2023 08:47:18 +0000 (10:47 +0200)] 
mount: improve code readability

Static analyzers (e.g., Coverity) have a hard time understanding why
'optarg' is tested for NULL, and later in another place, code assumes
that it's non-NULL. For idmapping, the optarg is required.

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agologin: fix memory leak [coverity scan]
Karel Zak [Tue, 23 May 2023 08:43:59 +0000 (10:43 +0200)] 
login: fix memory leak [coverity scan]

Let's use ul_path_read_buffer() to avoid memory allocation.

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agolibmount: don't call mount.<type> helper with usernames
Karel Zak [Mon, 22 May 2023 15:26:55 +0000 (17:26 +0200)] 
libmount: don't call mount.<type> helper with usernames

This is v2.39 regression. The "user" mount option is internally
converted to "user=<name>", but this should not be exported to
the mount helpers.

The mount helper accepts the <name> only if specified in mount options
(cifs uses user=). The real username as generated by libmount is not
relevant in this case.

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoagetty: include fileutils.h
Thomas Weißschuh [Mon, 22 May 2023 15:11:17 +0000 (17:11 +0200)] 
agetty: include fileutils.h

It is needed to access xreaddir()

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agotests: (lsfd) add cases for POSIX Mqueue
Masatake YAMATO [Sat, 11 Mar 2023 15:53:57 +0000 (00:53 +0900)] 
tests: (lsfd) add cases for POSIX Mqueue

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agotests: (mkfds) add mqueue factory
Masatake YAMATO [Sat, 11 Mar 2023 15:24:02 +0000 (00:24 +0900)] 
tests: (mkfds) add mqueue factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: fill ENDPOINTS column of POSIX Mqueue
Masatake YAMATO [Mon, 6 Mar 2023 16:32:01 +0000 (01:32 +0900)] 
lsfd: fill ENDPOINTS column of POSIX Mqueue

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agotests: add optlist tests
Karel Zak [Mon, 22 May 2023 13:40:38 +0000 (15:40 +0200)] 
tests: add optlist tests

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agolsfd: add a new type "mqueue", a type for POSIX Mqueue
Masatake YAMATO [Sun, 5 Mar 2023 19:05:03 +0000 (04:05 +0900)] 
lsfd: add a new type "mqueue", a type for POSIX Mqueue

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolibmount: fix options prepend/insert and merging
Karel Zak [Mon, 22 May 2023 13:00:25 +0000 (15:00 +0200)] 
libmount: fix options prepend/insert and merging

 * the order of the new options should not be changed
   (for example prepend "a,b,c" to list with "d" has to generate "a,b,c,d", not "c,b,a,d")

 * make sure that  options map is defined when merging options

Fixes: https://github.com/util-linux/util-linux/issues/2238
Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoMerge branch 'agetty-creds' of https://github.com/DaanDeMeyer/util-linux
Karel Zak [Mon, 22 May 2023 11:42:48 +0000 (13:42 +0200)] 
Merge branch 'agetty-creds' of https://github.com/DaanDeMeyer/util-linux

* 'agetty-creds' of https://github.com/DaanDeMeyer/util-linux:
  Document new systemd credentials support for agetty and login
  login: Initialize noauth from login.noauth credential
  agetty: Load autologin user from agetty.autologin credential

16 months agoMerge branch 'map-users' of https://github.com/arachsys-prs/util-linux
Karel Zak [Mon, 22 May 2023 11:36:37 +0000 (13:36 +0200)] 
Merge branch 'map-users' of https://github.com/arachsys-prs/util-linux

* 'map-users' of https://github.com/arachsys-prs/util-linux:
  mount: add --map-users and --map-groups convenience options

16 months agoMerge branch 'ci/openwrt' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 22 May 2023 11:32:53 +0000 (13:32 +0200)] 
Merge branch 'ci/openwrt' of https://github.com/t-8ch/util-linux

* 'ci/openwrt' of https://github.com/t-8ch/util-linux:
  ci: add OpenWrt SDK based CI jobs
  enosys: provide a nicer build message for syscalls.h generation
  libsmartcols: (samples): fix format truncation warning
  test_uuidd: make pthread_t formatting more robust
  mkfs.minix: handle 64bit time on 32bit system
  enosys: add support for MIPS, PowerPC and ARC
  enosys: include sys/syscall.h

16 months agoMerge branch 'enosys/speculation' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 22 May 2023 11:10:31 +0000 (13:10 +0200)] 
Merge branch 'enosys/speculation' of https://github.com/t-8ch/util-linux

16 months agoMerge branch 'enosys/mips' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 22 May 2023 11:09:28 +0000 (13:09 +0200)] 
Merge branch 'enosys/mips' of https://github.com/t-8ch/util-linux

* 'enosys/mips' of https://github.com/t-8ch/util-linux:
  enosys: add support for MIPS, PowerPC and ARC

16 months agoMerge branch 'fadvise/big-page' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 22 May 2023 11:06:44 +0000 (13:06 +0200)] 
Merge branch 'fadvise/big-page' of https://github.com/t-8ch/util-linux

* 'fadvise/big-page' of https://github.com/t-8ch/util-linux:
  fadvise: (test) test with 64k blocks
  fadvise: (test) don't compare fincore page counts
  fadvise: (tests) factor out calls to "fincore"
  fadvise: (test) dynamically calculate expected test values

16 months agoMerge branch 'test--fix-process-leak' of https://github.com/masatake/util-linux
Karel Zak [Mon, 22 May 2023 11:04:08 +0000 (13:04 +0200)] 
Merge branch 'test--fix-process-leak' of https://github.com/masatake/util-linux

* 'test--fix-process-leak' of https://github.com/masatake/util-linux:
  lsfd: (tests) fix process leak

16 months agoMerge branch 'enosys/include' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 22 May 2023 11:01:58 +0000 (13:01 +0200)] 
Merge branch 'enosys/include' of https://github.com/t-8ch/util-linux

* 'enosys/include' of https://github.com/t-8ch/util-linux:
  enosys: include sys/syscall.h

16 months agoMerge branch 'libblkid/const' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 22 May 2023 11:00:04 +0000 (13:00 +0200)] 
Merge branch 'libblkid/const' of https://github.com/t-8ch/util-linux

* 'libblkid/const' of https://github.com/t-8ch/util-linux:
  libblkid: constify cached disk data

16 months agolib/shells: remove space after function name
Karel Zak [Mon, 22 May 2023 10:45:06 +0000 (12:45 +0200)] 
lib/shells: remove space after function name

Cats and ponies die when they see a space after a function name ...

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agolib/shells: initialize free-able variables
Karel Zak [Mon, 22 May 2023 10:43:53 +0000 (12:43 +0200)] 
lib/shells: initialize free-able variables

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agoMerge branch 'econf' of https://github.com/stoeckmann/util-linux
Karel Zak [Mon, 22 May 2023 10:42:13 +0000 (12:42 +0200)] 
Merge branch 'econf' of https://github.com/stoeckmann/util-linux

* 'econf' of https://github.com/stoeckmann/util-linux:
  lib/shells: Plug econf memory leak

16 months agoMerge branch 'lsfd--eventfd' of https://github.com/masatake/util-linux
Karel Zak [Mon, 22 May 2023 10:39:59 +0000 (12:39 +0200)] 
Merge branch 'lsfd--eventfd' of https://github.com/masatake/util-linux

* 'lsfd--eventfd' of https://github.com/masatake/util-linux:
  test_mkfds: avoid "ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’"
  tests: (lsfd) add cases for eventfd
  tests: (mkfds) add eventfd factory
  tests: (mkfds) provide the way to declare the number of extra printing values
  tests: (mkfds) print a whitespace only when the running factory has "report" method
  lsfd: fill ENDPOINTS column for eventfd
  lsfd: add a helper macro, foreach_endpoint
  lsfd: add a helper function, init_endpoint
  lsfd: add a helper function, add_endpoint
  lsfd: add a helper function, new_ipc
  lsfd: add a back pointer as a member of anon_eventfd_data
  lsfd: move a local variable to a narrower scope
  lsfd: add EVENTFD.ID column
  lsfd: delete redundant parentheses surrounding return value
  ldfd: delete unnecessary ';'
  lsfd: choose anon_ops declarative way

16 months agoMerge branch 'hexdump-one-byte-hex' of https://github.com/tpwo/util-linux
Karel Zak [Mon, 22 May 2023 10:36:45 +0000 (12:36 +0200)] 
Merge branch 'hexdump-one-byte-hex' of https://github.com/tpwo/util-linux

* 'hexdump-one-byte-hex' of https://github.com/tpwo/util-linux:
  hexdump: add new format-strings test case
  hexdump: add '--one-byte-hex' format option

16 months agoMerge branch 'allow-disabling-waitpid' of https://github.com/mrc0mmand/util-linux
Karel Zak [Mon, 22 May 2023 10:32:07 +0000 (12:32 +0200)] 
Merge branch 'allow-disabling-waitpid' of https://github.com/mrc0mmand/util-linux

* 'allow-disabling-waitpid' of https://github.com/mrc0mmand/util-linux:
  build-sys: add --disable-waitpid

16 months agoenosys: allow CPU speculation
Thomas Weißschuh [Mon, 22 May 2023 07:56:06 +0000 (09:56 +0200)] 
enosys: allow CPU speculation

enosys is not a security tool so we can allow the CPU to speculate.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agolibmount: check for availability of mount_setattr
Thomas Weißschuh [Sat, 20 May 2023 04:38:20 +0000 (06:38 +0200)] 
libmount: check for availability of mount_setattr

If mount_setattr is not available but needed fall back to the legacy
mount API.

Fixes #2247

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agolsfd: (tests) fix process leak
Masatake YAMATO [Fri, 19 May 2023 15:29:39 +0000 (00:29 +0900)] 
lsfd: (tests) fix process leak

Unifying multiple invocations of kill command and wait command
into two is suggested by Thomas Weißschuh <thomas@t-8ch.de>.

Addresses: https://lore.kernel.org/util-linux/652d32c5-4b33-ce3a-3de7-9ebc064bbdcb@gmail.com/
Reported-by: Bruce Dubbs <bruce.dubbs@gmail.com>
Tested-by: Bruce Dubbs <bruce.dubbs@gmail.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agofadvise: (test) test with 64k blocks
Thomas Weißschuh [Sun, 21 May 2023 19:45:10 +0000 (21:45 +0200)] 
fadvise: (test) test with 64k blocks

This will allow the tests to also pass on systems with 64k pagesizes.

Closes #2249
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agofadvise: (test) don't compare fincore page counts
Thomas Weißschuh [Sun, 21 May 2023 19:44:20 +0000 (21:44 +0200)] 
fadvise: (test) don't compare fincore page counts

These depend on the machines pagesize and are therefore not a good
comparision.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agofadvise: (tests) factor out calls to "fincore"
Thomas Weißschuh [Sun, 21 May 2023 19:43:38 +0000 (21:43 +0200)] 
fadvise: (tests) factor out calls to "fincore"

This will make it easier to pass argument later.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agofadvise: (test) dynamically calculate expected test values
Thomas Weißschuh [Sun, 21 May 2023 19:42:14 +0000 (21:42 +0200)] 
fadvise: (test) dynamically calculate expected test values

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agolibmount: don't pass option "defaults" to helper
Thomas Weißschuh [Sun, 21 May 2023 17:58:47 +0000 (19:58 +0200)] 
libmount: don't pass option "defaults" to helper

"defaults" is only a pseudo-option that expands to other options.
It should not be passed to helpers.

Reported-by: Quentin Rameau <quinq@fifth.space>
Closes: https://lore.kernel.org/util-linux/20230521181814.0b0f2d38.quinq@fifth.space/
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agoci: add OpenWrt SDK based CI jobs
Thomas Weißschuh [Fri, 19 May 2023 09:38:18 +0000 (11:38 +0200)] 
ci: add OpenWrt SDK based CI jobs

This allows testing some more exotic architectures and libcs.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agoenosys: provide a nicer build message for syscalls.h generation
Thomas Weißschuh [Fri, 19 May 2023 14:29:23 +0000 (16:29 +0200)] 
enosys: provide a nicer build message for syscalls.h generation

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agolibsmartcols: (samples): fix format truncation warning
Thomas Weißschuh [Fri, 19 May 2023 15:34:00 +0000 (17:34 +0200)] 
libsmartcols: (samples): fix format truncation warning

As this is only an example and the needed memory is not much just
hardcode a large enough number.
The previously computed value was wrong anyways.

libsmartcols/samples/continuous.c: In function 'main':
libsmartcols/samples/continuous.c:110:61: error: '%3d' directive output may be truncated writing between 3 and 11 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
  110 |                         snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
      |                                                             ^~~
libsmartcols/samples/continuous.c:110:25: note: 'snprintf' output between 11 and 333 bytes into a destination of size 12
  110 |                         snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111 |                                 done ? 100 : (int)(diff / (TIME_PERIOD / 100.0)));
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
libsmartcols/samples/continuous.c:110:61: error: '%3d' directive output may be truncated writing 3 bytes into a region of size between 0 and 7 [-Werror=format-truncation=]
  110 |                         snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
      |                                                             ^~~
libsmartcols/samples/continuous.c:110:25: note: 'snprintf' output between 11 and 325 bytes into a destination of size 12
  110 |                         snprintf(timecell, timecellsz, "%f [%3d%%]", diff,
      |                         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  111 |                                 done ? 100 : (int)(diff / (TIME_PERIOD / 100.0)));
      |                                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agotest_uuidd: make pthread_t formatting more robust
Thomas Weißschuh [Fri, 19 May 2023 14:47:48 +0000 (16:47 +0200)] 
test_uuidd: make pthread_t formatting more robust

On musl pthread_t is a pointer. To avoid compiler warnings on 32bit
systems add a cast through intptr_t.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agomkfs.minix: handle 64bit time on 32bit system
Thomas Weißschuh [Fri, 19 May 2023 14:47:22 +0000 (16:47 +0200)] 
mkfs.minix: handle 64bit time on 32bit system

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agoenosys: add support for MIPS, PowerPC and ARC
Thomas Weißschuh [Wed, 17 May 2023 15:00:31 +0000 (17:00 +0200)] 
enosys: add support for MIPS, PowerPC and ARC

Co-developed-by: Hauke Mertens <hauke@hauke-m.de>
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agoenosys: include sys/syscall.h
Thomas Weißschuh [Fri, 19 May 2023 08:51:25 +0000 (10:51 +0200)] 
enosys: include sys/syscall.h

Otherwise there is no guarantee that all syscall numbers detected by
tools/all_syscalls are actually available to enosys.c.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agoenosys: include sys/syscall.h
Thomas Weißschuh [Fri, 19 May 2023 08:51:25 +0000 (10:51 +0200)] 
enosys: include sys/syscall.h

Otherwise there is no guarantee that all syscall numbers detected by
tools/all_syscalls are actually available to enosys.c.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agoenosys: add support for MIPS, PowerPC and ARC
Thomas Weißschuh [Wed, 17 May 2023 15:00:31 +0000 (17:00 +0200)] 
enosys: add support for MIPS, PowerPC and ARC

Co-developed-by: Hauke Mertens <hauke@hauke-m.de>
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agolibblkid: constify cached disk data
Thomas Weißschuh [Thu, 18 May 2023 20:37:10 +0000 (22:37 +0200)] 
libblkid: constify cached disk data

The data returned from blkid_probe_get_buffer() and friends may or may
not be cached between different calls.
If one copy is modified this may not be visible in other copies.

This issue can be avoided by making any modification illegal.

See also #2165

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
16 months agotest_mkfds: avoid "ignoring return value of ‘write’ declared with attribute ‘warn_unu...
Masatake YAMATO [Thu, 18 May 2023 15:14:21 +0000 (00:14 +0900)] 
test_mkfds: avoid "ignoring return value of ‘write’ declared with attribute ‘warn_unused_result’"

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agotests: (lsfd) add cases for eventfd
Masatake YAMATO [Sat, 11 Mar 2023 05:42:59 +0000 (14:42 +0900)] 
tests: (lsfd) add cases for eventfd

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agotests: (mkfds) add eventfd factory
Masatake YAMATO [Sun, 5 Mar 2023 18:04:13 +0000 (03:04 +0900)] 
tests: (mkfds) add eventfd factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agotests: (mkfds) provide the way to declare the number of extra printing values
Masatake YAMATO [Wed, 8 Mar 2023 12:51:08 +0000 (21:51 +0900)] 
tests: (mkfds) provide the way to declare the number of extra printing values

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agotests: (mkfds) print a whitespace only when the running factory has "report" method
Masatake YAMATO [Tue, 7 Mar 2023 14:09:32 +0000 (23:09 +0900)] 
tests: (mkfds) print a whitespace only when the running factory has "report" method

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: fill ENDPOINTS column for eventfd
Masatake YAMATO [Sat, 4 Mar 2023 05:38:57 +0000 (14:38 +0900)] 
lsfd: fill ENDPOINTS column for eventfd

An example output:

  $ ./lsfd -Q '(TYPE == "eventfd") and (ENDPOINTS =~ ".+") ' -o+ENDPOINTS
  COMMAND          PID USER ASSOC MODE    TYPE       SOURCE MNTID INODE NAME   ENDPOINTS
  pipewire       17251  jet    40  rw- eventfd anon_inodefs    15  1060 id=818 17255,pipewire-pulse,26
  pipewire       17251  jet    52  rw- eventfd anon_inodefs    15  1060 id=695 17255,pipewire-pulse,30
       17255,pipewire-pulse,37
       17255,pipewire-pulse,49
  pipewire       17251  jet    54  rw- eventfd anon_inodefs    15  1060 id=845 17255,pipewire-pulse,31
  pipewire       17251  jet    61  rw- eventfd anon_inodefs    15  1060 id=212 17255,pipewire-pulse,45
  pipewire       17251  jet    62  rw- eventfd anon_inodefs    15  1060 id=224 17255,pipewire-pulse,46
  pipewire-pulse 17255  jet    26  rw- eventfd anon_inodefs    15  1060 id=818 17251,pipewire,40
  pipewire-pulse 17255  jet    30  rw- eventfd anon_inodefs    15  1060 id=695 17251,pipewire,52
       17255,pipewire-pulse,37
       17255,pipewire-pulse,49
  pipewire-pulse 17255  jet    31  rw- eventfd anon_inodefs    15  1060 id=845 17251,pipewire,54
  pipewire-pulse 17255  jet    37  rw- eventfd anon_inodefs    15  1060 id=695 17251,pipewire,52
       17255,pipewire-pulse,30
       17255,pipewire-pulse,49
  pipewire-pulse 17255  jet    45  rw- eventfd anon_inodefs    15  1060 id=212 17251,pipewire,61
  pipewire-pulse 17255  jet    46  rw- eventfd anon_inodefs    15  1060 id=224 17251,pipewire,62
  pipewire-pulse 17255  jet    49  rw- eventfd anon_inodefs    15  1060 id=695 17251,pipewire,52
       17255,pipewire-pulse,30
       17255,pipewire-pulse,37

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: add a helper macro, foreach_endpoint
Masatake YAMATO [Sat, 4 Mar 2023 05:51:33 +0000 (14:51 +0900)] 
lsfd: add a helper macro, foreach_endpoint

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: add a helper function, init_endpoint
Masatake YAMATO [Sat, 4 Mar 2023 05:25:20 +0000 (14:25 +0900)] 
lsfd: add a helper function, init_endpoint

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: add a helper function, add_endpoint
Masatake YAMATO [Sat, 4 Mar 2023 05:16:44 +0000 (14:16 +0900)] 
lsfd: add a helper function, add_endpoint

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: add a helper function, new_ipc
Masatake YAMATO [Sat, 4 Mar 2023 04:37:20 +0000 (13:37 +0900)] 
lsfd: add a helper function, new_ipc

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: add a back pointer as a member of anon_eventfd_data
Masatake YAMATO [Fri, 3 Mar 2023 18:21:33 +0000 (03:21 +0900)] 
lsfd: add a back pointer as a member of anon_eventfd_data

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: move a local variable to a narrower scope
Masatake YAMATO [Fri, 3 Mar 2023 18:17:58 +0000 (03:17 +0900)] 
lsfd: move a local variable to a narrower scope

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: add EVENTFD.ID column
Masatake YAMATO [Fri, 3 Mar 2023 17:28:04 +0000 (02:28 +0900)] 
lsfd: add EVENTFD.ID column

The files under of /proc/$pid/fdinfo/* provide IDs for eventfd files.
With this change, lsfd extacts the IDs. All eventfd files share the
same inode. So the IDs are useful to distinguish two different
envetfds.

An example output:

  $ ./lsfd -Q '(TYPE == "eventfd")' -o+EVENTFD.ID | head
  COMMAND             PID USER ASSOC MODE    TYPE       SOURCE MNTID INODE NAME   EVENTFD.ID
  gnome-session-b   17113  jet     3  rw- eventfd anon_inodefs    15  1060 id=43          43
  gnome-session-b   17113  jet     4  rw- eventfd anon_inodefs    15  1060 id=44          44
  gnome-session-b   17113  jet     6  rw- eventfd anon_inodefs    15  1060 id=158        158
  gnome-session-b   17113  jet     8  rw- eventfd anon_inodefs    15  1060 id=167        167
  at-spi-bus-laun   17160  jet     3  rw- eventfd anon_inodefs    15  1060 id=341        341
  at-spi-bus-laun   17160  jet     4  rw- eventfd anon_inodefs    15  1060 id=342        342
  at-spi-bus-laun   17160  jet     5  rw- eventfd anon_inodefs    15  1060 id=343        343
  at-spi-bus-laun   17160  jet     9  rw- eventfd anon_inodefs    15  1060 id=344        344
  gvfsd             17169  jet     3  rw- eventfd anon_inodefs    15  1060 id=369        369

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: delete redundant parentheses surrounding return value
Masatake YAMATO [Fri, 10 Mar 2023 06:10:11 +0000 (15:10 +0900)] 
lsfd: delete redundant parentheses surrounding return value

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agoldfd: delete unnecessary ';'
Masatake YAMATO [Fri, 3 Mar 2023 17:09:12 +0000 (02:09 +0900)] 
ldfd: delete unnecessary ';'

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agolsfd: choose anon_ops declarative way
Masatake YAMATO [Fri, 3 Mar 2023 15:28:37 +0000 (00:28 +0900)] 
lsfd: choose anon_ops declarative way

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
16 months agobuild-sys: add --disable-waitpid
Frantisek Sumsal [Thu, 18 May 2023 16:56:15 +0000 (18:56 +0200)] 
build-sys: add --disable-waitpid

The new pidfd stuff waitpid uses is not compatible with older kernel
headers, but the rest of the util-linux is still perfectly fine, so
allow disabling just the waitpid utility to make the builds happy again.

16 months agolib/shells: Plug econf memory leak
Tobias Stoeckmann [Thu, 18 May 2023 15:48:46 +0000 (17:48 +0200)] 
lib/shells: Plug econf memory leak

You can see the memory leak with address sanitizer if util-linux is
compiled with `--with-vendordir=/usr/etc`.

How to reproduce:

1. Prepare a custom shell file as root
```
mkdir -p /etc/shells.d
echo /bin/myshell > /etc/shells.d/custom
```

2. Run chsh as regular user
```
chsh
```

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
16 months agolib/caputils: fix integer handling issues [coverity scan]
Karel Zak [Thu, 18 May 2023 08:26:02 +0000 (10:26 +0200)] 
lib/caputils: fix integer handling issues [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
16 months agomesg.1 cleanups/updates
наб [Sun, 14 May 2023 23:19:58 +0000 (01:19 +0200)] 
mesg.1 cleanups/updates

First hunk:  grammar.
Second hunk: (a) mentioning BSD ptys and not UNIX98 ones is odd,
             (b) mentioning /only/ ptys is odder still.
Third hunk:  mesg is found in the UNIX Programmer's Manual;
             it takes its modern form in V7
             (it's unclear to me why V6 specifically is mentioned,
              since it's still default-invert + always-report-"was X").

16 months agoMerge branch 'nsenter-keep-caps' of https://github.com/dgibson/util-linux
Karel Zak [Wed, 17 May 2023 11:43:40 +0000 (13:43 +0200)] 
Merge branch 'nsenter-keep-caps' of https://github.com/dgibson/util-linux

* 'nsenter-keep-caps' of https://github.com/dgibson/util-linux:
  Add --keep-caps option to nsenter, similar to the one in unshare
  unshare: Move implementation of --keep-caps option to library function

16 months agoMerge branch 'libmount/syscall'
Karel Zak [Wed, 17 May 2023 11:42:01 +0000 (13:42 +0200)] 
Merge branch 'libmount/syscall'