]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
6 months agoinclude/debug: Relicense to Public Domain
Karel Zak [Tue, 4 Feb 2025 09:10:57 +0000 (10:10 +0100)] 
include/debug: Relicense to Public Domain

After reaching an agreement with Ondrej Oprala, we have decided to
change the license of debug.h and debugobj.h from LGPL to Public
Domain. This change is more suitable for the files in the include/
directory of util-linux.

CC: Ondrej Oprala <ondrej.oprala@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoMerge branch 'PR/Benno-text-fixes' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 4 Feb 2025 09:06:22 +0000 (10:06 +0100)] 
Merge branch 'PR/Benno-text-fixes' of https://github.com/karelzak/util-linux-work

* 'PR/Benno-text-fixes' of https://github.com/karelzak/util-linux-work:
  setpriv: describe --groups more correctly in the usage text
  setpriv: consistently use "<caps>" to indicate a list of capabilities
  readprofile: put two things that belong together into a single message
  lsmem: make an error message identical to one used in seven other places
  logger: grammarize the description of --socket-errors in the man page

6 months agoMerge branch 'PR/lscpu-min-freq' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 4 Feb 2025 09:05:48 +0000 (10:05 +0100)] 
Merge branch 'PR/lscpu-min-freq' of https://github.com/karelzak/util-linux-work

* 'PR/lscpu-min-freq' of https://github.com/karelzak/util-linux-work:
  lscpu: skip frequencies of 0 MHz when getting minmhz

6 months agolib/colors: fix fallback to system directory
Thomas Weißschuh [Mon, 3 Feb 2025 20:46:13 +0000 (21:46 +0100)] 
lib/colors: fix fallback to system directory

The current check relies on "*sfile" to recognize if a configuration has
been found in the current directory. However this condition is only true
for "type == UL_COLORFILE_SCHEME", breaking the .enable and .disable
configurations.
Instead reorder the logic a bit so that any valid configuration returns
rc == 0.

Reported-by: Axel <axel.scheepers76@gmail.com>
Link: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1094283
Reported-by: Chris Hofstaedtler <zeha@debian.org>
Link: https://lore.kernel.org/util-linux/Z5a08yD10L1J8AIa@per.namespace.at/
Tested-by: Chris Hofstaedtler <zeha@debian.org>
Fixes: 4bdf22803f9a ("lib/colors: ensure fallback to system directory")
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
6 months agoMerge branch 'PR/libmount-mesgs-idmapping' of https://github.com/karelzak/util-linux...
Karel Zak [Mon, 3 Feb 2025 12:34:52 +0000 (13:34 +0100)] 
Merge branch 'PR/libmount-mesgs-idmapping' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-mesgs-idmapping' of https://github.com/karelzak/util-linux-work:
  libmount: improve error messages in ID-mapping hook
  libmount: add private mnt_context_read_mesgs()
  libmount: reduce size of syscall-failed message

6 months agolscpu: skip frequencies of 0 MHz when getting minmhz
Ricardo Neri [Fri, 31 Jan 2025 03:25:32 +0000 (19:25 -0800)] 
lscpu: skip frequencies of 0 MHz when getting minmhz

read_mhz() sets cpu->mhz_min_freq from /sys/devices/system/cpu/cpuN/
cpufreq/cpuinfo_min_freq. The file read fails if cpuN is offline and
cpu->mhz_min_freq is left as 0. 0 MHz is treated as invalid frequency.

lsblk_cputype_get_minmhz() iterates through all possible CPUs to find the
minimum frequency. If one or more CPUs are offline, the minimum frequency
will be 0. This is reflected in the output of lscpu:

$ ./lscpu | grep min
CPU min MHz:                        0.0000

Ignore 0-MHz frequencies to find the actual minimum frequency:

$ ./lscpu | grep min
CPU min MHz:                     1200.0000

Reported-by: Thangamani Krishnan <thangamani.krishnan@intel.com>
Signed-off-by: Ricardo Neri <ricardo.neri-calderon@linux.intel.com>
6 months agosetpriv: describe --groups more correctly in the usage text
Benno Schulenberg [Sun, 2 Feb 2025 16:38:09 +0000 (17:38 +0100)] 
setpriv: describe --groups more correctly in the usage text

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
6 months agosetpriv: consistently use "<caps>" to indicate a list of capabilities
Benno Schulenberg [Sun, 2 Feb 2025 16:06:23 +0000 (17:06 +0100)] 
setpriv: consistently use "<caps>" to indicate a list of capabilities

The existing "<caps,...>" did not indicate that each capability name
must be preceded by "+" or "-".  Also, to indicate that the list needs
to be separated by commas, one would have to use "<cap>[,...]", not
"<cap,...>".  So... instead of trying to cram all that info in there,
just say "<caps>", like for --bounding-set.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
6 months agoreadprofile: put two things that belong together into a single message
Benno Schulenberg [Thu, 30 Jan 2025 15:50:48 +0000 (16:50 +0100)] 
readprofile: put two things that belong together into a single message

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
6 months agolsmem: make an error message identical to one used in seven other places
Benno Schulenberg [Thu, 30 Jan 2025 14:27:27 +0000 (15:27 +0100)] 
lsmem: make an error message identical to one used in seven other places

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
6 months agologger: grammarize the description of --socket-errors in the man page
Benno Schulenberg [Thu, 30 Jan 2025 14:11:24 +0000 (15:11 +0100)] 
logger: grammarize the description of --socket-errors in the man page

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
6 months agoMerge branch 'PR/mkswap-nocow' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 3 Feb 2025 12:21:51 +0000 (13:21 +0100)] 
Merge branch 'PR/mkswap-nocow' of https://github.com/karelzak/util-linux-work

* 'PR/mkswap-nocow' of https://github.com/karelzak/util-linux-work:
  mkswap: remove unused variable for non-nocow systems
  mkswap: add features list to --version output
  mkswap: fix includes
  mkswap: improve --file option for use on btrfs

6 months agolibmount: improve error messages in ID-mapping hook
Karel Zak [Tue, 28 Jan 2025 12:23:15 +0000 (13:23 +0100)] 
libmount: improve error messages in ID-mapping hook

* save failed syscall status
* allow to read messages from kernel
* add proper error messages if kernel is silent

OLD:
  mount: /foo: mount failed: Unknown error 5013.
NEW:
  mount: /foo: mount_setattr() failed: cannot set ID-mapping: Operation not permitted.

Addresses: https://github.com/util-linux/util-linux/issues/3373
Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolibmount: add private mnt_context_read_mesgs()
Karel Zak [Tue, 28 Jan 2025 12:13:02 +0000 (13:13 +0100)] 
libmount: add private mnt_context_read_mesgs()

Add a more generic function for reading messages from a file
descriptor. The new mount API is already used in multiple files.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolibmount: reduce size of syscall-failed message
Karel Zak [Tue, 28 Jan 2025 12:10:30 +0000 (13:10 +0100)] 
libmount: reduce size of syscall-failed message

The current version is too long.

OLD:
 mount: /mnt/test/fileA: mount_setattr system call failed: cannot set ID-mapping: Operation not permitted.

NEW:
 mount: /mnt/test/fileA: mount_setattr() failed: cannot set ID-mapping: Operation not permitted.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoMerge branch 'PR/dmesg-notime' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 3 Feb 2025 11:32:46 +0000 (12:32 +0100)] 
Merge branch 'PR/dmesg-notime' of https://github.com/karelzak/util-linux-work

* 'PR/dmesg-notime' of https://github.com/karelzak/util-linux-work:
  dmesg: fix --notime use

6 months agomkswap: remove unused variable for non-nocow systems
Karel Zak [Mon, 3 Feb 2025 11:11:24 +0000 (12:11 +0100)] 
mkswap: remove unused variable for non-nocow systems

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agomkswap: add features list to --version output
Karel Zak [Mon, 3 Feb 2025 11:03:10 +0000 (12:03 +0100)] 
mkswap: add features list to --version output

* Define USE_NOCOW to simplify code
* Add array of features

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agomkswap: fix includes
Karel Zak [Mon, 3 Feb 2025 10:48:23 +0000 (11:48 +0100)] 
mkswap: fix includes

It is preferable to use #ifdefs in code that relies on available
features, rather than solely depending on the presence of header
files. This is especially important if the functionality of FIEMAP
relies on multiple include files. Additionally, note that we also need
linux/fs.h for S_NOCOW_FL, regardless of FIEMAP.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agodmesg: fix --notime use
Karel Zak [Mon, 3 Feb 2025 10:29:44 +0000 (11:29 +0100)] 
dmesg: fix --notime use

The --notime command line option disables parsing of timestamps from
kmsg. This is a bug because the timestamps can be used for operations
other than just output. For example, they can be used for filters like
--since (dmesg --since '1 day ago' --notime).

Addresses: https://github.com/util-linux/util-linux/issues/3392
Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agobash-completion: updated lsns bash completion
Prasanna Paithankar [Sun, 2 Feb 2025 17:04:20 +0000 (22:34 +0530)] 
bash-completion: updated lsns bash completion

6 months agoblkid: allow up to 64k erofs block sizes
Eric Sandeen [Fri, 24 Jan 2025 14:37:12 +0000 (08:37 -0600)] 
blkid: allow up to 64k erofs block sizes

Today, mkfs.erofs defaults to page size for block size, but blkid
does not recognize this. Increase the limit to 64k.

Reviewed-by: Gao Xiang <xiang@kernel.org>
Signed-off-by: Eric Sandeen <sandeen@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoMerge branch 'PR/libuuid-pthread' of https://github.com/karelzak/util-linux-work
Karel Zak [Thu, 30 Jan 2025 08:50:02 +0000 (09:50 +0100)] 
Merge branch 'PR/libuuid-pthread' of https://github.com/karelzak/util-linux-work

* 'PR/libuuid-pthread' of https://github.com/karelzak/util-linux-work:
  libuuid: support non-cached scenarios (when -lpthread is unavailable)
  meson: add HAVE_LIBPTHREAD
  autotools: define HAVE_LIBPTHREAD and PTHREAD_LIBS
  c.h: consolidate THREAD_LOCAL.

6 months agoMerge branch 'lslogins' of https://github.com/thkukuk/util-linux
Karel Zak [Thu, 30 Jan 2025 08:49:22 +0000 (09:49 +0100)] 
Merge branch 'lslogins' of https://github.com/thkukuk/util-linux

* 'lslogins' of https://github.com/thkukuk/util-linux:
  lslogins: don't ignore stat error

6 months agoMerge branch 'PR/github-configure-fast' of https://github.com/karelzak/util-linux...
Karel Zak [Thu, 30 Jan 2025 08:42:57 +0000 (09:42 +0100)] 
Merge branch 'PR/github-configure-fast' of https://github.com/karelzak/util-linux-work

* 'PR/github-configure-fast' of https://github.com/karelzak/util-linux-work:
  github: enable verbose output, don't generate docs default

6 months agoscriptreplay: fix compiler warning
Karel Zak [Wed, 29 Jan 2025 11:38:46 +0000 (12:38 +0100)] 
scriptreplay: fix compiler warning

compiler warning:
  expected 'struct timeval * restrict' but argument is of type 'const struct timeval *'

On Linux, select() modifies timeout, so the timeout cannot be 'const'.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoMerge branch 'PR/build-widechar' of https://github.com/karelzak/util-linux-work
Karel Zak [Thu, 30 Jan 2025 08:39:28 +0000 (09:39 +0100)] 
Merge branch 'PR/build-widechar' of https://github.com/karelzak/util-linux-work

* 'PR/build-widechar' of https://github.com/karelzak/util-linux-work:
  Fix --disable-widechar compile warnings

6 months agomkswap: improve --file option for use on btrfs
Karel Zak [Wed, 29 Jan 2025 11:05:10 +0000 (12:05 +0100)] 
mkswap: improve --file option for use on btrfs

We will now try to set the "nocow" attribute, but will ignore it if it
is not supported.

Suggested-by: Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agologger: (man) fix --socket-error
Karel Zak [Wed, 29 Jan 2025 12:31:10 +0000 (13:31 +0100)] 
logger: (man) fix --socket-error

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoMerge branch 'PR/lscpu-cols-desc' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 29 Jan 2025 12:20:07 +0000 (13:20 +0100)] 
Merge branch 'PR/lscpu-cols-desc' of https://github.com/karelzak/util-linux-work

* 'PR/lscpu-cols-desc' of https://github.com/karelzak/util-linux-work:
  lscpu: make three column descriptions more grammatical

6 months agoblkid: say "override" instead of "overwrite" in the --help text
Benno Schulenberg [Mon, 27 Jan 2025 15:21:44 +0000 (16:21 +0100)] 
blkid: say "override" instead of "overwrite" in the --help text

The `blkid` tool does not write anything to the probed device, so
seeing "overwrite" in the usage text was somewhat disconcerting.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
6 months agologger: do not show arguments of --socket-errors as optional in --help
Benno Schulenberg [Mon, 27 Jan 2025 11:08:25 +0000 (12:08 +0100)] 
logger: do not show arguments of --socket-errors as optional in --help

Also, show them without angular brackets, as they are literal values.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
6 months agoFix --disable-widechar compile warnings
Marc Aurèle La France [Sun, 26 Jan 2025 17:38:52 +0000 (10:38 -0700)] 
Fix --disable-widechar compile warnings

Fix warnings when compiling without wide char support.

Marc.

6 months agolscpu: make three column descriptions more grammatical
Benno Schulenberg [Sun, 26 Jan 2025 11:09:24 +0000 (12:09 +0100)] 
lscpu: make three column descriptions more grammatical

Change an adverb to an adjective, use the plural "lines",
and use the plural form of the verb "have".  Also, put a
clarification between parentheses, and reshuffle it a bit
for clarity.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
6 months agogithub: enable verbose output, don't generate docs default
Karel Zak [Tue, 28 Jan 2025 11:09:37 +0000 (12:09 +0100)] 
github: enable verbose output, don't generate docs default

Generating all documentation (man pages, man page translations, and
library API docs) is a very time-consuming task. It is also
architecture-independent, as it involves text conversions using
Python, Ruby, etc. It would be better to only do this once in CI and
only when all other tasks have been successfully completed.

This commit also enables verbose output for autotools to make the
compiler command line visible in logs.

* Add V=1 (verbose) for "make" command.

* Add CONFIGUREFAST phase with disabled po-man, asciidoc, and gtk-doc.

* Use full version CONFIGURE phase only for the distcheck CI job.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoMerge branch 'posix-fallocate' of https://github.com/zeha/util-linux
Karel Zak [Mon, 27 Jan 2025 16:51:09 +0000 (17:51 +0100)] 
Merge branch 'posix-fallocate' of https://github.com/zeha/util-linux

* 'posix-fallocate' of https://github.com/zeha/util-linux:
  fallocate: forbid --posix with special options
  meson: correctly detect posix_fallocate

6 months agolslogins: don't ignore stat error
Thorsten Kukuk [Fri, 24 Jan 2025 16:06:48 +0000 (17:06 +0100)] 
lslogins: don't ignore stat error

Signed-off-by: Thorsten Kukuk <kukuk@suse.com>
6 months agolibuuid: support non-cached scenarios (when -lpthread is unavailable)
Karel Zak [Mon, 27 Jan 2025 13:28:36 +0000 (14:28 +0100)] 
libuuid: support non-cached scenarios (when -lpthread is unavailable)

This patch makes the dependence on pthread optional for libuuid. In
certain cases, such as Buildroot Linux, uClibc-ng, and very low
resource systems, libpthread may be unavailable.

If libuuid is compiled without pthread, it will not use a local cache
and will instead request a UUID from uuidd for each call. This may
result in less efficient performance, but the UUIDs generated will
still be unique and reliable.

On minimalistic systems, it is highly likely that uuidd will not be
installed, making this change important for portability and robust
code.

Addresses: https://github.com/util-linux/util-linux/pull/3375
Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agomeson: add HAVE_LIBPTHREAD
Karel Zak [Mon, 27 Jan 2025 13:11:35 +0000 (14:11 +0100)] 
meson: add HAVE_LIBPTHREAD

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoautotools: define HAVE_LIBPTHREAD and PTHREAD_LIBS
Karel Zak [Mon, 27 Jan 2025 13:01:38 +0000 (14:01 +0100)] 
autotools: define HAVE_LIBPTHREAD and PTHREAD_LIBS

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoc.h: consolidate THREAD_LOCAL.
Karel Zak [Mon, 27 Jan 2025 12:40:23 +0000 (13:40 +0100)] 
c.h: consolidate THREAD_LOCAL.

Let's define this macro in one place only.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agowhereis: avoid accessing uninitialized memory
xiovwx [Thu, 23 Jan 2025 11:06:27 +0000 (11:06 +0000)] 
whereis: avoid accessing uninitialized memory

6 months agofallocate: forbid --posix with special options
Chris Hofstaedtler [Tue, 21 Jan 2025 17:58:48 +0000 (18:58 +0100)] 
fallocate: forbid --posix with special options

Option --posix picks posix_fallocate, which does not have a
mode flag. Forbid using any options that set mode flags when
also giving --posix.

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
6 months agoMerge branch 'column-handle-osc8-links' of https://github.com/juarezr/util-linux
Karel Zak [Wed, 22 Jan 2025 10:47:04 +0000 (11:47 +0100)] 
Merge branch 'column-handle-osc8-links' of https://github.com/juarezr/util-linux

* 'column-handle-osc8-links' of https://github.com/juarezr/util-linux:
  column: test ANSI SGR colors inside OSC 8 hyperlink escape codes
  column: handle ANSI SGR colors inside OSC 8 hyperlink escape codes
  column: test OSC 8 hyperlink escape sequences
  column: handle OSC 8 hyperlink escape sequences

6 months agomeson: correctly detect posix_fallocate
Chris Hofstaedtler [Tue, 21 Jan 2025 17:58:41 +0000 (18:58 +0100)] 
meson: correctly detect posix_fallocate

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
6 months agoMerge branch 'master' of https://github.com/AntonMoryakov/util-linux
Karel Zak [Tue, 21 Jan 2025 14:05:32 +0000 (15:05 +0100)] 
Merge branch 'master' of https://github.com/AntonMoryakov/util-linux

* 'master' of https://github.com/AntonMoryakov/util-linux:
  setpriv.c: fix memory leak in parse_groups function

6 months agoautotools: add sysusers support
Karel Zak [Thu, 16 Jan 2025 17:02:30 +0000 (18:02 +0100)] 
autotools: add sysusers support

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agomeson: use tmpfilesdir pkg-config variable
Karel Zak [Thu, 16 Jan 2025 16:49:30 +0000 (17:49 +0100)] 
meson: use tmpfilesdir pkg-config variable

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agomeson: do not hardcode /var in uuidd-sysusers.conf.
Karel Zak [Thu, 16 Jan 2025 16:42:13 +0000 (17:42 +0100)] 
meson: do not hardcode /var in uuidd-sysusers.conf.

Let's follow the same approach as we use for other configuration files.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agocolumn: test ANSI SGR colors inside OSC 8 hyperlink escape codes
Juarez Rudsatz [Sun, 19 Jan 2025 22:11:35 +0000 (19:11 -0300)] 
column: test ANSI SGR colors inside OSC 8 hyperlink escape codes

6 months agocolumn: handle ANSI SGR colors inside OSC 8 hyperlink escape codes
Juarez Rudsatz [Sun, 19 Jan 2025 22:10:53 +0000 (19:10 -0300)] 
column: handle ANSI SGR colors inside OSC 8 hyperlink escape codes

6 months agocolumn: test OSC 8 hyperlink escape sequences
Juarez Rudsatz [Sun, 19 Jan 2025 20:28:07 +0000 (17:28 -0300)] 
column: test OSC 8 hyperlink escape sequences

6 months agocolumn: handle OSC 8 hyperlink escape sequences
Juarez Rudsatz [Sun, 19 Jan 2025 20:26:54 +0000 (17:26 -0300)] 
column: handle OSC 8 hyperlink escape sequences

6 months agosetpriv.c: fix memory leak in parse_groups function
AntonMoryakov [Thu, 16 Jan 2025 16:24:20 +0000 (19:24 +0300)] 
setpriv.c: fix memory leak in parse_groups function

The static analyzer flagged a memory leak in the parse_groups function.
The memory allocated for 'buf' (via xstrdup) was not freed at the end
of the function, leading to a memory leak.

Changes:
- Added free(buf) at the end of the function to release allocated memory.

Triggers found by static analyzer Svace.

Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
6 months agoMerge branch 'uuiddd-sysusers' of https://github.com/keszybz/util-linux
Karel Zak [Thu, 16 Jan 2025 16:22:53 +0000 (17:22 +0100)] 
Merge branch 'uuiddd-sysusers' of https://github.com/keszybz/util-linux

* 'uuiddd-sysusers' of https://github.com/keszybz/util-linux:
  lastlog2,uuidd: rename tmpfiles config file
  uuidd: add sysusers file

6 months agoMerge branch 'PR/sulogin-locale' of https://github.com/karelzak/util-linux-work
Karel Zak [Thu, 16 Jan 2025 16:11:49 +0000 (17:11 +0100)] 
Merge branch 'PR/sulogin-locale' of https://github.com/karelzak/util-linux-work

* 'PR/sulogin-locale' of https://github.com/karelzak/util-linux-work:
  sulogin: extend --version features list
  sulogin: fix POSIX locale use

6 months agoMerge branch 'master' of https://github.com/stanislav-brabec/util-linux
Karel Zak [Thu, 16 Jan 2025 16:11:21 +0000 (17:11 +0100)] 
Merge branch 'master' of https://github.com/stanislav-brabec/util-linux

* 'master' of https://github.com/stanislav-brabec/util-linux:
  Add fuse.portal to list of pseudo file systems

6 months agolsns: check for mnt_fs_get_target return value
Karel Zak [Thu, 16 Jan 2025 16:10:25 +0000 (17:10 +0100)] 
lsns: check for mnt_fs_get_target return value

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoMerge branch 'master' of https://github.com/AntonMoryakov/util-linux
Karel Zak [Thu, 16 Jan 2025 16:07:59 +0000 (17:07 +0100)] 
Merge branch 'master' of https://github.com/AntonMoryakov/util-linux

* 'master' of https://github.com/AntonMoryakov/util-linux:
  sys-utils: fix add NULL check for mnt_fs_get_target return value

6 months agolsfd: remove C++ comment
Karel Zak [Thu, 16 Jan 2025 16:06:19 +0000 (17:06 +0100)] 
lsfd: remove C++ comment

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoMerge branch 'patch-2' of https://github.com/hmaarrfk/util-linux
Karel Zak [Thu, 16 Jan 2025 16:02:51 +0000 (17:02 +0100)] 
Merge branch 'patch-2' of https://github.com/hmaarrfk/util-linux

* 'patch-2' of https://github.com/hmaarrfk/util-linux:
  refactor things to avoid an other header.
  Include errno.h within lsfd.c

6 months agosulogin: extend --version features list
Karel Zak [Thu, 16 Jan 2025 12:24:37 +0000 (13:24 +0100)] 
sulogin: extend --version features list

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agosulogin: fix POSIX locale use
Karel Zak [Thu, 16 Jan 2025 12:14:43 +0000 (13:14 +0100)] 
sulogin: fix POSIX locale use

In some cases, sulogin can set LC_CTYPE="POSIX" while retaining the
original LC_MESSAGES. In this scenario, the gettext() function may not
work as intended and sulogin returns "???" (for example for
ja_JP.UTF-8). GNU gettext FAQ:

 This symptom occurs when the LC_CTYPE facet of the locale is not set;
 then gettext() doesn't know which character set to use, and converts
 all messages to ASCII, as far as possible.

Addresses: https://issues.redhat.com/browse/RHEL-56983
Addresses: https://github.com/util-linux/util-linux/issues/2185
Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolastlog2,uuidd: rename tmpfiles config file
Zbigniew Jędrzejewski-Szmek [Wed, 15 Jan 2025 21:36:58 +0000 (22:36 +0100)] 
lastlog2,uuidd: rename tmpfiles config file

We don't want 'tmpfiles' in the file name.

6 months agouuidd: add sysusers file
Zbigniew Jędrzejewski-Szmek [Wed, 15 Jan 2025 21:10:16 +0000 (22:10 +0100)] 
uuidd: add sysusers file

This will allow the user to be created automatically and the scriptlets
to create the user and group dropped from the spec file:
https://fedoraproject.org/wiki/Changes/RPMSuportForSystemdSysusers

The config is equivalent to what the Fedora package does, i.e. a
dynamically-allocated uid and gid, and an account with nologin as the
shell.

6 months agoAdd fuse.portal to list of pseudo file systems
Stanislav Brabec [Tue, 14 Jan 2025 21:09:11 +0000 (22:09 +0100)] 
Add fuse.portal to list of pseudo file systems

Fixes output of findmnt --real (opensuse#1234736).

Reported-by: Stephan Wefing <wefing@gmx.de>
Co-authored-by: Anthony Iliopoulos <ailiopoulos@suse.com>
Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
6 months agorefactor things to avoid an other header.
Mark Harfouche [Tue, 14 Jan 2025 16:25:19 +0000 (11:25 -0500)] 
refactor things to avoid an other header.

6 months agosys-utils: fix add NULL check for mnt_fs_get_target return value
AntonMoryakov [Tue, 14 Jan 2025 15:06:49 +0000 (18:06 +0300)] 
sys-utils: fix add NULL check for mnt_fs_get_target return value

The static analyzer flagged a potential issue: the return value of
mnt_fs_get_target(fs) could be NULL, but it was dereferenced without
a check. This could lead to undefined behavior.

Added a NULL check before using the tgt pointer. If tgt is NULL,
the current iteration is skipped.

ChanChanges:
- Added if (!tgt) check before using tgt.

Signed-off-by: Anton Moryakov <ant.v.moryakov@gmail.com>
6 months agoMerge branch 'PR/libblkid-save-memleak' of https://github.com/karelzak/util-linux...
Karel Zak [Tue, 14 Jan 2025 09:31:58 +0000 (10:31 +0100)] 
Merge branch 'PR/libblkid-save-memleak' of https://github.com/karelzak/util-linux-work

* 'PR/libblkid-save-memleak' of https://github.com/karelzak/util-linux-work:
  libblkid: fix potential memory leaks

6 months agoMerge branch 'PR/non-linux' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 14 Jan 2025 09:31:32 +0000 (10:31 +0100)] 
Merge branch 'PR/non-linux' of https://github.com/karelzak/util-linux-work

* 'PR/non-linux' of https://github.com/karelzak/util-linux-work:
  Fix non-Linux build

6 months agoMerge branch 'PR/hardlink-mem-issues2' of https://github.com/karelzak/util-linux...
Karel Zak [Tue, 14 Jan 2025 09:31:17 +0000 (10:31 +0100)] 
Merge branch 'PR/hardlink-mem-issues2' of https://github.com/karelzak/util-linux-work

* 'PR/hardlink-mem-issues2' of https://github.com/karelzak/util-linux-work:
  hardlink: fix memory corruption in read buffers

6 months agoMerge branch 'login-respect-dollar-home' of https://github.com/poettering/util-linux
Karel Zak [Tue, 14 Jan 2025 09:24:35 +0000 (10:24 +0100)] 
Merge branch 'login-respect-dollar-home' of https://github.com/poettering/util-linux

* 'login-respect-dollar-home' of https://github.com/poettering/util-linux:
  login: actually honour $HOME for chdir()

6 months agoInclude errno.h within lsfd.c
Mark Harfouche [Mon, 13 Jan 2025 23:07:20 +0000 (18:07 -0500)] 
Include errno.h within lsfd.c

This is needed for ENOSYS to be defined

libgcc:           14.2.0

```
2025-01-13T22:59:57.1752408Z misc-utils/lsfd.c: In function 'kcmp':
2025-01-13T22:59:57.1762407Z misc-utils/lsfd.c:66:9: error: 'errno' undeclared (first use in this function)
2025-01-13T22:59:57.1762947Z    66 |         errno = ENOSYS;
2025-01-13T22:59:57.1770931Z       |         ^~~~~
2025-01-13T22:59:57.1771263Z misc-utils/lsfd.c:40:1: note: 'errno' is defined in header '<errno.h>'; did you forget to '#include <errno.h>'?
2025-01-13T22:59:57.1771555Z    39 | #include <sys/syscall.h>
2025-01-13T22:59:57.1771767Z   +++ |+#include <errno.h>
2025-01-13T22:59:57.1771955Z    40 |
2025-01-13T22:59:57.1772231Z misc-utils/lsfd.c:66:9: note: each undeclared identifier is reported only once for each function it appears in
2025-01-13T22:59:57.1772507Z    66 |         errno = ENOSYS;
2025-01-13T22:59:57.1772684Z       |         ^~~~~
2025-01-13T22:59:57.1779860Z misc-utils/lsfd.c:66:17: error: 'ENOSYS' undeclared (first use in this function)
2025-01-13T22:59:57.1780285Z    66 |         errno = ENOSYS;
2025-01-13T22:59:57.1780499Z       |                 ^~~~~~
2025-01-13T22:59:57.2204441Z   CC       misc-utils/lsfd-lsfd-decode-file-flags.o
2025-01-13T22:59:57.2803898Z make[2]: *** [Makefile:13624: misc-utils/lsfd-lsfd.o]
```

6 months agologin: actually honour $HOME for chdir()
Lennart Poettering [Thu, 9 Jan 2025 22:57:32 +0000 (23:57 +0100)] 
login: actually honour $HOME for chdir()

When login is almost done it chdir()'s into the user's home directory.
It currently uses pwd->pw_dir, i.e the home dir actually assigned to the
user.

OTOH it explicitly allows overriding HOME (see comment in
init_environ()), and explicitly imports PAM's env vars (which quite
possibly contain $HOME) into its env block.

This patch makes sure that HOME is *properly* overridable via the env
var and via PAM: it actually honours it for the chdir().

(Background: I am working on a PAM module that under some conditions
would like to redirect the home dir to some other dir, and while I can
nicely set $HOME from the PAM module, it has not as much as effect as I
wish, because whie the rest of userspace respects it login so far didn't
and leaves the user in the wrong dir).

6 months agohardlink: fix memory corruption in read buffers
Karel Zak [Mon, 13 Jan 2025 11:06:23 +0000 (12:06 +0100)] 
hardlink: fix memory corruption in read buffers

The size of the eq->buf_a and eq->buf_b buffers depends on the
readsize setting. This setting is modified by ul_fileeq_set_size(), so
the buffers need to be resized accordingly. Deallocating is
sufficient, as they will be allocated later with the correct size.

Addresses: https://github.com/util-linux/util-linux/issues/3330
Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoFix non-Linux build
Samuel Thibault [Sun, 12 Jan 2025 15:39:44 +0000 (16:39 +0100)] 
Fix non-Linux build

This fixes non-Linux builds, by:

- making sfdisk discard option conditioned by availability of BLKDISCARD
- defining and using blkid_probe_get_buffer only if O_DIRECT is
  available
- always building src/fs_statmount.c and src/tab_listmount.c, they
  already contain proper conditions to make them void if support is not
  available.

Signed-off-by: Samuel Thibault <samuel.thibault@ens-lyon.org>
6 months agolibblkid: fix potential memory leaks
Karel Zak [Mon, 13 Jan 2025 10:26:06 +0000 (11:26 +0100)] 
libblkid: fix potential memory leaks

Addresses: https://github.com/util-linux/util-linux/pull/3356
Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoRevert "libmount: exec mount helpers with posixly correct argument order"
Karel Zak [Mon, 13 Jan 2025 09:43:26 +0000 (10:43 +0100)] 
Revert "libmount: exec mount helpers with posixly correct argument order"

The change is not backwardly compatible, see https://github.com/util-linux/util-linux/issues/3355

This reverts commit 2d680b72ac61644e4ba177e6569d8ca13580c248.

6 months agoMerge branch 'PR/libmount-statmount' of https://github.com/karelzak/util-linux-work
Karel Zak [Thu, 9 Jan 2025 10:13:49 +0000 (11:13 +0100)] 
Merge branch 'PR/libmount-statmount' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-statmount' of https://github.com/karelzak/util-linux-work: (40 commits)
  libmount: map unsupported LISTMOUNT_REVERSE to ENOSYS
  findmnt: add --id and --uniq-id options
  findmnt: improve --help output
  findmnt: improve reliability of match testing
  libmount: add mnt_table_find_[uniq]_id() function
  findmnt: add UNIQ-ID column
  findmnt: add docs for --kernel
  tests: add findmnt --kernel=listmount
  libmount:  fix mnt_fs_match_target()
  libmount: improve fs->stmnt_done mask use
  libmount: improve how library generates fs->optstr
  findmnt: add --kernel=listmount
  findmnt: add optional argument to --kernel
  meson: fix after rebase
  libmount: remove unnecessary include
  test_sysinfo; fix fsopen() ifdef
  libmount: Add integer type headers to private header file
  libmount: use __unused__ for dummy get_mnt_id()
  libmount: update tests
  include/mount-api-utils: fix typo
  ...

6 months agomount: print info and warning messages
Karel Zak [Tue, 3 Dec 2024 18:16:11 +0000 (19:16 +0100)] 
mount: print info and warning messages

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolibmount: read all types of kernel messages
Karel Zak [Tue, 3 Dec 2024 17:56:41 +0000 (18:56 +0100)] 
libmount: read all types of kernel messages

Previously, libmount only read error messages from fsopen() file
descriptor. This commit improves the library to read all messages
and keep them in their original format ("<type> <mesg>") in the library mount context.
Applications can now read all messages by using mnt_context_get_mesgs().

Furthermore, private functions have been implemented to include new
library-specific messages in the log. Currently, these messages are
only managed in mnt_context_get_excode(), but it would be beneficial
to relocate them to the appropriate locations where errors are
triggered.

In the future, mnt_context_get_excode() should only be utilized by
basic applications that require an one error message. For more
critical purposes (e.g. mount(8)), it will be recommended to utilize
the messages array.

The public function mnt_context_get_excode() has been modified to use
the new functionality and provide messages in a backwardly compatible
way.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agoInclude/strutils: xstrncpy() returns the number of copied bytes
Karel Zak [Tue, 3 Dec 2024 17:53:04 +0000 (18:53 +0100)] 
Include/strutils: xstrncpy() returns the number of copied bytes

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolibmount: map unsupported LISTMOUNT_REVERSE to ENOSYS
Karel Zak [Wed, 8 Jan 2025 09:51:02 +0000 (10:51 +0100)] 
libmount: map unsupported LISTMOUNT_REVERSE to ENOSYS

For testing purposes, report the missing LISTMOUNT_REVERSE as missing
in the complete listmount() function.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agofindmnt: add --id and --uniq-id options
Karel Zak [Mon, 11 Nov 2024 14:39:07 +0000 (15:39 +0100)] 
findmnt: add --id and --uniq-id options

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agofindmnt: improve --help output
Karel Zak [Mon, 11 Nov 2024 14:05:59 +0000 (15:05 +0100)] 
findmnt: improve --help output

The current help output is quite lengthy. It would be beneficial to
organize it into sections, such as data sources, data filters, and
options. This would make it easier for users to navigate and
understand the available features.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agofindmnt: improve reliability of match testing
Karel Zak [Mon, 11 Nov 2024 13:52:53 +0000 (14:52 +0100)] 
findmnt: improve reliability of match testing

The "match" is defined if a string or void data is defined for the
matching function. It is necessary to test both variants instead of
relying solely on get_match(), which only returns string data.

This patch introduces the is_defined_match() macro to hide this detail
in the code and make it more readable.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolibmount: add mnt_table_find_[uniq]_id() function
Karel Zak [Mon, 11 Nov 2024 11:45:00 +0000 (12:45 +0100)] 
libmount: add mnt_table_find_[uniq]_id() function

Addresses: https://github.com/util-linux/util-linux/issues/3275
Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agofindmnt: add UNIQ-ID column
Karel Zak [Mon, 11 Nov 2024 11:44:06 +0000 (12:44 +0100)] 
findmnt: add UNIQ-ID column

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agofindmnt: add docs for --kernel
Karel Zak [Thu, 10 Oct 2024 12:22:39 +0000 (14:22 +0200)] 
findmnt: add docs for --kernel

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agotests: add findmnt --kernel=listmount
Karel Zak [Wed, 2 Oct 2024 10:35:48 +0000 (12:35 +0200)] 
tests: add findmnt --kernel=listmount

* add listmount() and statmount() check to test_sysinfo
* check for statmount fields by findmnt

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolibmount: fix mnt_fs_match_target()
Karel Zak [Wed, 2 Oct 2024 10:15:40 +0000 (12:15 +0200)] 
libmount:  fix mnt_fs_match_target()

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolibmount: improve fs->stmnt_done mask use
Karel Zak [Mon, 23 Sep 2024 14:39:24 +0000 (16:39 +0200)] 
libmount: improve fs->stmnt_done mask use

It is possible that one field in the libmnt_fs struct requires
fetching multiple statmount fields using multiple STATMOUNT_* mask
items. This requires changes to the way the fs->stmnt_done mask is
used.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolibmount: improve how library generates fs->optstr
Karel Zak [Mon, 23 Sep 2024 14:34:52 +0000 (16:34 +0200)] 
libmount: improve how library generates fs->optstr

* add missing STATMOUNT_* items
* reuse merging code

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agofindmnt: add --kernel=listmount
Karel Zak [Mon, 16 Sep 2024 10:16:16 +0000 (12:16 +0200)] 
findmnt: add --kernel=listmount

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agofindmnt: add optional argument to --kernel
Karel Zak [Mon, 16 Sep 2024 09:36:41 +0000 (11:36 +0200)] 
findmnt: add optional argument to --kernel

The number of methods for reading mount nodes from the kernel is
increasing. We need a way to specify the method on the findmnt(1)
command line.

Currently, findmnt only supports the "mountinfo" method. Another
method will be added in a separate commit.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agomeson: fix after rebase
Karel Zak [Mon, 16 Sep 2024 09:33:39 +0000 (11:33 +0200)] 
meson: fix after rebase

6 months agolibmount: remove unnecessary include
Karel Zak [Wed, 21 Aug 2024 18:28:45 +0000 (20:28 +0200)] 
libmount: remove unnecessary include

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agotest_sysinfo; fix fsopen() ifdef
Karel Zak [Wed, 21 Aug 2024 13:26:07 +0000 (15:26 +0200)] 
test_sysinfo; fix fsopen() ifdef

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolibmount: Add integer type headers to private header file
Karel Zak [Wed, 21 Aug 2024 13:16:24 +0000 (15:16 +0200)] 
libmount: Add integer type headers to private header file

We use uintX_t in many places in the library, and it seems useful to
include inttypes.h and stdint.h to have access to the PRI* macros everywhere.

Signed-off-by: Karel Zak <kzak@redhat.com>
6 months agolibmount: use __unused__ for dummy get_mnt_id()
Karel Zak [Wed, 21 Aug 2024 08:56:50 +0000 (10:56 +0200)] 
libmount: use __unused__ for dummy get_mnt_id()

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