]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
22 months agoMerge branch 'lsfd--fix-2691' of https://github.com/masatake/util-linux
Karel Zak [Tue, 23 Jan 2024 10:07:58 +0000 (11:07 +0100)] 
Merge branch 'lsfd--fix-2691' of https://github.com/masatake/util-linux

* 'lsfd--fix-2691' of https://github.com/masatake/util-linux:
  tests: (lsfd::column-xmode) skip some subtests if OFD locks are not available
  tests: (lsfd) skip mkfds-netns if SIOCGSKNS is not defined
  tests: (lsfd) add lsfd_check_mkfds_factory as a help function
  tests: (test_mkfds) add --is-available option
  lsfd: build lsfd even if kcmp.h is not available
  tests: (refactor (test_mkfds, lsfd)) use TS_EXIT_NOTSUPP instead of EXIT_ENOSYS

22 months agoMerge branch 'findmnt-inode' of https://github.com/masatake/util-linux
Karel Zak [Tue, 23 Jan 2024 10:06:51 +0000 (11:06 +0100)] 
Merge branch 'findmnt-inode' of https://github.com/masatake/util-linux

* 'findmnt-inode' of https://github.com/masatake/util-linux:
  findmnt: add -I, --dfi options for imitating the output of df -i
  findmnt: add inode-related columns for implementing "df -i" like output

22 months agoMerge branch 'wipefs-man-typos' of https://github.com/codefiles/util-linux
Karel Zak [Tue, 23 Jan 2024 09:57:16 +0000 (10:57 +0100)] 
Merge branch 'wipefs-man-typos' of https://github.com/codefiles/util-linux

* 'wipefs-man-typos' of https://github.com/codefiles/util-linux:
  wipefs: (man) fix typos

22 months agoMerge branch 'PR/libmount-utab-masking' of github.com:karelzak/util-linux-work
Karel Zak [Tue, 23 Jan 2024 09:55:45 +0000 (10:55 +0100)] 
Merge branch 'PR/libmount-utab-masking' of github.com:karelzak/util-linux-work

* 'PR/libmount-utab-masking' of github.com:karelzak/util-linux-work:
  libmount: ignore unwanted kernel events in monitor
  libmount: add utab.act file
  libmount: cleanup locking in table update code
  libmount: introduce reference counting for libmnt_lock

22 months agoMerge branch 'remove-geteuid-ctrlaltdel' of https://github.com/JJ-Meng/util-linux
Karel Zak [Tue, 23 Jan 2024 09:54:51 +0000 (10:54 +0100)] 
Merge branch 'remove-geteuid-ctrlaltdel' of https://github.com/JJ-Meng/util-linux

* 'remove-geteuid-ctrlaltdel' of https://github.com/JJ-Meng/util-linux:
  ctrlaltdel: remove unnecessary uid check

22 months agowipefs: (man) fix typos
codefiles [Tue, 23 Jan 2024 01:14:33 +0000 (20:14 -0500)] 
wipefs: (man) fix typos

22 months agofindmnt: add -I, --dfi options for imitating the output of df -i
Masatake YAMATO [Mon, 22 Jan 2024 21:05:39 +0000 (06:05 +0900)] 
findmnt: add -I, --dfi options for imitating the output of df -i

An example output:

  $ ./findmnt -I
  SOURCE                            FSTYPE      INO.TOTAL  INO.USED INO.AVAIL INO.USE% TARGET
  /dev/mapper/fedora_dev64-root     ext4          5341184   1135307   4205877      21% /
  devtmpfs                          devtmpfs     32930640      1209  32929431       0% /dev
  tmpfs                             tmpfs        32938620        86  32938534       0% /dev/shm
  ...

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agofindmnt: add inode-related columns for implementing "df -i" like output
Masatake YAMATO [Mon, 22 Jan 2024 20:38:50 +0000 (05:38 +0900)] 
findmnt: add inode-related columns for implementing "df -i" like output

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (lsfd::column-xmode) skip some subtests if OFD locks are not available
Masatake YAMATO [Fri, 19 Jan 2024 22:35:40 +0000 (07:35 +0900)] 
tests: (lsfd::column-xmode) skip some subtests if OFD locks are not available

Fixed #2691 partially.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (lsfd) skip mkfds-netns if SIOCGSKNS is not defined
Masatake YAMATO [Fri, 19 Jan 2024 21:21:28 +0000 (06:21 +0900)] 
tests: (lsfd) skip mkfds-netns if SIOCGSKNS is not defined

Fixed #2691 partially.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (lsfd) add lsfd_check_mkfds_factory as a help function
Masatake YAMATO [Fri, 19 Jan 2024 21:14:35 +0000 (06:14 +0900)] 
tests: (lsfd) add lsfd_check_mkfds_factory as a help function

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (test_mkfds) add --is-available option
Masatake YAMATO [Fri, 19 Jan 2024 20:26:23 +0000 (05:26 +0900)] 
tests: (test_mkfds) add --is-available option

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agolsfd: build lsfd even if kcmp.h is not available
Masatake YAMATO [Fri, 19 Jan 2024 20:06:58 +0000 (05:06 +0900)] 
lsfd: build lsfd even if kcmp.h is not available

As reported in #2691 by @rrrossi, lsfd was not built on the platform
where kcmp.h was not available. However, lsfd just uses kcmp(2) only
for optimization; it can work without kcmp.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agoMerge branch 'lsfd--cosmetic-fix' of https://github.com/masatake/util-linux
Karel Zak [Mon, 22 Jan 2024 12:21:57 +0000 (13:21 +0100)] 
Merge branch 'lsfd--cosmetic-fix' of https://github.com/masatake/util-linux

* 'lsfd--cosmetic-fix' of https://github.com/masatake/util-linux:
  lsfd,test_mkfds: (cosmetic) remove whitespaces between functions and their arglists

22 months agotests: (refactor (test_mkfds, lsfd)) use TS_EXIT_NOTSUPP instead of EXIT_ENOSYS
Masatake YAMATO [Mon, 22 Jan 2024 10:15:00 +0000 (19:15 +0900)] 
tests: (refactor (test_mkfds, lsfd)) use TS_EXIT_NOTSUPP instead of EXIT_ENOSYS

Suggested by Thomas Weißschuh in #2722.
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agoMerge branch 'fallocate--retval' of https://github.com/masatake/util-linux
Karel Zak [Mon, 22 Jan 2024 12:21:03 +0000 (13:21 +0100)] 
Merge branch 'fallocate--retval' of https://github.com/masatake/util-linux

* 'fallocate--retval' of https://github.com/masatake/util-linux:
  fallocate: fix the way to evaluate values returned from posix_fallocate

22 months agolibmount: ignore unwanted kernel events in monitor
Karel Zak [Mon, 22 Jan 2024 12:04:44 +0000 (13:04 +0100)] 
libmount: ignore unwanted kernel events in monitor

If the mount operation requires multiple steps, it's optimal for the
libmount monitor to ignore the steps until we get a complete mount
(reported by the utab.event file).

This commit adds a new API function, mnt_monitor_veil_kernel(), to
ignore unwanted kernel mount events.

Note that this only makes sense when the application monitors kernel
and userspace events simultaneously.

Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agolibmount: add utab.act file
Karel Zak [Mon, 22 Jan 2024 11:56:24 +0000 (12:56 +0100)] 
libmount: add utab.act file

The file exists when libmount works with utab, and more steps are
expected during a single mount operation (more kernel events, more
updates to utab, etc.).

It is possible to monitor the file through the mnt_monitor_...() API
by a simple access() after any event. No locks are expected in
monitor, making it usable for non-root users without any security
impact. The monitor can ignore events if the file exist.

Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agolibmount: cleanup locking in table update code
Karel Zak [Fri, 19 Jan 2024 11:58:50 +0000 (12:58 +0100)] 
libmount: cleanup locking in table update code

* use reference counting for libmnt_lock

* remove lock use from mnt_update_already_done(), it's read-only
  operation and utab update is atomic (based on rename(2))

* keep the lock instance mandatory for all low-level update_*
  functions. The lock is always initialized, so all the 'if(lc)'
  are unnecessary.

Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agolsfd,test_mkfds: (cosmetic) remove whitespaces between functions and their arglists
Masatake YAMATO [Fri, 19 Jan 2024 15:03:46 +0000 (00:03 +0900)] 
lsfd,test_mkfds: (cosmetic) remove whitespaces between functions and their arglists

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agofallocate: fix the way to evaluate values returned from posix_fallocate
Masatake YAMATO [Fri, 19 Jan 2024 14:47:30 +0000 (23:47 +0900)] 
fallocate: fix the way to evaluate values returned from posix_fallocate

Unlike Linux native system calls, posix_fallocate doesn't return -1
whe an error occurs; it returns a errno value directly.

The bug of the original code was reported by @Yugend on #2714.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agoctrlaltdel: remove unnecessary uid check
JJ-Meng [Fri, 19 Jan 2024 12:08:55 +0000 (20:08 +0800)] 
ctrlaltdel: remove unnecessary uid check

22 months agolibmount: introduce reference counting for libmnt_lock
Karel Zak [Fri, 19 Jan 2024 11:15:48 +0000 (12:15 +0100)] 
libmount: introduce reference counting for libmnt_lock

Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agolibsmartcols: fix columns reduction
Karel Zak [Thu, 18 Jan 2024 12:09:24 +0000 (13:09 +0100)] 
libsmartcols: fix columns reduction

* reduce_to_68() does not care if subtract from column width is
  possible (and width is size_t)

* improve some calculations with 'double'

Fixes: https://github.com/util-linux/util-linux/issues/2563
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agoMerge branch 'audit/ret' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 19 Jan 2024 08:41:18 +0000 (09:41 +0100)] 
Merge branch 'audit/ret' of https://github.com/t-8ch/util-linux

* 'audit/ret' of https://github.com/t-8ch/util-linux:
  login: ignore return of audit_log_acct_message
  hwclock: handle failure of audit_log_user_message

22 months agologin: ignore return of audit_log_acct_message
Thomas Weißschuh [Fri, 19 Jan 2024 02:12:21 +0000 (03:12 +0100)] 
login: ignore return of audit_log_acct_message

The function is marked with `warn_unused_result` so handle the return
value. Failures of `audit_open()` are also silently ignored so do the
same for `audit_log_acct_message()` itself.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agohwclock: handle failure of audit_log_user_message
Thomas Weißschuh [Fri, 19 Jan 2024 02:11:22 +0000 (03:11 +0100)] 
hwclock: handle failure of audit_log_user_message

The function is marked was `warn_unused_result`, so do something with
the return value.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agofsck: initialize timevals [-Werror=maybe-uninitialized]
Karel Zak [Thu, 18 Jan 2024 19:43:51 +0000 (20:43 +0100)] 
fsck: initialize timevals [-Werror=maybe-uninitialized]

Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agoflock: initialize timevals [-Werror=maybe-uninitialized]
Karel Zak [Thu, 18 Jan 2024 19:40:50 +0000 (20:40 +0100)] 
flock: initialize timevals [-Werror=maybe-uninitialized]

Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agolib/pty-session: initialize timevals [-Werror=maybe-uninitialized]
Karel Zak [Thu, 18 Jan 2024 16:35:51 +0000 (17:35 +0100)] 
lib/pty-session: initialize timevals [-Werror=maybe-uninitialized]

Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agowall: fix calloc cal [-Werror=calloc-transposed-args]
Karel Zak [Wed, 17 Jan 2024 11:37:08 +0000 (12:37 +0100)] 
wall: fix calloc cal [-Werror=calloc-transposed-args]

term-utils/wall.c:143:37: error: xcalloc sizes specified with sizeof in the earlier argument and not in the later argument [-Werror=calloc-transposed-args]
  143 |         buf->groups = xcalloc(sizeof(*buf->groups), buf->ngroups);
      |                                     ^
term-utils/wall.c:143:37: note: earlier argument should specify number of elements, later size of each element

Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agosulogin: relabel terminal according to SELinux policy
Christian Göttsche [Wed, 13 Dec 2023 15:53:20 +0000 (16:53 +0100)] 
sulogin: relabel terminal according to SELinux policy

The common SELinux practice is to have a distinct label for terminals in
use by logged in users.  This allows to differentiate access on the
associated terminal (e.g. user_tty_device_t) vs foreign ones (e.g.
tty_device_t or sysadm_tty_device_t).  Therefore the application
performing the user login and setting up the associated terminal should
label that terminal according to the loaded SELinux policy.  Commonly
this is done by pam_selinux(7).  Since sulogin(8) does not use pam(7)
perform the necessary steps manually.

Fixes: https://github.com/util-linux/util-linux/issues/1578
Reviewed-by: James Carter <jwcart2@gmail.com>
Signed-off-by: Christian Göttsche <cgzones@googlemail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agoMerge branch 'libblkid/drbd/padding' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 17 Jan 2024 08:43:05 +0000 (09:43 +0100)] 
Merge branch 'libblkid/drbd/padding' of https://github.com/t-8ch/util-linux

* 'libblkid/drbd/padding' of https://github.com/t-8ch/util-linux:
  libblkid: (drbd) validate zero padding
  libblkid: avoid aligning out of probing area

22 months agolibfdisk: (tests) fix tests for removal of non-blockdev sync()
Thomas Weißschuh [Tue, 16 Jan 2024 13:34:54 +0000 (14:34 +0100)] 
libfdisk: (tests) fix tests for removal of non-blockdev sync()

Fixes: 101dca2f18eb ("libfdisk: fdisk_deassign_device: only sync(2) blockdevs")
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoMerge branch 'time64' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 16 Jan 2024 10:17:55 +0000 (11:17 +0100)] 
Merge branch 'time64' of https://github.com/t-8ch/util-linux

* 'time64' of https://github.com/t-8ch/util-linux:
  build-sys: (tests) validate that time_t is 64bit
  meson: try to always use 64bit time support on glibc
  build-sys: try to always use 64bit time support on glibc
  build-sys: backport autoconf year2038 macros
  tests: add sysinfo to show sizeof(time_t)
  tests: constify a sysinfo helpers struct

22 months agolibfdisk: fdisk_deassign_device: only sync(2) blockdevs
наб [Sat, 13 Jan 2024 22:35:31 +0000 (23:35 +0100)] 
libfdisk: fdisk_deassign_device: only sync(2) blockdevs

When not editing a blockdev, syncing disks provides no benefit
(we already fsync() above), takes a long time,
and affects unrelated caches.

BLKRRPART is similarly gated on !S_ISBLK(st_mode) in
fdisk_reread_partition_table.

22 months agoMerge branch 'PR/uuidd-cont-clock-persistence' of github.com:karelzak/util-linux...
Karel Zak [Mon, 15 Jan 2024 09:38:45 +0000 (10:38 +0100)] 
Merge branch 'PR/uuidd-cont-clock-persistence' of github.com:karelzak/util-linux-work

* 'PR/uuidd-cont-clock-persistence' of github.com:karelzak/util-linux-work:
  libuuid: fix uint64_t printf and scanf format
  uuidd: add cont_clock persistence

22 months agoMerge branch 'PR/libmount-utab-event' of github.com:karelzak/util-linux-work
Karel Zak [Mon, 15 Jan 2024 09:38:27 +0000 (10:38 +0100)] 
Merge branch 'PR/libmount-utab-event' of github.com:karelzak/util-linux-work

* 'PR/libmount-utab-event' of github.com:karelzak/util-linux-work:
  libmount: don't assume errno after failed asprintf()
  libmount: reduce utab.lock permissions
  libmount: introduce /run/mount/utab.event
  libmount: add mnt_context_within_helper() wrapper

22 months agolibuuid: fix uint64_t printf and scanf format
Karel Zak [Fri, 12 Jan 2024 09:52:40 +0000 (10:52 +0100)] 
libuuid: fix uint64_t printf and scanf format

Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agoMerge branch 'libblkid/const' of https://github.com/t-8ch/util-linux
Karel Zak [Fri, 12 Jan 2024 09:31:38 +0000 (10:31 +0100)] 
Merge branch 'libblkid/const' of https://github.com/t-8ch/util-linux

* 'libblkid/const' of https://github.com/t-8ch/util-linux:
  libblkid: constify return values of blkid_probe_get_sb
  include/c.h: handle members of const struct

22 months agouuidd: add cont_clock persistence
Michael Trapp [Wed, 10 Jan 2024 16:29:38 +0000 (17:29 +0100)] 
uuidd: add cont_clock persistence

cont_clock requires a correct time setup and therefore it
must be possible to detect a step back between uuidd starts.

Reserving the next 10 seconds is sufficient and should not
have a noticeable performance impact. It will also provide
the possibility to start with the clock_reg from the previous
session when the system was rebooted.

Whith that, the early cont_clock initialization in uuidd
should be removed because writing the cont_clock persitence
when -C was not set is useless and might be confusing.

22 months agolibblkid: (drbd) validate zero padding
Thomas Weißschuh [Fri, 12 Jan 2024 07:50:14 +0000 (08:50 +0100)] 
libblkid: (drbd) validate zero padding

This should reduce false-positives.

See #2701.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: avoid aligning out of probing area
Thomas Weißschuh [Fri, 12 Jan 2024 07:47:50 +0000 (08:47 +0100)] 
libblkid: avoid aligning out of probing area

When reading from the end of the device the IO size alignment could
enlarge the read buffer outside of the probing area.
This would then trigger a read failure.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibblkid: constify return values of blkid_probe_get_sb
Thomas Weißschuh [Fri, 12 Jan 2024 06:47:12 +0000 (07:47 +0100)] 
libblkid: constify return values of blkid_probe_get_sb

The macro contains a cast, removing the constness of
blkid_probe_get_sb_buffer(). Readd the constness and adapt the callers.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoinclude/c.h: handle members of const struct
Thomas Weißschuh [Fri, 12 Jan 2024 06:51:39 +0000 (07:51 +0100)] 
include/c.h: handle members of const struct

Trying to copy into a local const struct will lead to a compiler error.
By adding a "+ 0" to the argument of __typeof__() the type of the
resulting express will loose its constness.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agolibfdisk: add shortcut for Linux extended boot
Thomas Weißschuh [Thu, 11 Jan 2024 20:50:08 +0000 (21:50 +0100)] 
libfdisk: add shortcut for Linux extended boot

See #2670

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoMerge branch 'PR/libblkid-hfsplus' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 11 Jan 2024 16:48:19 +0000 (17:48 +0100)] 
Merge branch 'PR/libblkid-hfsplus' of github.com:karelzak/util-linux-work

* 'PR/libblkid-hfsplus' of github.com:karelzak/util-linux-work:
  libblkid: (hfsplus) reduce false positive

22 months agolsblk: add docs for filters and counters
Karel Zak [Thu, 11 Jan 2024 16:00:25 +0000 (17:00 +0100)] 
lsblk: add docs for filters and counters

Fixes: https://github.com/util-linux/util-linux/issues/2697
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agoMerge branch 'login' of https://github.com/stoeckmann/util-linux
Karel Zak [Thu, 11 Jan 2024 14:43:50 +0000 (15:43 +0100)] 
Merge branch 'login' of https://github.com/stoeckmann/util-linux

* 'login' of https://github.com/stoeckmann/util-linux:
  login: document blank treatment in shell field
  login: unify pw_shell script test
  login: simplify name creation

22 months agolibblkid: (hfsplus) reduce false positive
Karel Zak [Wed, 10 Jan 2024 08:35:35 +0000 (09:35 +0100)] 
libblkid: (hfsplus) reduce false positive

Fixes: https://github.com/util-linux/util-linux/issues/2692
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agobash-completion: update for mkswap
Karel Zak [Thu, 11 Jan 2024 14:36:19 +0000 (15:36 +0100)] 
bash-completion: update for mkswap

Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agoMerge branch 'mkswapfile' of https://github.com/endrift/util-linux
Karel Zak [Thu, 11 Jan 2024 14:28:48 +0000 (15:28 +0100)] 
Merge branch 'mkswapfile' of https://github.com/endrift/util-linux

* 'mkswapfile' of https://github.com/endrift/util-linux:
  mkswap: implement --file

22 months agoMerge branch 'include/parttypes' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 11 Jan 2024 14:25:43 +0000 (15:25 +0100)] 
Merge branch 'include/parttypes' of https://github.com/t-8ch/util-linux

* 'include/parttypes' of https://github.com/t-8ch/util-linux:
  include: add U-Boot environment partition type
  include: add some more ChromeOS partition types

22 months agolibfdisk: constify builtin fdisk_parttype
Thomas Weißschuh [Thu, 11 Jan 2024 07:12:45 +0000 (08:12 +0100)] 
libfdisk: constify builtin fdisk_parttype

The builtin struct fdisk_parttypes are not supposed to be modified.
This is enforced in the mutation functions.

While the API could be cleaned up to distinguish between const and
non-const versions of fdisk_parttype this could break user code.

Instead preserve the API and add some internal casts.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoinclude: add U-Boot environment partition type
Thomas Weißschuh [Thu, 11 Jan 2024 06:37:21 +0000 (07:37 +0100)] 
include: add U-Boot environment partition type

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agoinclude: add some more ChromeOS partition types
Thomas Weißschuh [Thu, 11 Jan 2024 06:37:14 +0000 (07:37 +0100)] 
include: add some more ChromeOS partition types

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agologin: document blank treatment in shell field
Tobias Stoeckmann [Tue, 9 Jan 2024 20:07:39 +0000 (21:07 +0100)] 
login: document blank treatment in shell field

If the shell field contains a blank, then the shell field is
interpreted as a shell script.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
22 months agolosetup: improve "sector boundary" warning
Karel Zak [Tue, 9 Jan 2024 12:05:30 +0000 (13:05 +0100)] 
losetup: improve "sector boundary" warning

Fixes: https://github.com/util-linux/util-linux/issues/2689
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agohardlink: fix fiemap use
Karel Zak [Tue, 9 Jan 2024 11:59:24 +0000 (12:59 +0100)] 
hardlink: fix fiemap use

Handle cases where the number of fm_mapped_extents is zero by ignoring
the fm_extents array, as zero is a valid value.

Fixes: https://github.com/util-linux/util-linux/issues/2687
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agolsblk: explain FSAVAIL in better way
Karel Zak [Tue, 9 Jan 2024 11:45:53 +0000 (12:45 +0100)] 
lsblk: explain FSAVAIL in better way

Addresses: https://github.com/util-linux/util-linux/discussions/2690
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agomkswap: implement --file
Vicki Pfau [Sat, 6 Jan 2024 03:50:29 +0000 (19:50 -0800)] 
mkswap: implement --file

Addresses #2359

Signed-off-by: Vicki Pfau <vi@endrift.com>
22 months agorunuser|su: Start supporting option -T|--no-pty
Sebastian Pipping [Fri, 5 Jan 2024 23:46:49 +0000 (00:46 +0100)] 
runuser|su: Start supporting option -T|--no-pty

.. to pave the way for a future with -P|--pty for a default.

22 months agorunuser.1.adoc: Move -m|-p|--preserve-environment in order
Sebastian Pipping [Fri, 5 Jan 2024 23:43:20 +0000 (00:43 +0100)] 
runuser.1.adoc: Move -m|-p|--preserve-environment in order

.. for alphabetical order and to match sibling file su.1.adoc.

22 months agoMerge branch 'libmount/tests/root' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 8 Jan 2024 09:37:54 +0000 (10:37 +0100)] 
Merge branch 'libmount/tests/root' of https://github.com/t-8ch/util-linux

* 'libmount/tests/root' of https://github.com/t-8ch/util-linux:
  libmount: (tests) don't require root for update tests

22 months agoMerge branch 'tests--lsfd--mkfds-inotify-on-btrfs' of https://github.com/masatake...
Karel Zak [Mon, 8 Jan 2024 09:37:09 +0000 (10:37 +0100)] 
Merge branch 'tests--lsfd--mkfds-inotify-on-btrfs' of https://github.com/masatake/util-linux

* 'tests--lsfd--mkfds-inotify-on-btrfs' of https://github.com/masatake/util-linux:
  tests: (lsfd) add a case testing INOTIFY.INODES.RAW column on btrfs
  tests: (test_mkfds::inotify) add "dir" and "file" parameters
  tests: (lsfd::mkfds-inotify) use findmnt(1) instead of stat(1) to get bdev numbers

22 months agolibmount: don't assume errno after failed asprintf()
Karel Zak [Mon, 8 Jan 2024 09:32:54 +0000 (10:32 +0100)] 
libmount: don't assume errno after failed asprintf()

Reported-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agoMerge branch 'patch-24' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 8 Jan 2024 09:27:24 +0000 (10:27 +0100)] 
Merge branch 'patch-24' of https://github.com/mariobl/util-linux

* 'patch-24' of https://github.com/mariobl/util-linux:
  hexdump: Add missing section header in man page

22 months agoMerge branch 'patch-25' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 8 Jan 2024 09:26:53 +0000 (10:26 +0100)] 
Merge branch 'patch-25' of https://github.com/mariobl/util-linux

* 'patch-25' of https://github.com/mariobl/util-linux:
  write: Add missing section header in man page

22 months agoMerge branch 'patch-23' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 8 Jan 2024 09:26:40 +0000 (10:26 +0100)] 
Merge branch 'patch-23' of https://github.com/mariobl/util-linux

* 'patch-23' of https://github.com/mariobl/util-linux:
  fadvise: Fix markup in man page

22 months agoMerge branch 'patch-21' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 8 Jan 2024 09:25:54 +0000 (10:25 +0100)] 
Merge branch 'patch-21' of https://github.com/mariobl/util-linux

* 'patch-21' of https://github.com/mariobl/util-linux:
  fstab: Fix markup in man page

22 months agoMerge branch 'patch-20' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 8 Jan 2024 09:25:37 +0000 (10:25 +0100)] 
Merge branch 'patch-20' of https://github.com/mariobl/util-linux

* 'patch-20' of https://github.com/mariobl/util-linux:
  uuidd: Fix markup in man page (uuidd.8)

22 months agoMerge branch 'patch-16' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 8 Jan 2024 09:24:58 +0000 (10:24 +0100)] 
Merge branch 'patch-16' of https://github.com/mariobl/util-linux

* 'patch-16' of https://github.com/mariobl/util-linux:
  sfdisk: Fix markup in man page

22 months agoMerge branch 'patch-17' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 8 Jan 2024 09:24:07 +0000 (10:24 +0100)] 
Merge branch 'patch-17' of https://github.com/mariobl/util-linux

* 'patch-17' of https://github.com/mariobl/util-linux:
  hardlink: Fix markup in man page

22 months agoMerge branch 'patch-18' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 8 Jan 2024 09:23:38 +0000 (10:23 +0100)] 
Merge branch 'patch-18' of https://github.com/mariobl/util-linux

* 'patch-18' of https://github.com/mariobl/util-linux:
  lsclocks: Fix markup and typos in man page

22 months agoMerge branch 'patch-19' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 8 Jan 2024 09:23:09 +0000 (10:23 +0100)] 
Merge branch 'patch-19' of https://github.com/mariobl/util-linux

* 'patch-19' of https://github.com/mariobl/util-linux:
  lsfd: Fix typos in man page

22 months agoMerge branch 'patch-22' of https://github.com/mariobl/util-linux
Karel Zak [Mon, 8 Jan 2024 09:22:31 +0000 (10:22 +0100)] 
Merge branch 'patch-22' of https://github.com/mariobl/util-linux

* 'patch-22' of https://github.com/mariobl/util-linux:
  mount: Fix markup and typos in man page

22 months agoMerge branch 'hwclock-set-jitter' of https://github.com/badgerious/util-linux
Karel Zak [Mon, 8 Jan 2024 09:08:05 +0000 (10:08 +0100)] 
Merge branch 'hwclock-set-jitter' of https://github.com/badgerious/util-linux

* 'hwclock-set-jitter' of https://github.com/badgerious/util-linux:
  hwclock: Improve set error in the face of jitter

22 months agolibmount: (tests) don't require root for update tests
Thomas Weißschuh [Sat, 6 Jan 2024 08:52:42 +0000 (09:52 +0100)] 
libmount: (tests) don't require root for update tests

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
22 months agotests: (lsfd) add a case testing INOTIFY.INODES.RAW column on btrfs
Masatake YAMATO [Fri, 5 Jan 2024 14:31:05 +0000 (23:31 +0900)] 
tests: (lsfd) add a case testing INOTIFY.INODES.RAW column on btrfs

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (test_mkfds::inotify) add "dir" and "file" parameters
Masatake YAMATO [Fri, 5 Jan 2024 14:25:49 +0000 (23:25 +0900)] 
tests: (test_mkfds::inotify) add "dir" and "file" parameters

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agotests: (lsfd::mkfds-inotify) use findmnt(1) instead of stat(1) to get bdev numbers
Masatake YAMATO [Fri, 5 Jan 2024 08:54:36 +0000 (17:54 +0900)] 
tests: (lsfd::mkfds-inotify) use findmnt(1) instead of stat(1) to get bdev numbers

Close #2349

stat(2) on some filesystems including btrfs reports a block device
number (bdev number) with a offset. On the other hand, "inotify wd"
field of /proc/$pid/fdinfo/$fd for an inotify file reports bdev
numbers without offsets.

The offset caused the failure of lsfd::mkfds-inotify test case on
btrfs.  Unlike stat(2), findmnt can report bdev numbers without
offsets.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
22 months agowrite: Add missing section header in man page
Mario Blättermann [Thu, 4 Jan 2024 20:59:43 +0000 (21:59 +0100)] 
write: Add missing section header in man page

22 months agohexdump: Add missing section header in man page
Mario Blättermann [Thu, 4 Jan 2024 20:58:04 +0000 (21:58 +0100)] 
hexdump: Add missing section header in man page

22 months agofadvise: Fix markup in man page
Mario Blättermann [Thu, 4 Jan 2024 19:58:53 +0000 (20:58 +0100)] 
fadvise: Fix markup in man page

22 months agomount: Fix markup and typos in man page
Mario Blättermann [Thu, 4 Jan 2024 16:30:27 +0000 (17:30 +0100)] 
mount: Fix markup and typos in man page

22 months agofstab: Fix markup in man page
Mario Blättermann [Thu, 4 Jan 2024 16:22:33 +0000 (17:22 +0100)] 
fstab: Fix markup in man page

22 months agouuidd: Fix markup in man page (uuidd.8)
Mario Blättermann [Thu, 4 Jan 2024 16:20:44 +0000 (17:20 +0100)] 
uuidd: Fix markup in man page (uuidd.8)

22 months agolsfd: Fix typos in man page
Mario Blättermann [Thu, 4 Jan 2024 16:18:20 +0000 (17:18 +0100)] 
lsfd: Fix typos in man page

22 months agolsclocks: Fix markup and typos in man page
Mario Blättermann [Thu, 4 Jan 2024 16:15:29 +0000 (17:15 +0100)] 
lsclocks: Fix markup and typos in man page

22 months agohardlink: Fix markup in man page
Mario Blättermann [Thu, 4 Jan 2024 16:13:01 +0000 (17:13 +0100)] 
hardlink: Fix markup in man page

22 months agosfdisk: Fix markup in man page
Mario Blättermann [Thu, 4 Jan 2024 16:10:01 +0000 (17:10 +0100)] 
sfdisk: Fix markup in man page

22 months agoautotools: add missing dist_noinst_DATA
Karel Zak [Thu, 4 Jan 2024 10:54:23 +0000 (11:54 +0100)] 
autotools: add missing dist_noinst_DATA

Addresses: https://github.com/util-linux/util-linux/pull/2668
Signed-off-by: Karel Zak <kzak@redhat.com>
22 months agoMerge branch 'patch-15' of https://github.com/mariobl/util-linux
Karel Zak [Thu, 4 Jan 2024 10:53:27 +0000 (11:53 +0100)] 
Merge branch 'patch-15' of https://github.com/mariobl/util-linux

* 'patch-15' of https://github.com/mariobl/util-linux:
  man: Add enosys and lsclocks to po4a.cfg

22 months agoMerge branch 'patch-14' of https://github.com/mariobl/util-linux
Karel Zak [Thu, 4 Jan 2024 10:52:08 +0000 (11:52 +0100)] 
Merge branch 'patch-14' of https://github.com/mariobl/util-linux

* 'patch-14' of https://github.com/mariobl/util-linux:
  lsclocks: Fix markup in man page

22 months agoMerge branch 'wipefs/improvements' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 4 Jan 2024 10:51:40 +0000 (11:51 +0100)] 
Merge branch 'wipefs/improvements' of https://github.com/t-8ch/util-linux

* 'wipefs/improvements' of https://github.com/t-8ch/util-linux:
  wipefs: allow storage of backups in specific location
  wipefs: (tests) remove necessity of root permissions

22 months agoMerge branch 'PR/dmesg-timestamps' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 4 Jan 2024 10:50:19 +0000 (11:50 +0100)] 
Merge branch 'PR/dmesg-timestamps' of github.com:karelzak/util-linux-work

* 'PR/dmesg-timestamps' of github.com:karelzak/util-linux-work:
  Dividing tests into subtest based on recommendation from review
  util-linux/sys-utils test dmesg support for additional human-readable timestamp
  dmesg: man and coding style changes
  dmesg: support for additional human readable timestamp

23 months agohwclock: Improve set error in the face of jitter
Eric Badger [Wed, 3 Jan 2024 21:11:43 +0000 (13:11 -0800)] 
hwclock: Improve set error in the face of jitter

set_hardware_clock_exact() spins in a loop, trying to exit when we are
`delay` seconds from an integer time on the system clock. However, there
might be jitter which causes an exit a little bit later than ideal.

The prior code could cause a relatively small error in loop exit time to
produce a relatively large error in the RTC.

For example, suppose upon exit from the loop, we have:

    sethwtime=1704239206
    refsystime=1704239206.000000
    nowsystime=1704239206.500372
    delay=0.5

In this case, the error is very small: 0.000372. However, we will
compute:

    newhwtime = 1704239206 + ceil(0.500371 - 0.5) = 1704239207

And in slightly less than `delay` seconds, the system clock will be
1704239207 while the RTC will be approximately 1704239208, about 1
second of error.

We are better off rounding in this case. The RTC will be behind the
system clock, but only very slightly:

    newhwtime = 1704239206 + round(0.500371 - 0.5) = 1704239206

I find passing `--ul-debug 0xffff` readily produces the original issue.

Signed-off-by: Eric Badger <ebadger@purestorage.com>
23 months agolibmount: reduce utab.lock permissions
Karel Zak [Wed, 3 Jan 2024 13:40:07 +0000 (14:40 +0100)] 
libmount: reduce utab.lock permissions

Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agolibmount: introduce /run/mount/utab.event
Karel Zak [Wed, 3 Jan 2024 13:13:28 +0000 (14:13 +0100)] 
libmount: introduce /run/mount/utab.event

The mnt_monitor_...() API uses /run/mount/utab.lock to monitor utab
changes. The same file is used to control access to the utab file.

The utab can be updated more than once during one mount(8) call, for
example, one update is done in /sbin/mount.nfs and next in mount(8).
This situation triggers two (e.g. inotify) events when monitoring is
based on the lock file.

It seems better to introduce separate file to trigger the event and do
not trigger this event in /sbin/mount.<type> helpers.

References: 477401f0de404aafbc7630f70c2f8b1d670e32f8
Signed-off-by: Karel Zak <kzak@redhat.com>
23 months agolibmount: add mnt_context_within_helper() wrapper
Karel Zak [Wed, 3 Jan 2024 11:38:21 +0000 (12:38 +0100)] 
libmount: add mnt_context_within_helper() wrapper

Signed-off-by: Karel Zak <kzak@redhat.com>