]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
12 months agoMerge branch 'waitpid--suppress-message' of https://github.com/masatake/util-linux
Karel Zak [Mon, 11 Sep 2023 07:12:42 +0000 (09:12 +0200)] 
Merge branch 'waitpid--suppress-message' of https://github.com/masatake/util-linux

* 'waitpid--suppress-message' of https://github.com/masatake/util-linux:
  waitpid: warn of "exited" only when --verbose is given

12 months agoMerge branch 'PR/libmount-stat.h'
Karel Zak [Mon, 11 Sep 2023 07:11:41 +0000 (09:11 +0200)] 
Merge branch 'PR/libmount-stat.h'

12 months agoMerge branch 'setpgid' of https://github.com/DaanDeMeyer/util-linux
Karel Zak [Mon, 11 Sep 2023 07:08:42 +0000 (09:08 +0200)] 
Merge branch 'setpgid' of https://github.com/DaanDeMeyer/util-linux

12 months agowaitpid: warn of "exited" only when --verbose is given
Masatake YAMATO [Thu, 31 Aug 2023 18:34:40 +0000 (03:34 +0900)] 
waitpid: warn of "exited" only when --verbose is given

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
12 months agoMerge branch 'libblkid/protection' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 31 Aug 2023 08:51:59 +0000 (10:51 +0200)] 
Merge branch 'libblkid/protection' of https://github.com/t-8ch/util-linux

* 'libblkid/protection' of https://github.com/t-8ch/util-linux:
  libblkid: protect shared buffers against modifications
  libblkid: (vfat) avoid modifying shared buffer
  libblkid: (jmicron_raid) use checksum APIs
  libblkid: (jmicron_raid) avoid modifying shared buffer
  libblkid: (zonefs) avoid modifying shared buffer

12 months agoMerge branch 'PR/losetup-json' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 31 Aug 2023 08:41:32 +0000 (10:41 +0200)] 
Merge branch 'PR/losetup-json' of github.com:karelzak/util-linux-work

* 'PR/losetup-json' of github.com:karelzak/util-linux-work:
  losetup: make --output-all more usable
  losetup: add MAJ a MIN for device and backing-file
  losetup: fix JSON MAJ:MIN

12 months agolibmount: make.stx_mnt_id use more robust
Karel Zak [Thu, 31 Aug 2023 08:30:55 +0000 (10:30 +0200)] 
libmount: make.stx_mnt_id use more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agolibmount: report statx in features list
Karel Zak [Thu, 31 Aug 2023 08:26:37 +0000 (10:26 +0200)] 
libmount: report statx in features list

Let's make statx() support visible in "mount -V" output.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agolibmount: fix statx() includes
Karel Zak [Wed, 23 Aug 2023 09:50:37 +0000 (11:50 +0200)] 
libmount: fix statx() includes

Using sys/stat.h and linux/stat is too tricky.h together. It seems
better to rely on libc and use sys/stat.h only. Users affected
by old libc must update to use recent util-linux.

Fixes: https://github.com/util-linux/util-linux/issues/2448
Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoAdd new setpgid utility
Daan De Meyer [Sun, 20 Aug 2023 09:42:51 +0000 (11:42 +0200)] 
Add new setpgid utility

This program allows running a command in a new process group and
optionally makes the new process group the foreground process group
of the ctty.

This is useful when running programs through wrappers programs (think
bubblewrap, ...) and wanting to make sure that SIGINT is only sent to
the innermost process. This is possible by putting the innermost process
in a new process group and making that process group the foreground process
group of the controlling terminal.

By adding a separate utility to util-linux, we can apply this to any
program even if the program itself doesn't implement this functionality.

12 months agolibblkid: protect shared buffers against modifications
Thomas Weißschuh [Tue, 29 Aug 2023 10:06:54 +0000 (12:06 +0200)] 
libblkid: protect shared buffers against modifications

The cached buffers are shared between multiple probers.
To avoid (potentially security-sensitive) interdependencies between
probers make let the kernel enforce the write-protection.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 months agolibblkid: (vfat) avoid modifying shared buffer
Thomas Weißschuh [Tue, 29 Aug 2023 10:44:48 +0000 (12:44 +0200)] 
libblkid: (vfat) avoid modifying shared buffer

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 months agolibblkid: (jmicron_raid) use checksum APIs
Thomas Weißschuh [Tue, 29 Aug 2023 10:31:35 +0000 (12:31 +0200)] 
libblkid: (jmicron_raid) use checksum APIs

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 months agolibblkid: (jmicron_raid) avoid modifying shared buffer
Thomas Weißschuh [Tue, 29 Aug 2023 10:29:31 +0000 (12:29 +0200)] 
libblkid: (jmicron_raid) avoid modifying shared buffer

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 months agolibblkid: (zonefs) avoid modifying shared buffer
Thomas Weißschuh [Tue, 29 Aug 2023 10:22:28 +0000 (12:22 +0200)] 
libblkid: (zonefs) avoid modifying shared buffer

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 months agolosetup: make --output-all more usable
Karel Zak [Mon, 28 Aug 2023 14:58:13 +0000 (16:58 +0200)] 
losetup: make --output-all more usable

The other tools (e.g. lsblk) can use --output-all with --list or
--json. Let's make it usable also with losetup.

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoMerge branch 'PR/uuidgen-count' of github.com:karelzak/util-linux-work
Karel Zak [Mon, 28 Aug 2023 12:03:47 +0000 (14:03 +0200)] 
Merge branch 'PR/uuidgen-count' of github.com:karelzak/util-linux-work

* 'PR/uuidgen-count' of github.com:karelzak/util-linux-work:
  uuidgen: mark some options mutually exclusive
  uuidgen: add option --count

12 months agolosetup: add MAJ a MIN for device and backing-file
Karel Zak [Mon, 28 Aug 2023 11:53:40 +0000 (13:53 +0200)] 
losetup: add MAJ a MIN for device and backing-file

Addresses: https://github.com/util-linux/util-linux/issues/2460
Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agolosetup: fix JSON MAJ:MIN
Karel Zak [Mon, 28 Aug 2023 11:21:33 +0000 (13:21 +0200)] 
losetup: fix JSON MAJ:MIN

Fixes: https://github.com/util-linux/util-linux/issues/2460
Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoMerge branch 'lslogins/man-shell' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 28 Aug 2023 09:39:12 +0000 (11:39 +0200)] 
Merge branch 'lslogins/man-shell' of https://github.com/t-8ch/util-linux

* 'lslogins/man-shell' of https://github.com/t-8ch/util-linux:
  lslogins: (man) fix -y option formatting

12 months agoMerge branch 'fincore/alignment' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 28 Aug 2023 09:38:43 +0000 (11:38 +0200)] 
Merge branch 'fincore/alignment' of https://github.com/t-8ch/util-linux

* 'fincore/alignment' of https://github.com/t-8ch/util-linux:
  fincore: fix alignment of column listing in --help

12 months agouuidgen: mark some options mutually exclusive
Karel Zak [Wed, 23 Aug 2023 09:36:45 +0000 (11:36 +0200)] 
uuidgen: mark some options mutually exclusive

* types cannot be mixed (--time, --random, --md5 and --sha1)
* --count makes sense only for --time and --random
* --name and --namespace makes sense only for --md5 and --sha1

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agouuidgen: add option --count
Karel Zak [Wed, 23 Aug 2023 09:21:22 +0000 (11:21 +0200)] 
uuidgen: add option --count

This is mostly for testing purpose or performance tuning. The new
option allows generate multiple UUIDs using the enhanced capability of
the libuuid to cache time-based UUIDs.

 $ uuidgen --time --count 3
 638b9432-4196-11ee-bb1f-7824af891670
 638b94be-4196-11ee-bb1f-7824af891670
 638b94fa-4196-11ee-bb1f-7824af891670

Fixes: https://github.com/util-linux/util-linux/issues/2449
Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agolslogins: (man) fix -y option formatting
Thomas Weißschuh [Mon, 28 Aug 2023 07:30:59 +0000 (09:30 +0200)] 
lslogins: (man) fix -y option formatting

Fixes #2461

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 months agofincore: fix alignment of column listing in --help
Thomas Weißschuh [Mon, 28 Aug 2023 07:28:53 +0000 (09:28 +0200)] 
fincore: fix alignment of column listing in --help

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 months agoinclude: add DragonFlyBSD GPT partition types
Thomas Weißschuh [Mon, 28 Aug 2023 07:01:49 +0000 (09:01 +0200)] 
include: add DragonFlyBSD GPT partition types

Fixes #2462

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 months agolibblkid: (bcachefs) fix size validation
Thomas Weißschuh [Wed, 23 Aug 2023 09:58:33 +0000 (11:58 +0200)] 
libblkid: (bcachefs) fix size validation

Avoid signed shift out-of-bounds.

Also mark the constants explitly as unsigned instead of casting.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 months agolibblkid: (bcachefs) fix compiler warning [-Werror=sign-compare]
Karel Zak [Wed, 23 Aug 2023 09:53:45 +0000 (11:53 +0200)] 
libblkid: (bcachefs) fix compiler warning [-Werror=sign-compare]

Addresses: https://github.com/util-linux/util-linux/pull/2427
Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agobash-completion: add -T to last
Karel Zak [Wed, 23 Aug 2023 08:12:46 +0000 (10:12 +0200)] 
bash-completion: add -T to last

Signed-off-by: Karel Zak <kzak@redhat.com>
12 months agoMerge branch 'master' of https://github.com/tragdate/util-linux
Karel Zak [Wed, 23 Aug 2023 08:11:11 +0000 (10:11 +0200)] 
Merge branch 'master' of https://github.com/tragdate/util-linux

* 'master' of https://github.com/tragdate/util-linux:
  last(1): Document -T option for tab-separated output
  last: Add -T option for tab-separated output

12 months agoMerge branch 'udf' of https://github.com/pali/util-linux
Karel Zak [Wed, 23 Aug 2023 08:08:39 +0000 (10:08 +0200)] 
Merge branch 'udf' of https://github.com/pali/util-linux

* 'udf' of https://github.com/pali/util-linux:
  Fix detection of UDF filesystem

12 months agoMerge branch 'uclampset-updates' of https://github.com/qais-yousef/util-linux
Karel Zak [Wed, 23 Aug 2023 08:07:53 +0000 (10:07 +0200)] 
Merge branch 'uclampset-updates' of https://github.com/qais-yousef/util-linux

* 'uclampset-updates' of https://github.com/qais-yousef/util-linux:
  uclampset: Remove validation logic
  uclampset: doc: Add a reference to latest kernel documentation
  Update my email address

12 months agoMerge branch 'master' of https://github.com/breavyn/util-linux
Karel Zak [Wed, 23 Aug 2023 08:06:18 +0000 (10:06 +0200)] 
Merge branch 'master' of https://github.com/breavyn/util-linux

* 'master' of https://github.com/breavyn/util-linux:
  libblkid: (bcachefs) fix not detecting large superblocks

12 months agolast(1): Document -T option for tab-separated output
Trag Date [Wed, 23 Aug 2023 01:44:27 +0000 (04:44 +0300)] 
last(1): Document -T option for tab-separated output

This commit updates the last(1) man page to include the new -T option, which allows for tab-separated output. This addition to the documentation ensures users are aware of this new functionality and can utilize it to enhance their awk parsing.

Signed-off-by: Cristian Zmole <chiarel@tragdate.ninja>
12 months agolast: Add -T option for tab-separated output
Trag Date [Wed, 23 Aug 2023 01:43:04 +0000 (04:43 +0300)] 
last: Add -T option for tab-separated output

This commit introduces a -T option to the last command, allowing for tab-separated output. This change significantly improves the usability of last in conjunction with awk, enabling more efficient and intuitive parsing of command output.

Signed-off-by: Cristian Zmole <chiarel@tragdate.ninja>
13 months agoFix detection of UDF filesystem
Pali Rohár [Tue, 22 Aug 2023 19:21:37 +0000 (21:21 +0200)] 
Fix detection of UDF filesystem

OSTA UDF standard is "profile" of the ISO/IEC 13346 and ECMA-167 standard.
Fix UDF detection and check for "*OSTA UDF Compliant" domain id which
distinguish UDF from all other ISO/IEC 13346 and ECMA-167 filesystems.

13 months agouclampset: Remove validation logic
Qais Yousef [Sat, 19 Aug 2023 17:32:41 +0000 (18:32 +0100)] 
uclampset: Remove validation logic

While experimenting with a potential extension to uclamp; I realized
I had to modify uclampset to be able to use this extension, which is not
scalable.

Since the syscall will do checks anyway, drop the validation logic and
let the kernel do its work without duplication that can potentially get
stale.

Use more magic value for NOT_SET define. We do have uclamp_set_set flag
to verify if the value is valid anyway, so this is extra paranoia.

Signed-off-by: Qais Yousef <qyousef@layalina.io>
13 months agouclampset: doc: Add a reference to latest kernel documentation
Qais Yousef [Sat, 19 Aug 2023 17:28:53 +0000 (18:28 +0100)] 
uclampset: doc: Add a reference to latest kernel documentation

Kernel has gained a documentation for uclamp feature. Add a reference to
it to help users to find out and learn more about it.

Signed-off-by: Qais Yousef <qyousef@layalina.io>
13 months agoUpdate my email address
Qais Yousef [Sat, 19 Aug 2023 17:26:42 +0000 (18:26 +0100)] 
Update my email address

My email address at arm is no longer active. Switch to my personal one.

Done via

git grep -l 'qais.yousef@arm.com' | xargs sed -i 's/qais.yousef@arm.com/qyousef@layalina.io/g'

Signed-off-by: Qais Yousef <qyousef@layalina.io>
13 months agolibmount: Fix regression when mounting with atime
Filipe Manana [Thu, 17 Aug 2023 09:20:13 +0000 (10:20 +0100)] 
libmount: Fix regression when mounting with atime

A regression was introduced in v2.39 that causes mounting with the atime
option to fail:

  $ mkfs.ext4 -F /dev/sdi
  $ mount -o atime /dev/sdi /mnt/sdi
  mount: /mnt/sdi: not mount point or bad option.
         dmesg(1) may have more information after failed mount system call.

The failure comes from the mount_setattr(2) call returning -EINVAL. This
is because we pass an invalid value for the attr_clr argument. From a
strace capture we have:

  mount_setattr(4, "", AT_EMPTY_PATH, {attr_set=0, attr_clr=MOUNT_ATTR_NOATIME, propagation=0 /* MS_??? */, userns_fd=0}, 32) = -1 EINVAL (Invalid argument)

We can't pass MOUNT_ATTR_NOATIME to mount_setattr(2) through the attr_clr
argument because all atime options are exclusive, so in order to set atime
one has to pass MOUNT_ATTR__ATIME to attr_clr and leave attr_set as
MOUNT_ATTR_RELATIME (which is defined as a value of 0).

This can be read from the man page for mount_setattr(2) and also from the
kernel source:

  $ cat fs/namespace.c
  static int build_mount_kattr(const struct mount_attr *attr, size_t usize,
                               struct mount_kattr *kattr, unsigned int flags)
  {
      (...)
      /*
       * Since the MOUNT_ATTR_<atime> values are an enum, not a bitmap,
       * users wanting to transition to a different atime setting cannot
       * simply specify the atime setting in @attr_set, but must also
       * specify MOUNT_ATTR__ATIME in the @attr_clr field.
       * So ensure that MOUNT_ATTR__ATIME can't be partially set in
       * @attr_clr and that @attr_set can't have any atime bits set if
       * MOUNT_ATTR__ATIME isn't set in @attr_clr.
       */
      if (attr->attr_clr & MOUNT_ATTR__ATIME) {
          if ((attr->attr_clr & MOUNT_ATTR__ATIME) != MOUNT_ATTR__ATIME)
              return -EINVAL;

              /*
               * Clear all previous time settings as they are mutually
               * exclusive.
               */
              kattr->attr_clr |= MNT_RELATIME | MNT_NOATIME;
              switch (attr->attr_set & MOUNT_ATTR__ATIME) {
              case MOUNT_ATTR_RELATIME:
                  kattr->attr_set |= MNT_RELATIME;
                  break;
              case MOUNT_ATTR_NOATIME:
                  kattr->attr_set |= MNT_NOATIME;
                  break;
              case MOUNT_ATTR_STRICTATIME:
                  break;
              default:
                  return -EINVAL;
              }
    (...)

So fix this by setting attr_clr MOUNT_ATTR__ATIME if we want to clear any
atime related option.

Signed-off-by: Filipe Manana <fdmanana@kernel.org>
13 months agoterm-utils: fix indentation
Karel Zak [Wed, 16 Aug 2023 07:34:19 +0000 (09:34 +0200)] 
term-utils: fix indentation

References: 87fcd95ac5ad18e471b17f448daa55b2ce2fac6a
References: 5c62c27001467f3ef0baaa66ae4e3bb80a0298a6
Signed-off-by: Karel Zak <kzak@redhat.com>
13 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)

13 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

13 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

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

13 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

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

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

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

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

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

13 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

13 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>
13 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>
13 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>
13 months agolibblkid: (bcachefs) fix not detecting large superblocks
Colin Gillespie [Wed, 9 Aug 2023 08:28:07 +0000 (18:28 +1000)] 
libblkid: (bcachefs) fix not detecting large superblocks

Probing does not detect bcachefs filesystems with a superblock larger
than 4KiB. Bcachefs superblocks grow in size and can become much larger
than this.

Increase the superblock maximum size limit to 1MiB.

Validate the superblock isn't larger than the maximum size defined in
the superblocks layout section.

13 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>
13 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>
13 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>
13 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>
13 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>
13 months agotools/all_syscalls: use pipefail
sewn [Tue, 8 Aug 2023 08:50:10 +0000 (11:50 +0300)] 
tools/all_syscalls: use pipefail

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

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

13 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

13 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

13 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

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

13 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

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

13 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

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

13 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

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