]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
9 months agoMerge branch 'logind' of https://github.com/thkukuk/util-linux
Karel Zak [Wed, 16 Aug 2023 07:29:50 +0000 (09:29 +0200)] 
Merge branch 'logind' of https://github.com/thkukuk/util-linux

* 'logind' of https://github.com/thkukuk/util-linux:
  write: query logind for list of users with tty (#2088)
  agetty: use sd_get_sessions() for number of users (#2088)
  wall: query logind for list of users with tty (#2088)

9 months agoMerge branch 'enosys/ioctl' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 16 Aug 2023 07:23:01 +0000 (09:23 +0200)] 
Merge branch 'enosys/ioctl' of https://github.com/t-8ch/util-linux

* 'enosys/ioctl' of https://github.com/t-8ch/util-linux:
  enosys: avoid warnings when no aliases are found
  enosys: don't validate that numbers are found from headers
  enosys: add support for ioctl blocking
  enosys: store blocked syscalls in list instead of array
  enosys: build BPF dynamically
  enosys: list syscall numbers

9 months agoMerge branch 'libblkid/limit-buffer' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 16 Aug 2023 07:00:21 +0000 (09:00 +0200)] 
Merge branch 'libblkid/limit-buffer' of https://github.com/t-8ch/util-linux

* 'libblkid/limit-buffer' of https://github.com/t-8ch/util-linux:
  libblkid: limit read buffer size

9 months agoMerge branch 'PR/losetup-mode-cleanup'
Karel Zak [Wed, 16 Aug 2023 06:57:37 +0000 (08:57 +0200)] 
Merge branch 'PR/losetup-mode-cleanup'

9 months agoMerge branch 'feat-riscv64' of https://github.com/michalbiesek/util-linux
Karel Zak [Wed, 16 Aug 2023 06:56:38 +0000 (08:56 +0200)] 
Merge branch 'feat-riscv64' of https://github.com/michalbiesek/util-linux

* 'feat-riscv64' of https://github.com/michalbiesek/util-linux:
  setarch: add riscv64/riscv32 support

9 months agolibblkid: limit read buffer size
Thomas Weißschuh [Tue, 15 Aug 2023 19:25:44 +0000 (21:25 +0200)] 
libblkid: limit read buffer size

Many probers read data from disk bounded by some field from the probed
disk itself.
The probers should validate the read length before using.
Add a fallback that kicks in when the proper does not check the length
epxlicitly.

See #2427
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
9 months agolosetup: cleanup device node modes
Karel Zak [Tue, 15 Aug 2023 10:32:49 +0000 (12:32 +0200)] 
losetup: cleanup device node modes

The current code follows ro/rw mode not only set mode of the new
device, but also to open the device node for ioctls.

Linux kernel does not care and it seems O_RDONLY is good enough
for all cases (ioctls).

Unfortunately, udevd is sensitive as it monitors devices by inotify
and IN_CLOSE_WRITE event is expected to apply udev rules for the
device.

Changes:

* remove LOOPDEV_FL_{RDONLY,RDWR} private flags, it's too complex and
  unnecessary

* use mode_t for open() modes (rater than int)

* re-open only if O_RDWR requested otherwise default to O_RDONLY

* make sure O_RDWR is used on device setup

Fixes: https://github.com/util-linux/util-linux/issues/2434
Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agogithub: check apt-cache in more robust way (v2)
Masatake YAMATO [Tue, 15 Aug 2023 11:51:23 +0000 (20:51 +0900)] 
github: check apt-cache in more robust way (v2)

The original change (86d5c4dbf6e62c52fe9295f4e55eb629d8e26cfb) didn't
consider "set -e" at the beginning of the script.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 months agoRevert "tools/all_syscalls: use sh and replace awk with grep & sed"
Karel Zak [Tue, 15 Aug 2023 11:12:16 +0000 (13:12 +0200)] 
Revert "tools/all_syscalls: use sh and replace awk with grep & sed"

This reverts commit a01065546d9613ffc9835398f56756f08a0193be.

9 months agoRevert "tools/all_syscalls: use pipefail"
Karel Zak [Tue, 15 Aug 2023 10:49:20 +0000 (12:49 +0200)] 
Revert "tools/all_syscalls: use pipefail"

Our CI don't like it.

See also old http://github.com/util-linux/util-linux/commit/fffe5f7c72121c054645c60c0bb49f653bb7142e

This reverts commit d53a1529bd79077a8e7232651f99f20890283c0c.

9 months agosetarch: add PER_LINUX_FDPIC fallback
Karel Zak [Tue, 15 Aug 2023 09:33:31 +0000 (11:33 +0200)] 
setarch: add PER_LINUX_FDPIC fallback

Fixes: https://github.com/util-linux/util-linux/issues/2436
Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agoMerge branch 'PR/libblkid-fix-topology-64vs32' of github.com:karelzak/util-linux...
Karel Zak [Tue, 15 Aug 2023 09:05:20 +0000 (11:05 +0200)] 
Merge branch 'PR/libblkid-fix-topology-64vs32' of github.com:karelzak/util-linux-work

* 'PR/libblkid-fix-topology-64vs32' of github.com:karelzak/util-linux-work:
  libblkid: fix topology chain types mismatch

9 months agogithub: check apt-cache in more robust way
Karel Zak [Tue, 15 Aug 2023 09:02:43 +0000 (11:02 +0200)] 
github: check apt-cache in more robust way

Reported-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agosetarch: add riscv64/riscv32 support
Michal Biesek [Mon, 14 Aug 2023 00:37:45 +0000 (02:37 +0200)] 
setarch: add riscv64/riscv32 support

Signed-off-by: Michal Biesek <michalbiesek@gmail.com>
9 months agoMerge branch 'master' of https://github.com/apprehensions/util-linux
Karel Zak [Mon, 14 Aug 2023 11:09:51 +0000 (13:09 +0200)] 
Merge branch 'master' of https://github.com/apprehensions/util-linux

* 'master' of https://github.com/apprehensions/util-linux:
  tools/all_syscalls: use pipefail
  meson: run tests if with option program-tests
  meson: use meson features instead of bash
  tools/all_syscalls: use sh and replace awk with grep & sed

9 months agolibblkid: fix topology chain types mismatch
Karel Zak [Mon, 14 Aug 2023 10:31:48 +0000 (12:31 +0200)] 
libblkid: fix topology chain types mismatch

Reported-by: https://github.com/util-linux/util-linux/pull/2430
References: https://github.com/util-linux/util-linux/commit/3ab9e699a8d90f55e0447516b7e05a8686180467
Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agoMerge branch 'verity' of https://github.com/bluca/util-linux
Karel Zak [Mon, 14 Aug 2023 10:02:47 +0000 (12:02 +0200)] 
Merge branch 'verity' of https://github.com/bluca/util-linux

* 'verity' of https://github.com/bluca/util-linux:
  verity: modernize example in manpage
  verity: use <roothash>-verity as the device mapper name instead of libmnt_<image>

9 months agoMerge branch 'fincore/noheader' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 14 Aug 2023 09:48:19 +0000 (11:48 +0200)] 
Merge branch 'fincore/noheader' of https://github.com/t-8ch/util-linux

* 'fincore/noheader' of https://github.com/t-8ch/util-linux:
  fincore: (tests) adapt alternative testcases to new header format

10 months agoverity: modernize example in manpage
Luca Boccassi [Thu, 10 Aug 2023 23:19:16 +0000 (00:19 +0100)] 
verity: modernize example in manpage

These days it's no longer necessary to create the verity hash device
with dd, and to transcribe the roothash by hand. Update the example,
also using the file extensions that are used by systemd for verity
autodiscovery (e.g.: RootImage=img.raw will automatically use
img.verity and img.roothash from the same directory, if present).

Signed-off-by: Luca Boccassi <bluca@debian.org>
10 months agoverity: use <roothash>-verity as the device mapper name instead of libmnt_<image>
Luca Boccassi [Thu, 10 Aug 2023 23:18:22 +0000 (00:18 +0100)] 
verity: use <roothash>-verity as the device mapper name instead of libmnt_<image>

If the roothash is the same among two volumes, then the images are guaranteed
to be equivalent. The filename of the image on the other hand does not imply
that the images are equivalent.
In systemd we open verity devices as '<roothash>-verity', so that we know for
sure we can reuse them. Do the same here, so that we are a bit more confident
that images can be reused before the safety check, and also so that we can
take advantage of the kernel refcounting together with images used by systemd,
as setting up verity is expensive.

Signed-off-by: Luca Boccassi <bluca@debian.org>
10 months agoeject: (tests) don't write mount hint to terminal
Karel Zak [Thu, 10 Aug 2023 09:13:47 +0000 (11:13 +0200)] 
eject: (tests) don't write mount hint to terminal

References: 4b9e3937966f7ddf90e6013c87f73c260963b0ea
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agouuidd: enable cont-clock in service file
Karel Zak [Wed, 9 Aug 2023 11:12:34 +0000 (13:12 +0200)] 
uuidd: enable cont-clock in service file

Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agouuidd: improve man page for -cont-clock
Karel Zak [Wed, 9 Aug 2023 10:56:42 +0000 (12:56 +0200)] 
uuidd: improve man page for -cont-clock

Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agoenosys: fix build on hppa
John David Anglin [Mon, 7 Aug 2023 15:37:17 +0000 (15:37 +0000)] 
enosys: fix build on hppa

The following patch fixes the definition of SECCOMP_ARCH_NATIVE
on hppa.

Signed-off-by: John David Anglin <dave.anglin@bell.net>
10 months agozramctl: add hint about supported algorithms
Karel Zak [Wed, 9 Aug 2023 09:26:28 +0000 (11:26 +0200)] 
zramctl: add hint about supported algorithms

It seems the current list of the algorithms is confusing for
end-users, because it's inaccurate in many cases. Let's explain why
the list cannot be "perfect".

Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2203324
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agofincore: (tests) adapt alternative testcases to new header format
Thomas Weißschuh [Tue, 8 Aug 2023 20:07:43 +0000 (22:07 +0200)] 
fincore: (tests) adapt alternative testcases to new header format

For #2380 the testcases for 4k pages were adapted to the new output
format, but the other testcases were missed.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agotools/all_syscalls: use pipefail
sewn [Tue, 8 Aug 2023 08:50:10 +0000 (11:50 +0300)] 
tools/all_syscalls: use pipefail

10 months agomeson: properly handle gettext non-existence
Thomas Weißschuh [Sat, 5 Aug 2023 06:57:28 +0000 (08:57 +0200)] 
meson: properly handle gettext non-existence

Commit e91a49c9747f ("meson: don't build po if no gettext")
tried to add the possibility to build util-linux without gettext.

Unfortunately by default the call to find_program() would abort the
build if the program is not found.
Avoid aborting the build.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agolsclocks: remove unused code
Karel Zak [Thu, 3 Aug 2023 11:46:32 +0000 (13:46 +0200)] 
lsclocks: remove unused code

Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agomeson: check for HAVE_STRUCT_STATX_STX_MNT_ID
Karel Zak [Thu, 3 Aug 2023 11:39:32 +0000 (13:39 +0200)] 
meson: check for HAVE_STRUCT_STATX_STX_MNT_ID

References: c0136ac0c98b18208508fbcfac31a843e0bb8a37
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agoMerge branch 'meson/check-mount' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 3 Aug 2023 11:35:09 +0000 (13:35 +0200)] 
Merge branch 'meson/check-mount' of https://github.com/t-8ch/util-linux

* 'meson/check-mount' of https://github.com/t-8ch/util-linux:
  meson: add check for struct statx
  meson: add check for linux/mount.h

10 months agolibmount: improve EPERM interpretation
Karel Zak [Thu, 3 Aug 2023 11:06:30 +0000 (13:06 +0200)] 
libmount: improve EPERM interpretation

In some cases mount(2)/open_tree(2) returns EPERM for root user. In
this case libmount reports it as "mount point is not a directory".

It does not makes sense for bind mount where target could be a
regular file.

This patch is not ideal, the error handler is generic, but semantic
for new mount API and mount(2) is different. For example now it checks
for regular file, but the new API supports bind over symlinks, so
proper fix will require lstat() and S_ISLNK(), etc. We need to move
error messages to hook_mount.c and mount_mount_legacy.c to make it
more specific.

Fixes: https://github.com/util-linux/util-linux/issues/2413
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agolibmount: ifdef statx() call
Karel Zak [Thu, 3 Aug 2023 10:39:19 +0000 (12:39 +0200)] 
libmount: ifdef statx() call

In this case the statx() is use to get mount ID. It's optional and not
required. Let's #ifdef the statx() call and also check for stx_mnt_id
struct member.

Fixes: https://github.com/util-linux/util-linux/issues/2415
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agomeson: add check for struct statx
Thomas Weißschuh [Thu, 3 Aug 2023 10:22:29 +0000 (12:22 +0200)] 
meson: add check for struct statx

meson variant of commit 1fc3471dfb8b ("libmount: check for struct statx").

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agomeson: add check for linux/mount.h
Thomas Weißschuh [Thu, 3 Aug 2023 10:18:41 +0000 (12:18 +0200)] 
meson: add check for linux/mount.h

meson variant of commit 5502e73d8f82 ("libmount: check for linux/mount.h").

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agoMerge branch 'bug911336' of https://github.com/floppym/util-linux
Karel Zak [Thu, 3 Aug 2023 10:11:06 +0000 (12:11 +0200)] 
Merge branch 'bug911336' of https://github.com/floppym/util-linux

* 'bug911336' of https://github.com/floppym/util-linux:
  wall: do not error for ttys that do not exist

10 months agoMerge branch 'highsierra' of https://github.com/pali/util-linux
Karel Zak [Thu, 3 Aug 2023 10:09:29 +0000 (12:09 +0200)] 
Merge branch 'highsierra' of https://github.com/pali/util-linux

* 'highsierra' of https://github.com/pali/util-linux:
  libblkid: iso9660: Implement full High Sierra CDROM format support
  libblkid: iso9660: Define all fields in iso_volume_descriptor according to ECMA-119 4th edition spec

10 months agoMerge branch 'mkfds--INET-alter-the-ports' of https://github.com/masatake/util-linux
Karel Zak [Thu, 3 Aug 2023 10:08:43 +0000 (12:08 +0200)] 
Merge branch 'mkfds--INET-alter-the-ports' of https://github.com/masatake/util-linux

* 'mkfds--INET-alter-the-ports' of https://github.com/masatake/util-linux:
  tests: (lsfd::mkfds-*) alter the L4 ports for avoiding the conflict with option-inet test case

10 months agoMerge branch 'tests--TESTS_COMPONENTS' of https://github.com/masatake/util-linux
Karel Zak [Thu, 3 Aug 2023 10:07:55 +0000 (12:07 +0200)] 
Merge branch 'tests--TESTS_COMPONENTS' of https://github.com/masatake/util-linux

* 'tests--TESTS_COMPONENTS' of https://github.com/masatake/util-linux:
  tests,autotools: add TESTS_COMPONENTS macro for specfying test components from make cmdline

10 months agoMerge branch 'lsfds--dont-run-unix-stream-test-on-qemu-user' of https://github.com...
Karel Zak [Thu, 3 Aug 2023 10:07:33 +0000 (12:07 +0200)] 
Merge branch 'lsfds--dont-run-unix-stream-test-on-qemu-user' of https://github.com/masatake/util-linux

* 'lsfds--dont-run-unix-stream-test-on-qemu-user' of https://github.com/masatake/util-linux:
  tests: (lsfd) don't run the unix-stream testcase including newlines in the path on qemu-user
  lsfd: (refactor) unify the invocations of  sysfs_get_byteorder()

10 months agoMerge branch 'lsclocks/rtc' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 3 Aug 2023 10:06:24 +0000 (12:06 +0200)] 
Merge branch 'lsclocks/rtc' of https://github.com/t-8ch/util-linux

* 'lsclocks/rtc' of https://github.com/t-8ch/util-linux:
  lsclocks: add support for RTC
  lsclocks: factor out path based clocks

10 months agoinclude: define pidfd syscalls if needed
Markus Mayer [Tue, 1 Aug 2023 20:08:24 +0000 (13:08 -0700)] 
include: define pidfd syscalls if needed

If the kernel headers are too old to provide the pidfd syscall numbers,
let's define them ourselves. This can be helpful while cross-compiling.
The runtime environment may provide a kernel that is new enough to
handle the calls, even if the toolchain doesn't.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
10 months agolibmount: check for struct statx
Markus Mayer [Tue, 1 Aug 2023 19:59:27 +0000 (12:59 -0700)] 
libmount: check for struct statx

Let's ensure struct statx exists before we try to use it. Checking for
the existence of linux/stat.h is not sufficient. This is because
[uapi/]linux/stat.h has existed since Linux 3.7, however struct statx
was only introduced with Linux 4.11.

The problem arises if one happens ot be using kernel headers from within
the aforementioned range, such as Linux 4.9.

  CC       libmount/src/la-utils.lo
In file included from libmount/src/utils.c:31:
./include/fileutils.h:100:33: warning: declaration of 'struct statx' will not
be visible outside of this function [-Wvisibility]
                    unsigned int mask, struct statx *stx)
                                              ^
libmount/src/utils.c:117:16: error: variable has incomplete type 'struct statx'
                struct statx stx = { 0 };
                             ^
libmount/src/utils.c:117:10: note: forward declaration of 'struct statx'
                struct statx stx = { 0 };
                       ^
libmount/src/utils.c:125:5: error: use of undeclared identifier 'STATX_TYPE'
                                STATX_TYPE
                                ^
libmount/src/utils.c:126:8: error: use of undeclared identifier 'STATX_MODE'
                                        | STATX_MODE
                                          ^
libmount/src/utils.c:127:8: error: use of undeclared identifier 'STATX_INO'
                                        | STATX_INO,
                                          ^
1 warning and 4 errors generated.
make[4]: *** [Makefile:11269: libmount/src/la-utils.lo] Error 1

Checking for the presence of struct statx explicitly avoids this
problem.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
10 months agolibmount: check for linux/mount.h
Markus Mayer [Tue, 1 Aug 2023 19:59:26 +0000 (12:59 -0700)] 
libmount: check for linux/mount.h

Check that linux/mount.h is present before using features that rely on
it.

It is necessary to check for the presence of linux/mount.h explicitly.
Simply relying on the presence of several syscalls (e.g. SYS_move_mount,
SYS_open_tree) does not work reliably, at least not in a cross-compiling
environment.

The syscall definitions are provided by the C library. Meanwhile,
linux/mount.h is provided by the kernel. This opens the possibility for
discrepancies.

A problem arises if the C library (e.g. musl-1.2.3) defines all "mount
fd API" syscalls (and HAVE_MOUNTFD_API becomes true), but the kernel
headers are old enough to not provide linux/mount.h. The resulting error
looks as follows. This example is using an LLVM-13 cross-compiler from
x86_64 to aarch64 with musl-1.2.3 as the C library.

  CC       libmount/src/la-hooks.lo
In file included from libmount/src/hooks.c:30:
./include/mount-api-utils.h:11:10: fatal error: 'linux/mount.h' file not found
         ^~~~~~~~~~~~~~~
1 error generated.
make[4]: *** [Makefile:11185: libmount/src/la-hooks.lo] Error 1

To prevent this condition, we add a check to configure that will test
for the presence of linux/mount.h in addition to testing for the mount
fd API. Only if both conditions are met can we actually use the mount
fd API.

Signed-off-by: Markus Mayer <mmayer@broadcom.com>
10 months agoMerge branch 'mount/statx-enosys' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 3 Aug 2023 10:01:49 +0000 (12:01 +0200)] 
Merge branch 'mount/statx-enosys' of https://github.com/t-8ch/util-linux

* 'mount/statx-enosys' of https://github.com/t-8ch/util-linux:
  libmount: (utils) fix statx fallback

10 months agoMerge branch 'PR/libmount-fake' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 3 Aug 2023 10:00:43 +0000 (12:00 +0200)] 
Merge branch 'PR/libmount-fake' of github.com:karelzak/util-linux-work

* 'PR/libmount-fake' of github.com:karelzak/util-linux-work:
  libmount: cleanup --fake mode

10 months agolibmount: don't canonicalize symlinks for bind operation
Karel Zak [Thu, 3 Aug 2023 09:43:28 +0000 (11:43 +0200)] 
libmount: don't canonicalize symlinks for bind operation

The new kernel mount API can bind over symlink by default.

Unfortunately, libmount always canonicalizes all paths (due to
backward compatibility, search in mountinfo, search in fstab, etc.).

Possible workaround is -c, --no-canonicalize but it disable all paths
canonicalization, tags to paths conversions etc.

This patch disables the canonicalization only for the target path
(if symlink) on bind operation.

Fixes: https://github.com/util-linux/util-linux/issues/2370
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agolibmount: (utils) fix statx fallback
Thomas Weißschuh [Thu, 3 Aug 2023 05:13:28 +0000 (07:13 +0200)] 
libmount: (utils) fix statx fallback

If the systemcall is not available ENOSYS is returned.

Under glibc the statx implementation also has its own fallback logic.
As AT_STATX_DONT_SYNC can't be implemented correctly in that fallback
logic the wrapper will return EINVAL in case the emulation is needed and
AT_STATX_DONT_SYNC is set.
So also use our own fallback in that case.

Fixes: #2409
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agowall: do not error for ttys that do not exist
Mike Gilbert [Sat, 29 Jul 2023 21:32:57 +0000 (17:32 -0400)] 
wall: do not error for ttys that do not exist

Some wayland display managers (GDM) put strings like "seat0" in the
ut_line field of utmp entries. These are not valid tty devices.

Avoid writing a confusing error message for ttys that do not exist.

Bug: https://bugs.gentoo.org/911336
Signed-off-by: Mike Gilbert <floppym@gentoo.org>
10 months agolsclocks: add support for RTC
Thomas Weißschuh [Tue, 11 Jul 2023 19:01:05 +0000 (21:01 +0200)] 
lsclocks: add support for RTC

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agolsclocks: factor out path based clocks
Thomas Weißschuh [Tue, 11 Jul 2023 18:33:41 +0000 (20:33 +0200)] 
lsclocks: factor out path based clocks

They will also be used by the RTC implementation.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agocolumn: fix -l
Karel Zak [Wed, 2 Aug 2023 10:57:37 +0000 (12:57 +0200)] 
column: fix -l

The original implementation is complicated and broken.

It's possible to calculate the rest of the string (for the last
column) from the current position rather than calculate it
continuously. Use the last wcstok() result also means that it will
work as expected independently on "greedy" mode (skips repeating
separators.

 # printf 'a   b c d\n1 2 3 4\n' | ./column -t -o '|' -l3
 a|b|c d
 1|2|3 4

(see space between 'a' and 'b' on input)

References: 8ac75e31de0ece74515e98e0b22e54cc0a9808bd
Fixes: https://github.com/util-linux/util-linux/issues/1763
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agolibblkid: iso9660: Implement full High Sierra CDROM format support
Pali Rohár [Tue, 1 Aug 2023 21:09:52 +0000 (23:09 +0200)] 
libblkid: iso9660: Implement full High Sierra CDROM format support

Specification of High Sierra CDROM format was lost for a longer time, but
now was found again. So this change improves parsing High Sierra CDROM
images and implements everything which is already supported for ISO9660.

High Sierra and ISO9660 are very similar and there are only few differences
in headers. Most visible is that High Sierra has additional 8 bytes at
beginning of each descriptor with Volume Descriptor LBN value, it has more
locations of path table occurrences in Volume descriptor, has shorten
copyright and abstract file ids, bibliographic file id is missing, standard
version is 0 and it does not have timezone offset field in date structure.
Thus positions of some fields are different between High Sierra and ISO9960.

Code in iso9660.c is adjusted to handle both formats, instead implementing
two very similar parsers.

CDROM image of Microsoft Programmers Library 1.0 (MSPL10) from 1988, which
is in High Sierra format, was before this change parsed as:

ID_FS_BLOCK_SIZE=2048
ID_FS_VERSION=High\x20Sierra
ID_FS_LABEL=MS_PL_VERSION_100
ID_FS_LABEL_ENC=MS_PL_VERSION_100
ID_FS_TYPE=iso9660
ID_FS_USAGE=filesystem

And after this change as:

ID_FS_FSBLOCKSIZE=2048
ID_FS_BLOCK_SIZE=2048
ID_FS_FSSIZE=542998528
ID_FS_PUBLISHER_ID=MICROSOFTCORPORATION16011NE36THWAYREDMONDWA98073
ID_FS_DATA_PREPARER_ID=MERIDIAN_DATA_CD_PUBLISHER
ID_FS_APPLICATION_ID=PL
ID_FS_UUID=1988-07-12-00-37-37-00
ID_FS_UUID_ENC=1988-07-12-00-37-37-00
ID_FS_VERSION=High\x20Sierra
ID_FS_LABEL=MS_PL_VERSION_100
ID_FS_LABEL_ENC=MS_PL_VERSION_100
ID_FS_TYPE=iso9660
ID_FS_USAGE=filesystem

Scan of original hardcopy High Sierra specification:
https://www.os2museum.com/files/docs/cdrom/CDROM_Working_Paper-1986.pdf

HTML version of High Sierra specification:
https://www.os2museum.com/files/docs/cdrom/hsg_wp.html

Archived hardcopy of High Sierra specification:
https://archive.org/details/cdrom-working-paper-1986

Story behind Looking for High Sierra:
https://www.os2museum.com/wp/looking-for-high-sierra/

10 months agolibblkid: iso9660: Define all fields in iso_volume_descriptor according to ECMA-119...
Pali Rohár [Tue, 1 Aug 2023 20:17:10 +0000 (22:17 +0200)] 
libblkid: iso9660: Define all fields in iso_volume_descriptor according to ECMA-119 4th edition spec

10 months agotests,autotools: add TESTS_COMPONENTS macro for specfying test components from make...
Masatake YAMATO [Tue, 1 Aug 2023 17:12:02 +0000 (02:12 +0900)] 
tests,autotools: add TESTS_COMPONENTS macro for specfying test components from make cmdline

An example cmdline:

$ make check TESTS_COMPONENTS=lsfd

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
10 months agotests: (lsfd::mkfds-*) alter the L4 ports for avoiding the conflict with option-inet...
Masatake YAMATO [Tue, 1 Aug 2023 16:50:38 +0000 (01:50 +0900)] 
tests: (lsfd::mkfds-*) alter the L4 ports for avoiding the conflict with option-inet test case

Close #2397

The conflict appears in parallel execution.
This change just mitigates the original issue.
An ideal solution is that finding unused ports if bind(2) is failed.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
10 months agotests: (lsfd) don't run the unix-stream testcase including newlines in the path on...
Masatake YAMATO [Tue, 1 Aug 2023 16:06:40 +0000 (01:06 +0900)] 
tests: (lsfd) don't run the unix-stream testcase including newlines in the path on qemu-user

Close #2402.

The communication code for retrieving unix socket information doesn't
consider the byteorder now.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
10 months agolsfd: (refactor) unify the invocations of sysfs_get_byteorder()
Masatake YAMATO [Tue, 1 Aug 2023 15:53:46 +0000 (00:53 +0900)] 
lsfd: (refactor) unify the invocations of  sysfs_get_byteorder()

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
10 months agolscpu: Even more Arm part numbers (early 2023)
Jeremy Linton [Wed, 26 Jul 2023 20:54:20 +0000 (15:54 -0500)] 
lscpu: Even more Arm part numbers (early 2023)

There have been further MIDR/part numbers published
on https://developer.arm.com, they include:

Cortex-X4, Cortex-A520, Cortex-A720, Cortex-M85,
Cortex-M55 and Cortex-R52+.

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
10 months agolibmount: cleanup --fake mode
Karel Zak [Tue, 1 Aug 2023 12:49:48 +0000 (14:49 +0200)] 
libmount: cleanup --fake mode

It was originally designed to play nasty games with /etc/mtab (mount
when /etc is read-only and update later when it's write-able).

The --fake is completely useless with the new API due to complexity
where we cannot skip any step, because the next stuff depends on it.
So, it makes more sense skip all functionality where libmount does
anything significant.

This commit add --fake check to hooks logic to skip all hooks as the
hooks are place where libmount implements mount related invasive
operations (create mountpoint, namespaces, create superblock, move,
mount, etc.).

Frankly, --fake without mtab is useless.

Fixes: https://github.com/util-linux/util-linux/issues/2395
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agoMerge branch 'lsfd--fix-2399-use-fifo-in-test-cases' of https://github.com/masatake...
Karel Zak [Tue, 1 Aug 2023 08:43:59 +0000 (10:43 +0200)] 
Merge branch 'lsfd--fix-2399-use-fifo-in-test-cases' of https://github.com/masatake/util-linux

* 'lsfd--fix-2399-use-fifo-in-test-cases' of https://github.com/masatake/util-linux:
  tests: (lsfd::option-inet) get child-processes' pids via fifo

10 months agoMerge branch 'cachestat' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 1 Aug 2023 08:42:06 +0000 (10:42 +0200)] 
Merge branch 'cachestat' of https://github.com/t-8ch/util-linux

* 'cachestat' of https://github.com/t-8ch/util-linux:
  fincore: report data from cachestat()
  fincore: refactor output formatting
  fincore: add --output-all

10 months agofincore: report data from cachestat()
Thomas Weißschuh [Mon, 31 Jul 2023 16:00:11 +0000 (18:00 +0200)] 
fincore: report data from cachestat()

The cachestat() syscall was introduced in Linux 6.5 and reports data
that complements that from mincore().

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agofincore: refactor output formatting
Thomas Weißschuh [Mon, 31 Jul 2023 16:00:08 +0000 (18:00 +0200)] 
fincore: refactor output formatting

This will make the upcoming addition of cachestat() columns nicer.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agofincore: add --output-all
Thomas Weißschuh [Mon, 31 Jul 2023 16:00:05 +0000 (18:00 +0200)] 
fincore: add --output-all

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agolsclocks: add support for cpu clocks
Thomas Weißschuh [Mon, 31 Jul 2023 15:49:11 +0000 (17:49 +0200)] 
lsclocks: add support for cpu clocks

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agolsclocks: improve dynamic clocks docs and completion
Thomas Weißschuh [Mon, 31 Jul 2023 15:49:07 +0000 (17:49 +0200)] 
lsclocks: improve dynamic clocks docs and completion

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agolsclocks: don't fail without dynamic clocks
Thomas Weißschuh [Mon, 31 Jul 2023 15:49:04 +0000 (17:49 +0200)] 
lsclocks: don't fail without dynamic clocks

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agotests: (lsfd::option-inet) get child-processes' pids via fifo
Masatake YAMATO [Mon, 31 Jul 2023 11:32:18 +0000 (20:32 +0900)] 
tests: (lsfd::option-inet) get child-processes' pids via fifo

Close #2399.

The original code assumes the background processes prepare sockets enough
fast. #2399 showed the assumption was wrong; lsfd reported half-cooked
sockets.

To avoid the timing issue, the test case with this change uses a fifo
to receive pids from the child test_mkfds processes. test_mkfds reports
its pid after cooking the sockets. When the option-inet script recives the pid,
we can expect the sockets are ready.

Note: bash's coproc cannot be used here; it supports only one co-process at
once.

Analysed-by: Alexander Kanavin <alex.kanavin@gmail.com>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
10 months agoMerge branch 'fincore-test' of https://github.com/zeha/util-linux
Karel Zak [Mon, 31 Jul 2023 10:44:17 +0000 (12:44 +0200)] 
Merge branch 'fincore-test' of https://github.com/zeha/util-linux

* 'fincore-test' of https://github.com/zeha/util-linux:
  fincore: (tests) fix double log output

10 months agochrt: (man) add note about --sched-period lower limit
Karel Zak [Mon, 31 Jul 2023 10:41:39 +0000 (12:41 +0200)] 
chrt: (man) add note about --sched-period lower limit

References: https://github.com/util-linux/util-linux/pull/2393
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agoMerge branch 'chrt/fixes' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 31 Jul 2023 10:31:35 +0000 (12:31 +0200)] 
Merge branch 'chrt/fixes' of https://github.com/t-8ch/util-linux

* 'chrt/fixes' of https://github.com/t-8ch/util-linux:
  ci: (codeql) ignore cpp/uncontrolled-process-operation
  chrt: allow option separator
  chrt: (tests) don't mark tests as known failed
  chrt: (tests) increase deadline test parameters

10 months agoMerge branch 'lsfd--handle-newline-in-unix-socket-path' of https://github.com/masatak...
Karel Zak [Mon, 31 Jul 2023 10:29:01 +0000 (12:29 +0200)] 
Merge branch 'lsfd--handle-newline-in-unix-socket-path' of https://github.com/masatake/util-linux

* 'lsfd--handle-newline-in-unix-socket-path' of https://github.com/masatake/util-linux:
  lsfd: (test) add a case for testing a unix socket including newline characters in its path name
  lsfd: re-fill unix socket paths with sockdiag netlink interface
  lsfd: add comment listing functions names importing via #include
  lsfd: include common headers in lsfd.h
  lsfd: include system header files first
  lsfd: fix a misleading parameter name
  lsfd: add const modifier

10 months agoMerge branch 'lsfd--bpf-prog' of https://github.com/masatake/util-linux
Karel Zak [Mon, 31 Jul 2023 10:13:24 +0000 (12:13 +0200)] 
Merge branch 'lsfd--bpf-prog' of https://github.com/masatake/util-linux

* 'lsfd--bpf-prog' of https://github.com/masatake/util-linux:
  test: (lsfd) add a case for testing BPF-PROG.TYPE and BPF-PROG.TYPE.RAW columns
  test: (mkfds::bpf-prog) new factory
  lsfd: add BPF-PROG.TYPE, BPF-PROG.TYPE.RAW, and BPF-PROG.ID columns

10 months agoMerge branch 'last-reboot-crash-reporting' of https://github.com/troyrollo/util-linux
Karel Zak [Mon, 31 Jul 2023 10:10:26 +0000 (12:10 +0200)] 
Merge branch 'last-reboot-crash-reporting' of https://github.com/troyrollo/util-linux

* 'last-reboot-crash-reporting' of https://github.com/troyrollo/util-linux:
  login-utils: Report crashes on reboot lines insted of overlapping uptimes

10 months agoMerge branch 'fincore-block' of https://github.com/dancerj/util-linux
Karel Zak [Mon, 31 Jul 2023 09:48:37 +0000 (11:48 +0200)] 
Merge branch 'fincore-block' of https://github.com/dancerj/util-linux

* 'fincore-block' of https://github.com/dancerj/util-linux:
  iterate according to review comments.
  Support device files.

10 months agofincore: (tests) fix double log output
Chris Hofstaedtler [Tue, 18 Jul 2023 21:34:51 +0000 (23:34 +0200)] 
fincore: (tests) fix double log output

The fincore tests call ts_log_both inside an output redirection of both stdout
and stderr, leading to the ts_log_both output ending up twice in both stdout
and stderr.
Call ts_log_both before setting up the output redirection.

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
10 months agomeson: run tests if with option program-tests
sewn [Sat, 29 Jul 2023 04:15:50 +0000 (07:15 +0300)] 
meson: run tests if with option program-tests

10 months agomeson: use meson features instead of bash
sewn [Sat, 29 Jul 2023 02:50:41 +0000 (05:50 +0300)] 
meson: use meson features instead of bash

10 months agotools/all_syscalls: use sh and replace awk with grep & sed
sewn [Sat, 29 Jul 2023 02:19:53 +0000 (05:19 +0300)] 
tools/all_syscalls: use sh and replace awk with grep & sed

using sh removes the bash dependencies, for those who don't have
bash on their system, and replaced the GNU awk with a portable
grep and sed.

10 months agoci: (codeql) ignore cpp/uncontrolled-process-operation
Thomas Weißschuh [Thu, 27 Jul 2023 05:21:02 +0000 (07:21 +0200)] 
ci: (codeql) ignore cpp/uncontrolled-process-operation

In the context of util-linux these are mostly false positives.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agochrt: allow option separator
Thomas Weißschuh [Wed, 26 Jul 2023 14:33:09 +0000 (16:33 +0200)] 
chrt: allow option separator

Allow the option separator "--".
It works in other, similar tools like nice and ionice.

Example:

chrt 1 -- id

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agochrt: (tests) don't mark tests as known failed
Thomas Weißschuh [Wed, 26 Jul 2023 14:33:05 +0000 (16:33 +0200)] 
chrt: (tests) don't mark tests as known failed

The broken CI platform is not used anymore.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agochrt: (tests) increase deadline test parameters
Thomas Weißschuh [Wed, 26 Jul 2023 14:32:59 +0000 (16:32 +0200)] 
chrt: (tests) increase deadline test parameters

Since kernel commit
b4098bfc5efb ("sched/deadline: Impose global limits on sched_attr::sched_period")
the value for dl_period has a lower bound of 100us.
Adjust the test parameters so the test can work on newer kernels.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agolsfd: (test) add a case for testing a unix socket including newline characters in...
Masatake YAMATO [Sun, 23 Jul 2023 05:43:36 +0000 (14:43 +0900)] 
lsfd: (test) add a case for testing a unix socket including newline characters in its path name

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
10 months agolsfd: re-fill unix socket paths with sockdiag netlink interface
Masatake YAMATO [Fri, 21 Jul 2023 19:02:38 +0000 (04:02 +0900)] 
lsfd: re-fill unix socket paths with sockdiag netlink interface

This commit is mostly based on Thomas Weißschuh's work,
https://github.com/t-8ch/util-linux/commit/06030390a5e6a16cc4b914bbf5fcedd3b6d83608.

Unlike the original work, this commit keeps /proc related code.

Unlike /proc interface, the sockdiag information source doesn't provide
enough information for filling struct unix_xinfo::st member. So this
commit uses /proc interface for filling the most of all unix_xinfo
members as before.

On the other hande, as discussed in
https://github.com/util-linux/util-linux/pull/2067, the /proc
interface in unreliable if a unix path name includes newline
characters. This commit uses the sockdiag interface to compensate
for the weakness of the /proc interface.

10 months agoenosys: avoid warnings when no aliases are found
Thomas Weißschuh [Sun, 23 Jul 2023 20:05:48 +0000 (22:05 +0200)] 
enosys: avoid warnings when no aliases are found

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agoenosys: don't validate that numbers are found from headers
Thomas Weißschuh [Sun, 23 Jul 2023 19:16:53 +0000 (21:16 +0200)] 
enosys: don't validate that numbers are found from headers

Users can specify plain numbers so it's fine to not have any aliases.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agoenosys: add support for ioctl blocking
Thomas Weißschuh [Mon, 26 Jun 2023 18:25:18 +0000 (20:25 +0200)] 
enosys: add support for ioctl blocking

Ioctls are blocked with ENOTTY.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agoenosys: store blocked syscalls in list instead of array
Thomas Weißschuh [Mon, 26 Jun 2023 18:25:18 +0000 (20:25 +0200)] 
enosys: store blocked syscalls in list instead of array

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agoenosys: build BPF dynamically
Thomas Weißschuh [Mon, 22 May 2023 08:13:47 +0000 (10:13 +0200)] 
enosys: build BPF dynamically

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agoenosys: list syscall numbers
Thomas Weißschuh [Tue, 27 Jun 2023 10:59:02 +0000 (12:59 +0200)] 
enosys: list syscall numbers

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
10 months agolsfd: add comment listing functions names importing via #include
Masatake YAMATO [Wed, 19 Jul 2023 21:11:55 +0000 (06:11 +0900)] 
lsfd: add comment listing functions names importing via #include

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
10 months agolsfd: include common headers in lsfd.h
Masatake YAMATO [Wed, 19 Jul 2023 21:06:27 +0000 (06:06 +0900)] 
lsfd: include common headers in lsfd.h

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
10 months agolsfd: include system header files first
Masatake YAMATO [Wed, 19 Jul 2023 21:34:30 +0000 (06:34 +0900)] 
lsfd: include system header files first

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
10 months agolsfd: fix a misleading parameter name
Masatake YAMATO [Thu, 20 Jul 2023 13:00:54 +0000 (22:00 +0900)] 
lsfd: fix a misleading parameter name

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
10 months agolsfd: add const modifier
Thomas Weißschuh [Fri, 14 Apr 2023 10:48:59 +0000 (12:48 +0200)] 
lsfd: add const modifier

(The log is edited by @masatake.)

10 months agolosetup: add --loop-ref and REF column
Karel Zak [Thu, 16 Mar 2023 12:41:36 +0000 (13:41 +0100)] 
losetup: add --loop-ref and REF column

The lo_file_name is nowhere used (kernel uses backing file descriptor,
no path) and it was used to store limited info about the backing file path
(64 bytes only!). For backward compatibility, we still fill lo_file_name
with the path, but it's nowhere in the userspace used as the complete
backing file path in sysfs.

This commit introduces a new option to overwrite the default path in
lo_file_name. The idea is to use the reference string by udevd in
/dev/loop/by-ref to address loop devices independently on paths.

Addresses: https://github.com/util-linux/util-linux/issues/2106
Suggested-by: Lennart Poettering <lennart@poettering.net>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agolibmount: use some MS_* flags as superblock flags
Karel Zak [Thu, 20 Jul 2023 10:34:14 +0000 (12:34 +0200)] 
libmount: use some MS_* flags as superblock flags

The old mount(2) API usually utilizes MS_* flags to set up the VFS
node. However, there are some exceptions like "sync" (MS_SYNCHRONOUS),
where the flag is used (by kernel) for the superblock instead. The new
API addresses this issue, ensuring that these options are used for
fsconfig().

This commit introduces MNT_SUPERBLOCK to identify these options in the
libmount options Linux map, and it enforces the new mount code to
utilize these options for fsconfig(FSCONFIG_SET_FLAG).

Reported-by: Abbink Esger <esger.abbink.ext@siemens.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
10 months agotest: (lsfd) add a case for testing BPF-PROG.TYPE and BPF-PROG.TYPE.RAW columns
Masatake YAMATO [Wed, 19 Jul 2023 06:38:55 +0000 (15:38 +0900)] 
test: (lsfd) add a case for testing BPF-PROG.TYPE and BPF-PROG.TYPE.RAW columns

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