]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
8 days agohwclock: free temporary variable before return master
Karel Zak [Thu, 2 May 2024 11:14:17 +0000 (13:14 +0200)] 
hwclock: free temporary variable before return

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agoagetty: make reload code more robust
Karel Zak [Thu, 2 May 2024 08:54:04 +0000 (10:54 +0200)] 
agetty: make reload code more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agolibmount: fix possible memory leak
Karel Zak [Thu, 2 May 2024 08:15:29 +0000 (10:15 +0200)] 
libmount: fix possible memory leak

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agowall: check sysconf() returnvalue
Karel Zak [Thu, 2 May 2024 08:07:04 +0000 (10:07 +0200)] 
wall: check sysconf() returnvalue

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agogetopt: remove free-before-exit
Karel Zak [Tue, 30 Apr 2024 09:06:49 +0000 (11:06 +0200)] 
getopt: remove free-before-exit

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agofsck.minix: fix possible overrun
Karel Zak [Tue, 30 Apr 2024 09:04:32 +0000 (11:04 +0200)] 
fsck.minix: fix possible overrun

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agoagetty: fix resource leak
Karel Zak [Tue, 30 Apr 2024 09:01:06 +0000 (11:01 +0200)] 
agetty: fix resource leak

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agosuL fix use after free on error
Karel Zak [Tue, 30 Apr 2024 08:51:50 +0000 (10:51 +0200)] 
suL fix use after free on error

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agocal: use unsigned int to follow union with unsigned int
Karel Zak [Mon, 29 Apr 2024 13:33:07 +0000 (15:33 +0200)] 
cal: use unsigned int to follow union with unsigned int

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agowall: fix possible memory leak
Karel Zak [Mon, 29 Apr 2024 13:25:58 +0000 (15:25 +0200)] 
wall: fix possible memory leak

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agohwclock: initialize parser variables
Karel Zak [Mon, 29 Apr 2024 13:21:20 +0000 (15:21 +0200)] 
hwclock: initialize parser variables

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agolsclocks: fix FD leak
Karel Zak [Mon, 29 Apr 2024 13:17:53 +0000 (15:17 +0200)] 
lsclocks: fix FD leak

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agolibfdisk: add initializer to geometry
Karel Zak [Mon, 29 Apr 2024 12:59:44 +0000 (14:59 +0200)] 
libfdisk: add initializer to geometry

Signed-off-by: Karel Zak <kzak@redhat.com>
8 days agowall: make sure unsigned variable not underflow
Karel Zak [Mon, 29 Apr 2024 12:55:16 +0000 (14:55 +0200)] 
wall: make sure unsigned variable not underflow

Signed-off-by: Karel Zak <kzak@redhat.com>
9 days agoMerge branch 'PR/libsmartcols-reduce-fix' of github.com:karelzak/util-linux-work
Karel Zak [Wed, 1 May 2024 19:23:03 +0000 (21:23 +0200)] 
Merge branch 'PR/libsmartcols-reduce-fix' of github.com:karelzak/util-linux-work

* 'PR/libsmartcols-reduce-fix' of github.com:karelzak/util-linux-work:
  libsmartcols: fix column reduction

9 days agoMerge branch 'bcachefs_correct_max_size_constant' of https://github.com/tasleson...
Karel Zak [Wed, 1 May 2024 19:20:50 +0000 (21:20 +0200)] 
Merge branch 'bcachefs_correct_max_size_constant' of https://github.com/tasleson/util-linux

* 'bcachefs_correct_max_size_constant' of https://github.com/tasleson/util-linux:
  bcachefs: Remove BCACHEFS_SB_MAX_SIZE & check

9 days agoMerge branch 'lsfd/fcntl' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 1 May 2024 19:17:52 +0000 (21:17 +0200)] 
Merge branch 'lsfd/fcntl' of https://github.com/t-8ch/util-linux

* 'lsfd/fcntl' of https://github.com/t-8ch/util-linux:
  lsfd: include buffer.h in decode-file-flags.h
  buffer: replace include of c.h with stddef.h
  lsfd: move interface of decode-file-flags to header

10 days agobcachefs: Remove BCACHEFS_SB_MAX_SIZE & check
Tony Asleson [Mon, 29 Apr 2024 18:04:12 +0000 (13:04 -0500)] 
bcachefs: Remove BCACHEFS_SB_MAX_SIZE & check

This constant had an incorrect value.  However, the code already
does a max. size check which is correct.

Note: bcachefs can theoretically have a superblock of 32MiB, but
this is very unlikely to happen.

Signed-off-by: Tony Asleson <tasleson@redhat.com>
10 days agolibsmartcols: fix column reduction
Karel Zak [Tue, 30 Apr 2024 08:26:09 +0000 (10:26 +0200)] 
libsmartcols: fix column reduction

4013986: libsmartcols:      TAB: [0x5626b97f8e10]: #5 reduce stage (width=38, term=1)
4013986: libsmartcols:      COL: [0x5626b97f9130]:  [01] (null) reduced 2-->18446744073709551615

Fixes: https://github.com/util-linux/util-linux/issues/3003
Signed-off-by: Karel Zak <kzak@redhat.com>
11 days agolosetup.8: Clarify --direct-io
Colin Walters [Mon, 29 Apr 2024 19:45:56 +0000 (15:45 -0400)] 
losetup.8: Clarify --direct-io

See e.g. https://github.com/containers/bootc/pull/375#issuecomment-1981109022

The phrasing here was in my opinion technically correct but quite confusing and easy to misunderstand.

Let's be very clear:

- The default is *off*
- You can turn it on in two ways
- You can also explicitly turn it off

Signed-off-by: Colin Walters <walters@verbum.org>
11 days agolastlog2: begin descriptions of options with a lowercase letter
Benno Schulenberg [Tue, 26 Mar 2024 15:48:22 +0000 (16:48 +0100)] 
lastlog2: begin descriptions of options with a lowercase letter

These descriptions are not full sentences and do not end with a period,
so they should not start with a capital either.

(cherry picked from commit 991cb1568a7b3770e33d68c4df49a97068ac8588)

11 days agotextual: fix some typos and inconsistencies in usage and error messages
Benno Schulenberg [Tue, 26 Mar 2024 15:48:21 +0000 (16:48 +0100)] 
textual: fix some typos and inconsistencies in usage and error messages

Reported-by: Petr Pisar <petr.pisar@atlas.cz>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
(cherry picked from commit eeeb3dc9e662c8cf0383fb109bc5e7d2e2fa7a98)

11 days agoMerge branch 'lsfd/fcntl.h' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 29 Apr 2024 08:27:17 +0000 (10:27 +0200)] 
Merge branch 'lsfd/fcntl.h' of https://github.com/t-8ch/util-linux

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

11 days agoMerge branch 'lsns--debug-ioctl_ns-test-for-master' of https://github.com/masatake...
Karel Zak [Mon, 29 Apr 2024 08:26:25 +0000 (10:26 +0200)] 
Merge branch 'lsns--debug-ioctl_ns-test-for-master' of https://github.com/masatake/util-linux

* 'lsns--debug-ioctl_ns-test-for-master' of https://github.com/masatake/util-linux:
  tests: (lsns::ioctl_ns) add more debug print
  tests: (lsns::ioctl_ns) record stdout/stderr for debugging the case

11 days agoMerge branch 'PR/flock-fcntl' of github.com:karelzak/util-linux-work
Karel Zak [Mon, 29 Apr 2024 08:25:17 +0000 (10:25 +0200)] 
Merge branch 'PR/flock-fcntl' of github.com:karelzak/util-linux-work

* 'PR/flock-fcntl' of github.com:karelzak/util-linux-work:
  flock: add support for using fcntl() with open file description locks

11 days agocoresched: Manage core scheduling cookies for tasks
Thijs Raymakers [Thu, 25 Apr 2024 16:22:25 +0000 (18:22 +0200)] 
coresched: Manage core scheduling cookies for tasks

Co-authored-by: Phil Auld <pauld@redhat.com>
Signed-off-by: Phil Auld <pauld@redhat.com>
Signed-off-by: Thijs Raymakers <thijs@raymakers.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
12 days agolsfd: include linux/fcntl.h
Thomas Weißschuh [Sun, 28 Apr 2024 21:35:12 +0000 (23:35 +0200)] 
lsfd: include linux/fcntl.h

asm/-headers are implementation details and not meant to be included
directly. Instead use the linux/ header which will always include the
correct asm/-headers.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 days agolsfd: include buffer.h in decode-file-flags.h
Thomas Weißschuh [Sun, 28 Apr 2024 21:23:47 +0000 (23:23 +0200)] 
lsfd: include buffer.h in decode-file-flags.h

buffer.h does not pull in the full c.h with it side-effects,
so it can be used now.

Drop the now unnecessary extern declarations.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 days agobuffer: replace include of c.h with stddef.h
Thomas Weißschuh [Sun, 28 Apr 2024 21:18:48 +0000 (23:18 +0200)] 
buffer: replace include of c.h with stddef.h

The interface of the buffer library only requires size_t.
It's enough to include stddef.h for that.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
12 days agolsfd: move interface of decode-file-flags to header
Thomas Weißschuh [Sun, 28 Apr 2024 21:22:13 +0000 (23:22 +0200)] 
lsfd: move interface of decode-file-flags to header

Use a proper header file to declare lsfd_decode_file_flags().

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2 weeks agoflock: add support for using fcntl() with open file description locks
Rasmus Villemoes [Thu, 25 Apr 2024 09:44:17 +0000 (11:44 +0200)] 
flock: add support for using fcntl() with open file description locks

Currently, there is no way for shell scripts to safely access
resources protected by POSIX locking (fcntl with the F_SETLK/F_SETLKW
commands). For example, the glibc function lckpwdf(), used to
protect access to the /etc/shadow database, works by taking a
F_SETLKW on /etc/.pwd.lock .

Due to the odd semantics of POSIX locking (e.g. released when any file
descriptor associated to the inode is closed), we cannot usefully
directly expose the POSIX F_SETLK/F_SETLKW commands. However, linux
3.15 introduced F_OFD_SETLK[W], with semantics wrt. ownership and
release better matching those of flock(2), and crucially they do
conflict with locks obtained via F_SETLK[W]. With this, a shell script
can do

  exec 4> /etc/.pwd.lock
  flock --fcntl 4
  <access/modify /etc/shadow ...>
  flock --fcntl --unlock 4 # or just exit

without conflicting with passwd(1) or other utilities that
access/modify /etc/shadow.

No single-letter shorthand is defined for the option, because this is
somewhat low-level and the user really needs to know what he is doing.

Also, this leaves the door open for teaching --fcntl to accept an
optional argument: "ofd", the default, and "posix", should anyone find
a use for flock(1) taking a F_SETLK[W] lock.

Signed-off-by: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
2 weeks agotests: (lsns::ioctl_ns) add more debug print
Masatake YAMATO [Tue, 16 Apr 2024 22:49:40 +0000 (07:49 +0900)] 
tests: (lsns::ioctl_ns) add more debug print

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

2 weeks agotests: (lsns::ioctl_ns) record stdout/stderr for debugging the case
Masatake YAMATO [Tue, 16 Apr 2024 20:57:45 +0000 (05:57 +0900)] 
tests: (lsns::ioctl_ns) record stdout/stderr for debugging the case

When the test case runs successfully, we expect the case test prints
nothing to stderr. If something is printed to stderr, it helps us
debug lsns command and the test case.

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

2 weeks agoMerge branch 'meson-more-build-options' of https://github.com/jwillikers/util-linux
Karel Zak [Thu, 25 Apr 2024 09:22:32 +0000 (11:22 +0200)] 
Merge branch 'meson-more-build-options' of https://github.com/jwillikers/util-linux

* 'meson-more-build-options' of https://github.com/jwillikers/util-linux: (21 commits)
  meson: Add build-lsclocks option
  meson: Add build-enosys option
  meson: Define _DARWIN_C_SOURCE on macOS as is done in Autotools
  strutils.h: Include strings.h header for strncasecmp function
  xalloc.h: Include stdio.h header for vasprintf function
  meson: Fix build by default and install behavior for build-pipesz option
  meson: Add build-fadvise option
  meson: Add build-scriptlive option
  meson: Add build-script option
  meson: Require pty for the su and runuser executables
  meson: Add have_pty variable to check if pty is available
  meson: Add build-blockdev option
  meson: Add build-chcpu option
  meson: Use has_type instead of sizeof to detect cpu_set_t type
  meson: Add build-setarch option
  meson: Add build-rtcwake option
  meson: Add build-ldattach option
  meson: Add build-blkdiscard option
  meson: Add build-fsfreeze option
  meson: Add build-blkzone option
  ...

2 weeks agomeson: Add build-lsclocks option
Jordan Williams [Tue, 23 Apr 2024 12:45:24 +0000 (07:45 -0500)] 
meson: Add build-lsclocks option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-enosys option
Jordan Williams [Tue, 23 Apr 2024 12:43:00 +0000 (07:43 -0500)] 
meson: Add build-enosys option

Add a check to ensure that the linux/audit.h header exists for enosys.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Define _DARWIN_C_SOURCE on macOS as is done in Autotools
Jordan Williams [Mon, 22 Apr 2024 20:03:50 +0000 (15:03 -0500)] 
meson: Define _DARWIN_C_SOURCE on macOS as is done in Autotools

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agostrutils.h: Include strings.h header for strncasecmp function
Jordan Williams [Mon, 22 Apr 2024 19:51:40 +0000 (14:51 -0500)] 
strutils.h: Include strings.h header for strncasecmp function

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agoxalloc.h: Include stdio.h header for vasprintf function
Jordan Williams [Mon, 22 Apr 2024 19:51:09 +0000 (14:51 -0500)] 
xalloc.h: Include stdio.h header for vasprintf function

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Fix build by default and install behavior for build-pipesz option
Jordan Williams [Mon, 22 Apr 2024 19:35:50 +0000 (14:35 -0500)] 
meson: Fix build by default and install behavior for build-pipesz option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-fadvise option
Jordan Williams [Mon, 22 Apr 2024 19:33:49 +0000 (14:33 -0500)] 
meson: Add build-fadvise option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-scriptlive option
Jordan Williams [Mon, 22 Apr 2024 16:08:26 +0000 (11:08 -0500)] 
meson: Add build-scriptlive option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-script option
Jordan Williams [Mon, 22 Apr 2024 16:06:48 +0000 (11:06 -0500)] 
meson: Add build-script option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Require pty for the su and runuser executables
Jordan Williams [Mon, 22 Apr 2024 16:04:36 +0000 (11:04 -0500)] 
meson: Require pty for the su and runuser executables

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add have_pty variable to check if pty is available
Jordan Williams [Mon, 22 Apr 2024 16:02:39 +0000 (11:02 -0500)] 
meson: Add have_pty variable to check if pty is available

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-blockdev option
Jordan Williams [Mon, 22 Apr 2024 14:42:25 +0000 (09:42 -0500)] 
meson: Add build-blockdev option

Only build blockdev on Linux.
The BLKROSET macro is used in blockdev.c from blkdev.h.
The blkdev.h header only defines this macro when it is missing on Linux.

Add blockdev to the list of executables, which appears to have been
omitted previously.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-chcpu option
Jordan Williams [Mon, 22 Apr 2024 14:14:26 +0000 (09:14 -0500)] 
meson: Add build-chcpu option

The cpu_set_t type does not exist on macOS.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Use has_type instead of sizeof to detect cpu_set_t type
Jordan Williams [Mon, 22 Apr 2024 14:28:04 +0000 (09:28 -0500)] 
meson: Use has_type instead of sizeof to detect cpu_set_t type

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-setarch option
Jordan Williams [Tue, 23 Apr 2024 13:39:12 +0000 (08:39 -0500)] 
meson: Add build-setarch option

The sys/personality.h header does not exist on macOS.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-rtcwake option
Jordan Williams [Mon, 22 Apr 2024 14:03:52 +0000 (09:03 -0500)] 
meson: Add build-rtcwake option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-ldattach option
Jordan Williams [Mon, 22 Apr 2024 13:57:40 +0000 (08:57 -0500)] 
meson: Add build-ldattach option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-blkdiscard option
Jordan Williams [Wed, 24 Apr 2024 20:30:26 +0000 (15:30 -0500)] 
meson: Add build-blkdiscard option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-fsfreeze option
Jordan Williams [Wed, 24 Apr 2024 20:29:08 +0000 (15:29 -0500)] 
meson: Add build-fsfreeze option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agodocs: fix GPL name typo
Karel Zak [Wed, 24 Apr 2024 10:05:25 +0000 (12:05 +0200)] 
docs: fix GPL name typo

References: https://github.com/util-linux/util-linux/pull/2988
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoMerge branch 'lsfd' of https://github.com/jwilk-forks/util-linux
Karel Zak [Wed, 24 Apr 2024 10:01:57 +0000 (12:01 +0200)] 
Merge branch 'lsfd' of https://github.com/jwilk-forks/util-linux

* 'lsfd' of https://github.com/jwilk-forks/util-linux:
  lsfd: (man) add commas between SEE ALSO items
  lsfd: (man) fix license name
  lsfd: (man) fix typos

2 weeks agoMerge branch 'PR/libmount-fix-umount-r' of github.com:karelzak/util-linux-work
Karel Zak [Wed, 24 Apr 2024 10:01:40 +0000 (12:01 +0200)] 
Merge branch 'PR/libmount-fix-umount-r' of github.com:karelzak/util-linux-work

* 'PR/libmount-fix-umount-r' of github.com:karelzak/util-linux-work:
  libmount: fix umount --read-only

2 weeks agoMerge branch 'PR/lsns-fix-netns' of github.com:karelzak/util-linux-work
Karel Zak [Tue, 23 Apr 2024 09:06:05 +0000 (11:06 +0200)] 
Merge branch 'PR/lsns-fix-netns' of github.com:karelzak/util-linux-work

* 'PR/lsns-fix-netns' of github.com:karelzak/util-linux-work:
  lsns: fix netns use

2 weeks agoMerge branch 'PR/libmount-utab-access' of github.com:karelzak/util-linux-work
Karel Zak [Tue, 23 Apr 2024 09:05:42 +0000 (11:05 +0200)] 
Merge branch 'PR/libmount-utab-access' of github.com:karelzak/util-linux-work

* 'PR/libmount-utab-access' of github.com:karelzak/util-linux-work:
  libmount: Fix access check for utab in context

2 weeks agolibmount: fix umount --read-only
Karel Zak [Tue, 23 Apr 2024 08:29:37 +0000 (10:29 +0200)] 
libmount: fix umount --read-only

Reported-by: Krzysztof Olędzki <ole@ans.pl>
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolsfd: (man) add commas between SEE ALSO items
Jakub Wilk [Mon, 22 Apr 2024 13:54:01 +0000 (15:54 +0200)] 
lsfd: (man) add commas between SEE ALSO items

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2 weeks agolsfd: (man) fix license name
Jakub Wilk [Mon, 22 Apr 2024 13:52:04 +0000 (15:52 +0200)] 
lsfd: (man) fix license name

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2 weeks agolsfd: (man) fix typos
Jakub Wilk [Mon, 22 Apr 2024 13:51:47 +0000 (15:51 +0200)] 
lsfd: (man) fix typos

Signed-off-by: Jakub Wilk <jwilk@jwilk.net>
2 weeks agomeson: Add build-blkzone option
Jordan Williams [Mon, 22 Apr 2024 13:48:27 +0000 (08:48 -0500)] 
meson: Add build-blkzone option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agomeson: Add build-blkpr option
Jordan Williams [Mon, 22 Apr 2024 13:46:55 +0000 (08:46 -0500)] 
meson: Add build-blkpr option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
2 weeks agolsns: fix netns use
Karel Zak [Mon, 22 Apr 2024 12:28:52 +0000 (14:28 +0200)] 
lsns: fix netns use

 # ip netns add vpn
 # lsns -T -t net
 Segmentation fault (core dumped)

The function interpolate_missing_namespaces() reads data from /proc.
However, in the case of a persistent namespace, there is no procfs
entry for the namespace. Therefore, this function should ignore it.

Fixes: https://github.com/util-linux/util-linux/issues/2982
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibfdisk: add missing va_end() [coverity scan]
Karel Zak [Mon, 22 Apr 2024 11:55:23 +0000 (13:55 +0200)] 
libfdisk: add missing va_end() [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibmount: Fix access check for utab in context
Karel Zak [Mon, 22 Apr 2024 11:09:04 +0000 (13:09 +0200)] 
libmount: Fix access check for utab in context

The function mnt_has_regular_utab() properly detects that the utab is
not writable, but this is ignored by the high-level context API. As a
result, the library later attempts to update the file and ends up with
a warning in mount(8):

 $ mkdir sys
 $ unshare --map-root-user --mount
 $ mount --rbind /sys sys
 $ umount --lazy sys; echo $?
 umount: /home/user/sys: filesystem was unmounted, but failed to update userspace mount table.
 16

In this case, the utab should be ignored.

Fixes: https://github.com/util-linux/util-linux/issues/2981
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agoMerge branch 'typofix' of https://github.com/uudiin/util-linux
Karel Zak [Mon, 22 Apr 2024 10:05:58 +0000 (12:05 +0200)] 
Merge branch 'typofix' of https://github.com/uudiin/util-linux

* 'typofix' of https://github.com/uudiin/util-linux:
  libmount: fix comment typo for mnt_fs_get_comment()

2 weeks agoMerge branch 'fix' of https://github.com/DaanDeMeyer/util-linux
Karel Zak [Mon, 22 Apr 2024 10:05:20 +0000 (12:05 +0200)] 
Merge branch 'fix' of https://github.com/DaanDeMeyer/util-linux

* 'fix' of https://github.com/DaanDeMeyer/util-linux:
  agetty: Don't override TERM passed by the user

2 weeks agoMerge branch 'lsns--filter-option-in-usage' of https://github.com/masatake/util-linux
Karel Zak [Mon, 22 Apr 2024 10:05:05 +0000 (12:05 +0200)] 
Merge branch 'lsns--filter-option-in-usage' of https://github.com/masatake/util-linux

* 'lsns--filter-option-in-usage' of https://github.com/masatake/util-linux:
  lsns: add --filter option to the --help optout and the completion rule

2 weeks agoMerge branch 'meson-build-dmesg' of https://github.com/jwillikers/util-linux
Karel Zak [Mon, 22 Apr 2024 10:04:25 +0000 (12:04 +0200)] 
Merge branch 'meson-build-dmesg' of https://github.com/jwillikers/util-linux

* 'meson-build-dmesg' of https://github.com/jwillikers/util-linux:
  meson: Add build-dmesg option

2 weeks agoMerge branch 'meson-fix-absolute-check' of https://github.com/jwillikers/util-linux
Karel Zak [Mon, 22 Apr 2024 10:03:51 +0000 (12:03 +0200)] 
Merge branch 'meson-fix-absolute-check' of https://github.com/jwillikers/util-linux

* 'meson-fix-absolute-check' of https://github.com/jwillikers/util-linux:
  meson: Use is_absolute to determine if the prefix directory is absolute

2 weeks agolsblk: simplify SOURCES code
Karel Zak [Mon, 22 Apr 2024 09:51:56 +0000 (11:51 +0200)] 
lsblk: simplify SOURCES code

This complicated implementation originated from an early version of
zero-separated items for libsmartcols. It is no longer necessary.

References: https://github.com/util-linux/util-linux/pull/2983
Signed-off-by: Karel Zak <kzak@redhat.com>
2 weeks agolibmount: fix comment typo for mnt_fs_get_comment()
Tianjia Zhang [Mon, 22 Apr 2024 06:01:25 +0000 (14:01 +0800)] 
libmount: fix comment typo for mnt_fs_get_comment()

Signed-off-by: Tianjia Zhang <tianjia.zhang@linux.alibaba.com>
2 weeks agofindmnt: always zero-terminate SOURCES data
Thomas Weißschuh [Sun, 21 Apr 2024 18:00:31 +0000 (20:00 +0200)] 
findmnt: always zero-terminate SOURCES data

libsmartcols expects it's data fields to be zero terminated.
See the call to strlen() in scols_column_greatest_wrap().
ul_buffer however does not guarantee that termination,
ul_buffer_append_strings() discard the zero-termination.

Always zero-terminate in get_data_col_sources() and drop the now
unnecessary variable "i".

Closes: https://github.com/util-linux/util-linux/issues/2980
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 weeks agoagetty: Don't override TERM passed by the user
Daan De Meyer [Fri, 19 Apr 2024 18:07:47 +0000 (20:07 +0200)] 
agetty: Don't override TERM passed by the user

Before 4869b259d68f65ea88df625ce8df9c0177d55a01, any TERM passed
on the agetty command line would be used instead of the default TERM.
After 4869b259d68f65ea88df625ce8df9c0177d55a01, the default TERM is
used unconditionally.

Fix the regression by checking if the user passed a custom TERM.

Fixes: 4869b259d68f65ea88df625ce8df9c0177d55a01
3 weeks agolsns: add --filter option to the --help optout and the completion rule
Masatake YAMATO [Fri, 19 Apr 2024 17:17:05 +0000 (02:17 +0900)] 
lsns: add --filter option to the --help optout and the completion rule

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 weeks agomeson: Add build-dmesg option
Jordan Williams [Wed, 17 Apr 2024 16:13:59 +0000 (11:13 -0500)] 
meson: Add build-dmesg option

Require the sys/klog.h header to exist in order to enable the feature.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
3 weeks agomeson: Use is_absolute to determine if the prefix directory is absolute
Jordan Williams [Wed, 17 Apr 2024 15:08:40 +0000 (10:08 -0500)] 
meson: Use is_absolute to determine if the prefix directory is absolute

Meson's check for an absolute path does not work on Windows.
Meson 0.54.0 introduced the fs.is_absolute function.
Use this instead.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
3 weeks agodocs: update README
Karel Zak [Thu, 18 Apr 2024 11:15:17 +0000 (13:15 +0200)] 
docs: update README

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoMerge branch 'meson-fix-build-ipcrm-option' of https://github.com/jwillikers/util...
Karel Zak [Thu, 18 Apr 2024 07:42:25 +0000 (09:42 +0200)] 
Merge branch 'meson-fix-build-ipcrm-option' of https://github.com/jwillikers/util-linux

* 'meson-fix-build-ipcrm-option' of https://github.com/jwillikers/util-linux:
  meson: Require the seminfo type for ipcmk, ipcrm, and ipcs
  meson: Add build-ipcmk option
  meson: Add missing check for build-ipcrm option

3 weeks agoMerge branch 'PR/from-coverity' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 18 Apr 2024 07:08:37 +0000 (09:08 +0200)] 
Merge branch 'PR/from-coverity' of github.com:karelzak/util-linux-work

* 'PR/from-coverity' of github.com:karelzak/util-linux-work:
  lslocks: remove deadcode [coverity scan]
  hardlink: use xcalloc rather than xmalloc

3 weeks agoMerge branch 'uuid/variant' of https://github.com/t-8ch/util-linux
Karel Zak [Thu, 18 Apr 2024 07:08:21 +0000 (09:08 +0200)] 
Merge branch 'uuid/variant' of https://github.com/t-8ch/util-linux

* 'uuid/variant' of https://github.com/t-8ch/util-linux:
  uuidparse: only report type/version for DCE variant

3 weeks agoMerge branch 'PR/fdisk-trim' of github.com:karelzak/util-linux-work
Karel Zak [Thu, 18 Apr 2024 07:08:05 +0000 (09:08 +0200)] 
Merge branch 'PR/fdisk-trim' of github.com:karelzak/util-linux-work

* 'PR/fdisk-trim' of github.com:karelzak/util-linux-work:
  blkdiscard: (man) add note about fdisk
  fdisk: add 'T' command to discard sectors
  libfdisk: add fdisk_ask_menu()
  fdisk: improve list_freespace()

3 weeks agomeson: Require the seminfo type for ipcmk, ipcrm, and ipcs
Jordan Williams [Wed, 17 Apr 2024 16:56:09 +0000 (11:56 -0500)] 
meson: Require the seminfo type for ipcmk, ipcrm, and ipcs

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
3 weeks agomeson: Add build-ipcmk option
Jordan Williams [Wed, 17 Apr 2024 16:37:04 +0000 (11:37 -0500)] 
meson: Add build-ipcmk option

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
3 weeks agomeson: Add missing check for build-ipcrm option
Jordan Williams [Wed, 17 Apr 2024 16:11:21 +0000 (11:11 -0500)] 
meson: Add missing check for build-ipcrm option

The build-ipcrm option exists in meson_options.txt but has no effect.
Use the option to gate building the ipcrm executable.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
3 weeks agoMerge branch 'sed' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 17 Apr 2024 11:08:34 +0000 (13:08 +0200)] 
Merge branch 'sed' of https://github.com/t-8ch/util-linux

* 'sed' of https://github.com/t-8ch/util-linux:
  all_errnos/all_syscalls: use sed to extract defines from headers

3 weeks agolslocks: remove deadcode [coverity scan]
Karel Zak [Wed, 17 Apr 2024 10:46:50 +0000 (12:46 +0200)] 
lslocks: remove deadcode [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agohardlink: use xcalloc rather than xmalloc
Karel Zak [Wed, 17 Apr 2024 10:43:30 +0000 (12:43 +0200)] 
hardlink: use xcalloc rather than xmalloc

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoMerge branch 'PR/libsmartcols-fix-wrap' of github.com:karelzak/util-linux-work
Karel Zak [Wed, 17 Apr 2024 07:50:52 +0000 (09:50 +0200)] 
Merge branch 'PR/libsmartcols-fix-wrap' of github.com:karelzak/util-linux-work

* 'PR/libsmartcols-fix-wrap' of github.com:karelzak/util-linux-work:
  libsmartcols: (sample) add wrap repeating example
  libsmartcols: reset wrap after calculation

3 weeks agoblkdiscard: (man) add note about fdisk
Karel Zak [Fri, 12 Apr 2024 09:30:15 +0000 (11:30 +0200)] 
blkdiscard: (man) add note about fdisk

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agofdisk: add 'T' command to discard sectors
Karel Zak [Tue, 16 Apr 2024 11:36:32 +0000 (13:36 +0200)] 
fdisk: add 'T' command to discard sectors

We currently have blkdiscard(8), but it can be difficult to use for
unpartitioned areas or for partitions when working with a whole-disk
device.

This commit adds BLKDISCARD support to fdisk, so that the user does
not have to specify any range, but instead follows the partition
table.

Addresses: https://github.com/util-linux/util-linux/issues/2804
Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolibfdisk: add fdisk_ask_menu()
Karel Zak [Tue, 16 Apr 2024 11:31:55 +0000 (13:31 +0200)] 
libfdisk: add fdisk_ask_menu()

Currently, only libfdisk has the ability to prompt the user with a
menu. However, this functionality is not accessible through the public
library API. This commit exports this functionality through the use of
a simple function, fdisk_ask_menu().

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agouuidparse: only report type/version for DCE variant
Thomas Weißschuh [Wed, 17 Apr 2024 07:27:08 +0000 (09:27 +0200)] 
uuidparse: only report type/version for DCE variant

The type/version is only defined in scope for the DCE variant.

From RFC4122 Section 4.1.1:

"the interpretation of all other bits in the UUID depends on the setting
of the bits in the variant field."

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 weeks agofdisk: improve list_freespace()
Karel Zak [Fri, 12 Apr 2024 09:13:39 +0000 (11:13 +0200)] 
fdisk: improve list_freespace()

Make the function usable in other dialogs:

* Return a table of the free spaces.
* Return the "best" table entry (to be used as the default in
  dialogs).
* Print the order number of entries.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agolsfd: add meson.build for the command
Masatake YAMATO [Tue, 16 Apr 2024 20:32:12 +0000 (05:32 +0900)] 
lsfd: add meson.build for the command

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 weeks agoall_errnos/all_syscalls: use sed to extract defines from headers
Thomas Weißschuh [Tue, 16 Apr 2024 19:56:22 +0000 (21:56 +0200)] 
all_errnos/all_syscalls: use sed to extract defines from headers

Posix-compliant awk does not seem capable of matching lines and
extracting capture groups of them.
Use sed instead.

Reported-by: John Paul Adrian Glaubitz <glaubitz@physik.fu-berlin.de>
Link: https://lore.kernel.org/util-linux/051624b9256db27a731d62c031cb627d9f5a256e.camel@physik.fu-berlin.de/
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 weeks agolsfd: (po-man) update po4a.cfg
Karel Zak [Tue, 16 Apr 2024 09:53:45 +0000 (11:53 +0200)] 
lsfd: (po-man) update po4a.cfg

Signed-off-by: Karel Zak <kzak@redhat.com>
3 weeks agoMerge branch 'lsfd-cmd--dir' of https://github.com/masatake/util-linux
Karel Zak [Tue, 16 Apr 2024 09:36:34 +0000 (11:36 +0200)] 
Merge branch 'lsfd-cmd--dir' of https://github.com/masatake/util-linux

* 'lsfd-cmd--dir' of https://github.com/masatake/util-linux:
  lsfd: move the source code to new ./lsfd-cmd directory