]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
2 months agoUpdate setpwnam.c
Mohamed Maatallah [Sat, 24 May 2025 02:16:09 +0000 (03:16 +0100)] 
Update setpwnam.c

2 months agoMerge branch 'xry111/loongarch-isa-linux-6-12' of https://github.com/xry111/util...
Karel Zak [Thu, 22 May 2025 08:21:42 +0000 (10:21 +0200)] 
Merge branch 'xry111/loongarch-isa-linux-6-12' of https://github.com/xry111/util-linux

* 'xry111/loongarch-isa-linux-6-12' of https://github.com/xry111/util-linux:
  lscpu: Fix loongarch op-mode output with recent kernel

2 months agolscpu: Fix loongarch op-mode output with recent kernel
Xi Ruoyao [Thu, 22 May 2025 05:04:48 +0000 (13:04 +0800)] 
lscpu: Fix loongarch op-mode output with recent kernel

Since Linux-6.12, the "loongarch32" item in the ISA field is separated
to "loongarch32r" and "loongarch32s," breaking our expectation.

Link: https://git.kernel.org/torvalds/c/34e3c4500cdc
Signed-off-by: Xi Ruoyao <xry111@xry111.site>
2 months agouuidgen.1.adoc: remove superfluous 'plus'
Daniel Lublin [Wed, 21 May 2025 09:20:34 +0000 (11:20 +0200)] 
uuidgen.1.adoc: remove superfluous 'plus'

Likely copy-paste mistake from the --time flag

2 months agoMerge branch 'login_fix' of https://github.com/echoechoin/util-linux
Karel Zak [Wed, 21 May 2025 09:05:38 +0000 (11:05 +0200)] 
Merge branch 'login_fix' of https://github.com/echoechoin/util-linux

* 'login_fix' of https://github.com/echoechoin/util-linux:
  login: (adoc) add a description about LOGIN_SHELL_FALLBACK
  login: using an avaiable shell while logging in.

2 months agofincore: add recursive directory scanning
Matteo Croce [Sat, 19 Apr 2025 01:09:25 +0000 (03:09 +0200)] 
fincore: add recursive directory scanning

Add a --recursive flag to fincore which allows to recursively scan
directories.

Co-authored-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Matteo Croce <teknoraver@meta.com>
2 months agologin: (adoc) add a description about LOGIN_SHELL_FALLBACK
WanBingjiang [Wed, 21 May 2025 01:49:33 +0000 (09:49 +0800)] 
login: (adoc) add a description about LOGIN_SHELL_FALLBACK

2 months agolscpu: fix possible buffer overflow in cpuinfo parser
Karel Zak [Tue, 20 May 2025 08:10:59 +0000 (10:10 +0200)] 
lscpu: fix possible buffer overflow in cpuinfo parser

Addresses: https://github.com/util-linux/util-linux/pull/3577
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agolib/shells: fix indentation
Karel Zak [Mon, 19 May 2025 10:17:25 +0000 (12:17 +0200)] 
lib/shells: fix indentation

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'master' of https://github.com/shashank-mahadasyam/util-linux
Karel Zak [Mon, 19 May 2025 10:13:20 +0000 (12:13 +0200)] 
Merge branch 'master' of https://github.com/shashank-mahadasyam/util-linux

* 'master' of https://github.com/shashank-mahadasyam/util-linux:
  bash-completion: (chrt) add completion for -e/--ext
  chrt: (man) add SCHED_EXT
  tests: add chrt SCHED_EXT test
  chrt: add support for SCHED_EXT

2 months agoMerge branch 'PR/add_ul_prefix' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 19 May 2025 09:39:14 +0000 (11:39 +0200)] 
Merge branch 'PR/add_ul_prefix' of https://github.com/karelzak/util-linux-work

* 'PR/add_ul_prefix' of https://github.com/karelzak/util-linux-work:
  treewide: add ul_ to parse_timestamp() function name
  treewide: add ul_ to parse_switch() function name
  treewide: add ul_ to parse_size() function name
  treewide: add ul_  to parse_range() function name

2 months agoMerge branch 'only-_exit-in-shlib' of https://github.com/crrodriguez/util-linux
Karel Zak [Mon, 19 May 2025 09:36:39 +0000 (11:36 +0200)] 
Merge branch 'only-_exit-in-shlib' of https://github.com/crrodriguez/util-linux

* 'only-_exit-in-shlib' of https://github.com/crrodriguez/util-linux:
  Do not call exit() on code ending in shared libraries

2 months agoMerge branch 'master' of https://github.com/stanislav-brabec/util-linux
Karel Zak [Mon, 19 May 2025 09:34:12 +0000 (11:34 +0200)] 
Merge branch 'master' of https://github.com/stanislav-brabec/util-linux

* 'master' of https://github.com/stanislav-brabec/util-linux:
  libblkid: Fix crash while parsing config with libeconf

2 months agotests/ts/kill/decode: avoid using shell built-in kill command
Chen Qi [Thu, 15 May 2025 08:44:33 +0000 (16:44 +0800)] 
tests/ts/kill/decode: avoid using shell built-in kill command

This test case should do the same as other kill test cases, avoiding
using shell built-in kill command.

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
2 months agoshells.c: call setusershell before getusershell
WanBingjiang [Thu, 8 May 2025 02:28:48 +0000 (10:28 +0800)] 
shells.c: call setusershell before getusershell

2 months agoDo not call exit() on code ending in shared libraries
Cristian Rodríguez [Sat, 17 May 2025 19:07:02 +0000 (15:07 -0400)] 
Do not call exit() on code ending in shared libraries

It is not cool to call atexit() handlers of unknown
applications from shared libraries, use _exit instead.

Signed-off-by: Cristian Rodríguez <cristian@rodriguez.im>
2 months agolibblkid: Fix crash while parsing config with libeconf
Stanislav Brabec [Fri, 16 May 2025 01:10:14 +0000 (03:10 +0200)] 
libblkid: Fix crash while parsing config with libeconf

As the whole econf_file structure is freed by econf_free(file) at the end
of blkid_read_config(), econf_file structure cannot be defined as static
and initialized only once. The econf_free() is not robust enough and keeps
a pointer to the garbage after the first call of blkid_read_config(). And
if /etc/blkid.conf does not exist, it is called second time.

Signed-off-by: Stanislav Brabec <sbrabec@suse.cz>
Cc: Stefan Schubert <schubi@suse.de>
Link: https://bugzilla.opensuse.org/show_bug.cgi?id=1242705
2 months agobash-completion: (chrt) add completion for -e/--ext
Shashank Balaji [Fri, 16 May 2025 17:03:43 +0000 (02:03 +0900)] 
bash-completion: (chrt) add completion for -e/--ext

chrt's -e/--ext corresponds to the SCHED_EXT scheduling policy,
which, for the purposes of bash completion, behaves just like
--other, --idle, and --batch

Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
2 months agochrt: (man) add SCHED_EXT
Shashank Balaji [Fri, 16 May 2025 09:36:21 +0000 (18:36 +0900)] 
chrt: (man) add SCHED_EXT

Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
2 months agotests: add chrt SCHED_EXT test
Shashank Balaji [Fri, 16 May 2025 09:35:15 +0000 (18:35 +0900)] 
tests: add chrt SCHED_EXT test

Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
2 months agochrt: add support for SCHED_EXT
Shashank Balaji [Fri, 16 May 2025 09:33:45 +0000 (18:33 +0900)] 
chrt: add support for SCHED_EXT

SCHED_EXT lets processes be scheduled by a BPF program-defined
scheduler. This is supported since kernel version 6.12.

Signed-off-by: Shashank Balaji <shashank.mahadasyam@sony.com>
2 months agologger: drop pointless bitfields
Karel Zak [Tue, 13 May 2025 09:48:11 +0000 (11:48 +0200)] 
logger: drop pointless bitfields

References: 63d7937180fcce4ea7fc1d2855872e464f06e779
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agotreewide: add ul_ to parse_timestamp() function name
Karel Zak [Tue, 13 May 2025 09:32:14 +0000 (11:32 +0200)] 
treewide: add ul_ to parse_timestamp() function name

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agotreewide: add ul_ to parse_switch() function name
Karel Zak [Tue, 13 May 2025 09:26:49 +0000 (11:26 +0200)] 
treewide: add ul_ to parse_switch() function name

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agotreewide: add ul_ to parse_size() function name
Karel Zak [Tue, 13 May 2025 09:25:39 +0000 (11:25 +0200)] 
treewide: add ul_ to parse_size() function name

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agotreewide: add ul_ to parse_range() function name
Karel Zak [Tue, 13 May 2025 09:24:48 +0000 (11:24 +0200)] 
treewide: add ul_  to parse_range() function name

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'PR/PATH-consolidate' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 13 May 2025 06:09:37 +0000 (08:09 +0200)] 
Merge branch 'PR/PATH-consolidate' of https://github.com/karelzak/util-linux-work

* 'PR/PATH-consolidate' of https://github.com/karelzak/util-linux-work:
  setpriv: follow /etc/login.defs for PATH
  su: use logindefs_setenv_path()
  login: use logindefs_setenv_path()
  logindefs: Add function to set PATH

2 months agoMerge branch 'PR/login-su-TERM' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 13 May 2025 06:09:16 +0000 (08:09 +0200)] 
Merge branch 'PR/login-su-TERM' of https://github.com/karelzak/util-linux-work

* 'PR/login-su-TERM' of https://github.com/karelzak/util-linux-work:
  setpriv: protect COLORTERM and NO_COLOR env. variables
  su: protect COLORTERM and NO_COLOR env. variables
  login: protect COLORTERM and NO_COLOR env. variables

2 months agoMerge branch 'PR/mount-hint-tty' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 13 May 2025 06:08:54 +0000 (08:08 +0200)] 
Merge branch 'PR/mount-hint-tty' of https://github.com/karelzak/util-linux-work

* 'PR/mount-hint-tty' of https://github.com/karelzak/util-linux-work:
  mount: check for stdout for fstab reload hint

2 months agoMerge branch 'PR/libmount-escape' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 13 May 2025 06:08:33 +0000 (08:08 +0200)] 
Merge branch 'PR/libmount-escape' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-escape' of https://github.com/karelzak/util-linux-work:
  libmount: add function to remove escaped chars

2 months agologin: using an avaiable shell while logging in.
WanBingjiang [Thu, 8 May 2025 02:14:35 +0000 (10:14 +0800)] 
login: using an avaiable shell while logging in.

2 months agosetpriv: protect COLORTERM and NO_COLOR env. variables
Karel Zak [Wed, 7 May 2025 10:52:47 +0000 (12:52 +0200)] 
setpriv: protect COLORTERM and NO_COLOR env. variables

The patch also replaces set/get env with ul_env_list to protect
variables.

Fixes: https://github.com/util-linux/util-linux/issues/3463
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agosetpriv: follow /etc/login.defs for PATH
Karel Zak [Wed, 7 May 2025 10:32:11 +0000 (12:32 +0200)] 
setpriv: follow /etc/login.defs for PATH

The patch also cleans up the --reset-env description in the man page.

Fixes: https://github.com/util-linux/util-linux/issues/3560
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agosu: use logindefs_setenv_path()
Karel Zak [Wed, 7 May 2025 10:06:47 +0000 (12:06 +0200)] 
su: use logindefs_setenv_path()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agologin: use logindefs_setenv_path()
Karel Zak [Wed, 7 May 2025 10:06:21 +0000 (12:06 +0200)] 
login: use logindefs_setenv_path()

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agologindefs: Add function to set PATH
Karel Zak [Wed, 7 May 2025 10:03:51 +0000 (12:03 +0200)] 
logindefs: Add function to set PATH

Let's avoid duplicate code in su() and login(1).

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agosu: protect COLORTERM and NO_COLOR env. variables
Karel Zak [Wed, 7 May 2025 09:35:05 +0000 (11:35 +0200)] 
su: protect COLORTERM and NO_COLOR env. variables

Fixes: https://github.com/util-linux/util-linux/issues/3463
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agologin: protect COLORTERM and NO_COLOR env. variables
Karel Zak [Wed, 7 May 2025 09:34:26 +0000 (11:34 +0200)] 
login: protect COLORTERM and NO_COLOR env. variables

Fixes: https://github.com/util-linux/util-linux/issues/3463
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agomount: check for stdout for fstab reload hint
Karel Zak [Wed, 7 May 2025 08:47:13 +0000 (10:47 +0200)] 
mount: check for stdout for fstab reload hint

Fixes: https://github.com/util-linux/util-linux/issues/3558
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'ci/openwrt-mips' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 5 May 2025 13:02:23 +0000 (15:02 +0200)] 
Merge branch 'ci/openwrt-mips' of https://github.com/t-8ch/util-linux

* 'ci/openwrt-mips' of https://github.com/t-8ch/util-linux:
  ci: build on MIPS
  ci: add OpenWRT subtarget to matrix name

2 months agoMerge branch 'PR/parse_switch' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 5 May 2025 11:10:05 +0000 (13:10 +0200)] 
Merge branch 'PR/parse_switch' of https://github.com/karelzak/util-linux-work

* 'PR/parse_switch' of https://github.com/karelzak/util-linux-work:
  fix and add parse_switch() test
  strutils: move an error message to where it is used, and improve it
  irqtop: use standard 'always/never' arguments instead of 'enable/disable'

2 months agolibmount: add function to remove escaped chars
Karel Zak [Mon, 5 May 2025 11:04:54 +0000 (13:04 +0200)] 
libmount: add function to remove escaped chars

Follow-up: 8a69fa852dd5f41f8456756d18bfac6d8208219f https://github.com/util-linux/util-linux/pull/3541
Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'PR/bits-build' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 5 May 2025 11:07:11 +0000 (13:07 +0200)] 
Merge branch 'PR/bits-build' of https://github.com/karelzak/util-linux-work

* 'PR/bits-build' of https://github.com/karelzak/util-linux-work:
  bits: only build when cpu_set_t is available

2 months agoMerge branch 'PR/Benno-29Apr' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 5 May 2025 11:06:47 +0000 (13:06 +0200)] 
Merge branch 'PR/Benno-29Apr' of https://github.com/karelzak/util-linux-work

* 'PR/Benno-29Apr' of https://github.com/karelzak/util-linux-work:
  po-man: add hyperlink.adoc to po4a.cfg
  docs,usage: harmonize description of --hyperlink, and add 2 missing ones
  pipesz: report default size in --help, instead of referring the user
  lsfd: improve grammar, and use angular brackets around placeholder word
  uuidd: put an option and its description in a single message
  pipesz: (man) improve the markup and some wordings
  irqtop: make the wording of an error message identical to that of another
  unshare: make the wording of a message identical to that of three others

2 months agoMerge branch 'PR/hardlink-logging' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 5 May 2025 11:06:23 +0000 (13:06 +0200)] 
Merge branch 'PR/hardlink-logging' of https://github.com/karelzak/util-linux-work

* 'PR/hardlink-logging' of https://github.com/karelzak/util-linux-work:
  hardlink: define more function as inline
  hardlink: fix performance regression (inefficient signal evaluation)
  hardlink: Use macro for verbose output

2 months agofix and add parse_switch() test
Karel Zak [Mon, 5 May 2025 10:18:10 +0000 (12:18 +0200)] 
fix and add parse_switch() test

Signed-off-by: Karel Zak <kzak@redhat.com>
2 months agoMerge branch 'master' of https://github.com/echoechoin/util-linux
Karel Zak [Mon, 5 May 2025 08:48:09 +0000 (10:48 +0200)] 
Merge branch 'master' of https://github.com/echoechoin/util-linux

* 'master' of https://github.com/echoechoin/util-linux:
  strutils.c: ignore escape characters while parsing options.

2 months agostrutils: move an error message to where it is used, and improve it
Benno Schulenberg [Fri, 2 May 2025 12:22:42 +0000 (14:22 +0200)] 
strutils: move an error message to where it is used, and improve it

Calling gettext() is somewhat costly: it has to find the given message
among the more than five thousand messages in util-linux's repertoire.
So, call gettext() only when the message actually gets printed.

Besides, allowing to customize the error message for parse_switch() was
a nice gesture, but it's unneeded: a fixed error message is good enough.

Also, "argument error" was rather vague, as it doesn't say _what_ the
error is.  Better say "unsupported argument".

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2 months agoirqtop: use standard 'always/never' arguments instead of 'enable/disable'
Benno Schulenberg [Fri, 2 May 2025 12:22:41 +0000 (14:22 +0200)] 
irqtop: use standard 'always/never' arguments instead of 'enable/disable'

Most other util-linux tools that accept the option argument "auto"
additionally accept "always" and "never", not "enable" / "disable".

So, make option --cpu-stat accept those standard words (besides the
deviant ones), and adjust the documentation to use the standard words.

Furthermore, make --cpu-stat accept also "on", "off", "yes", "no",
"1", and "0", to allow the user to use shorter words.  The per-CPU
stats can now be suppressed with a succinct: `irqtop -c0`.

CC: Zhenwei Pi <pizhenwei@bytedance.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2 months agobits: only build when cpu_set_t is available
Alyssa Ross [Thu, 1 May 2025 07:58:06 +0000 (09:58 +0200)] 
bits: only build when cpu_set_t is available

Doesn't build on macOS.

Fixes: 6e1301d59 ("text-utils: add bits command")
Signed-off-by: Alyssa Ross <hi@alyssa.is>
3 months agopo-man: add hyperlink.adoc to po4a.cfg
Karel Zak [Wed, 30 Apr 2025 11:14:02 +0000 (13:14 +0200)] 
po-man: add hyperlink.adoc to po4a.cfg

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agodocs,usage: harmonize description of --hyperlink, and add 2 missing ones
Benno Schulenberg [Sat, 26 Apr 2025 09:30:18 +0000 (11:30 +0200)] 
docs,usage: harmonize description of --hyperlink, and add 2 missing ones

Harmonize the description by placing the option in a separate file.

Also, use _when_/<when> (instead of _mode_/<mode>) as the optional
argument, since the possible values are: "always", "never", "auto".

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agopipesz: report default size in --help, instead of referring the user
Benno Schulenberg [Fri, 25 Apr 2025 10:34:21 +0000 (12:34 +0200)] 
pipesz: report default size in --help, instead of referring the user

The man page says where this default size can be found.  In the --help
text it is more useful to directly say what this default size is.

CC: Nathan Sharp <nwsharp@live.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agolsfd: improve grammar, and use angular brackets around placeholder word
Benno Schulenberg [Fri, 25 Apr 2025 10:32:08 +0000 (12:32 +0200)] 
lsfd: improve grammar, and use angular brackets around placeholder word

Also, use <list> (the standard way to indicate multiple arguments) as
argument of --pid,  and don't use "<when>" when the possible arguments
differ from "always", "never", "auto".

In addition, improve some wording and markup in the man page.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agouuidd: put an option and its description in a single message
Benno Schulenberg [Thu, 24 Apr 2025 09:32:37 +0000 (11:32 +0200)] 
uuidd: put an option and its description in a single message

Also, improve the markup and the wording in the man page.

CC: Michael Trapp <michael.trapp@sap.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agopipesz: (man) improve the markup and some wordings
Benno Schulenberg [Thu, 24 Apr 2025 09:32:35 +0000 (11:32 +0200)] 
pipesz: (man) improve the markup and some wordings

CC: Nathan Sharp <nwsharp@live.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agoirqtop: make the wording of an error message identical to that of another
Benno Schulenberg [Thu, 24 Apr 2025 09:32:32 +0000 (11:32 +0200)] 
irqtop: make the wording of an error message identical to that of another

(Besides: the original looked like a statement, not like an error message.)

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agounshare: make the wording of a message identical to that of three others
Benno Schulenberg [Thu, 24 Apr 2025 09:32:31 +0000 (11:32 +0200)] 
unshare: make the wording of a message identical to that of three others

That is: spare translators having to translate different strings that
mean the exact same thing.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agohardlink: define more function as inline
Karel Zak [Tue, 29 Apr 2025 10:50:48 +0000 (12:50 +0200)] 
hardlink: define more function as inline

The functions are called many times.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agohardlink: fix performance regression (inefficient signal evaluation)
Karel Zak [Tue, 29 Apr 2025 10:29:32 +0000 (12:29 +0200)] 
hardlink: fix performance regression (inefficient signal evaluation)

During work on better verbose output, I found a regression between
v2.40 and v2.41 (and v2.42). In the new version, hardlink is 3-4 times
slower.

The problem is in the function where we verify signals. It calls the
function signal() even though no signal is delivered. It's called in
code loops where hardlink scans files, making it a performance-sensitive
area.

Another significant performance improvement is using an inline function
for handle_interrupt().

This simple patch improves hardlink performance by 10 times.

Fixes: http://github.com/util-linux/util-linux/commit/1453200e22dd4ec858be027653c167225f2fb358
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agohardlink: Use macro for verbose output
Karel Zak [Tue, 29 Apr 2025 09:49:23 +0000 (11:49 +0200)] 
hardlink: Use macro for verbose output

Now that jlog() is a function, all gettext() arguments are evaluated
in all cases, including when output is unnecessary due to --quiet or
low verbose mode.

Fixes: https://github.com/util-linux/util-linux/issues/3548
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoci: build on MIPS
Thomas Weißschuh [Tue, 6 Aug 2024 20:58:04 +0000 (22:58 +0200)] 
ci: build on MIPS

OpenWRT has SDKs targetting MIPS 32/64 bit, little/big endian.
Currently util-linux CI only uses 32 bit little endian through ath79.
Add a big-endian 64bit and little-endian 32bit architecture, too.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoci: add OpenWRT subtarget to matrix name
Thomas Weißschuh [Tue, 6 Aug 2024 21:01:57 +0000 (23:01 +0200)] 
ci: add OpenWRT subtarget to matrix name

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agolibmount: fix typo in comment
Karel Zak [Fri, 25 Apr 2025 08:46:07 +0000 (10:46 +0200)] 
libmount: fix typo in comment

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'PR/statmount-cleanup' of https://github.com/karelzak/util-linux-work
Karel Zak [Fri, 25 Apr 2025 08:39:59 +0000 (10:39 +0200)] 
Merge branch 'PR/statmount-cleanup' of https://github.com/karelzak/util-linux-work

* 'PR/statmount-cleanup' of https://github.com/karelzak/util-linux-work:
  libmount: use and add has_listmount()
  libmount: avoid calling memset() unnecessarily
  libmount: clean up statmount syscall-related functions

3 months agoWipefs: improve --all descriptions for whole-disks
Karel Zak [Thu, 24 Apr 2025 17:25:11 +0000 (19:25 +0200)] 
Wipefs: improve --all descriptions for whole-disks

Addresses: https://github.com/util-linux/util-linux/issues/3544
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolibmount: use and add has_listmount()
Karel Zak [Thu, 24 Apr 2025 16:45:24 +0000 (18:45 +0200)] 
libmount: use and add has_listmount()

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolibmount: avoid calling memset() unnecessarily
Karel Zak [Thu, 24 Apr 2025 16:32:35 +0000 (18:32 +0200)] 
libmount: avoid calling memset() unnecessarily

This is primarily to satisfy static analyzers, as memset() is defined
as a non-null function (although it does nothing when bufsiz=0).

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolibmount: clean up statmount syscall-related functions
Karel Zak [Thu, 24 Apr 2025 16:16:07 +0000 (18:16 +0200)] 
libmount: clean up statmount syscall-related functions

* Rename the raw version of the syscall from ul_statmount() to
  ul_statmount_syscall().

* Rename `sys_statmount()` to `ul_statmount()`. The goal is to use the
  same naming convention as `ul_listmount()` for a function that is
  expected to be called from code.

* Move ul_statmount() to be in the same #ifdef block as the rest of
  the statmount code in the header file.

* Add has_statmount() to make it easy to verify the usability of the
  statmount syscall.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agodocs: correct mistaken uses of "overwrite" to say "override" instead
Benno Schulenberg [Thu, 17 Apr 2025 09:48:24 +0000 (11:48 +0200)] 
docs: correct mistaken uses of "overwrite" to say "override" instead

This mostly comes down to harmonizing the wording and markup of the
various --lock options.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agodocs: correct misspellings of "may be" and mistaken uses of "overwritten"
Benno Schulenberg [Thu, 17 Apr 2025 09:48:23 +0000 (11:48 +0200)] 
docs: correct misspellings of "may be" and mistaken uses of "overwritten"

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agolscpu: (man) don't refer to a missing section, and improve some wordings
Benno Schulenberg [Thu, 17 Apr 2025 09:48:22 +0000 (11:48 +0200)] 
lscpu: (man) don't refer to a missing section, and improve some wordings

Three years ago commit aa049eabb3 removed the COLUMNS section but forgot
to remove the reference to it.  Replace the reference with a referral to
the --help text.

In the bargain, join two paragraphs that belong together, improve some
wordings, and sort two options.

This fixes #2590 (https://github.com/util-linux/util-linux/issues/2590).
Reported-by: Fabien Malfoy
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agorenice: (man) reword several things, to be clearer, and improve some markup
Benno Schulenberg [Thu, 17 Apr 2025 09:48:21 +0000 (11:48 +0200)] 
renice: (man) reword several things, to be clearer, and improve some markup

Also, remove a reference to ulimit(1p) that doesn't make sense.

CC: David Anes <david.anes@suse.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agorenice: in usage text, condense the oververbose description of option -n
Benno Schulenberg [Thu, 17 Apr 2025 09:48:20 +0000 (11:48 +0200)] 
renice: in usage text, condense the oververbose description of option -n

The --help text should be concise: it serves only as a reminder of how
things work.  When a more wordy explanation is needed, there is always
the man page (as every --help text says at the end).

CC: David Anes <david.anes@suse.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agoterminal-colors.d: (man) reduce two tables to succinct lists
Benno Schulenberg [Thu, 17 Apr 2025 09:48:19 +0000 (11:48 +0200)] 
terminal-colors.d: (man) reduce two tables to succinct lists

Before the move to asciidoctor, these tables were succinct lists in the
man page.  Change the asciidoc text to make them into lists again.

Use {nbsp} on one line to avoid weird groff behavior for \? when .ss
is defined to be zero-width (as asciidoctor does), and reshuffle two
paragraphs to avoid an asciidoctor bug that adds a spurious \fP after
a monospace span defined with double backticks.

Also, correct some markup in a few earlier paragraphs.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agortcwake: (man) reduce an inflated table to sane proportions
Benno Schulenberg [Thu, 17 Apr 2025 09:48:18 +0000 (11:48 +0200)] 
rtcwake: (man) reduce an inflated table to sane proportions

Asciidoctor puts an unneeded blank line into every table cell (this
is fixed in git [1], but not released yet), and will unnecessarily
wrap text in a cell when the text is slightly longer than average.

Replace the table with a block of preformatted text, and replace
the "+5min" example with a true format that covers most cases,
and give some examples of that format after the block.

[1] https://github.com/asciidoctor/asciidoctor/commit/9cb73f8c9bee

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agolast: (man) reduce an inflated table to sane proportions
Benno Schulenberg [Thu, 17 Apr 2025 09:48:17 +0000 (11:48 +0200)] 
last: (man) reduce an inflated table to sane proportions

Also, reword some things for better flow, improve some markup, and
combine username and tty to [username|tty]... in the synopsis, as
this better indicates that the two identifiers can be mixed.

Furthermore, use quotes around the time formats that contain a space,
as otherwise the time would be understood as a user name / tty name.
Drop the "tomorrow" and "+5min" examples, as they don't make sense
here.  And change the "-5days" example to a true format that covers
most possibilities, and give a few examples of it after the table.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agolast: (man) correct the descriptions of --present and --since
Benno Schulenberg [Thu, 17 Apr 2025 09:48:16 +0000 (11:48 +0200)] 
last: (man) correct the descriptions of --present and --since

Doing `last --present -24h` will show who was logged in around this time
yesterday.  But when doing (what according to the man page is equivalent)
`last --since -24h --until -24h` nothing will be shown -- unless someone
logged in exactly 24 hours ago to the second.

So, correct the descriptions of --present and --since.

This fixes #1896 (https://github.com/util-linux/util-linux/issues/1896).
Reported-by: Finn Krein-Schuch
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agobits: (man) normalize the markup and improve some layout
Benno Schulenberg [Thu, 17 Apr 2025 09:48:15 +0000 (11:48 +0200)] 
bits: (man) normalize the markup and improve some layout

The convention in man pages is: to put command arguments in lowercase
and without angle brackets (these are for --help texts), and without
unneeded abbreviations.  Literal values (as in some examples) should
be in bold, not in italics.

CC: Robin Jarry <robin@jarry.cc>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
Reviewed-by: Robin Jarry <robin@jarry.cc>
3 months agoswapoff: check blkid_probe_lookup_value() return code [coverity scan]
Karel Zak [Wed, 23 Apr 2025 09:14:09 +0000 (11:14 +0200)] 
swapoff: check  blkid_probe_lookup_value() return code [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'PR/swapoff-resolve-leaks' of https://github.com/karelzak/util-linux...
Karel Zak [Tue, 22 Apr 2025 10:24:46 +0000 (12:24 +0200)] 
Merge branch 'PR/swapoff-resolve-leaks' of https://github.com/karelzak/util-linux-work

* 'PR/swapoff-resolve-leaks' of https://github.com/karelzak/util-linux-work:
  swapoff: add comments for do_swapoff
  swapoff: clean up tag resolution

3 months agoMerge branch 'spelling' of https://github.com/jwilk-forks/util-linux
Karel Zak [Tue, 22 Apr 2025 10:24:25 +0000 (12:24 +0200)] 
Merge branch 'spelling' of https://github.com/jwilk-forks/util-linux

* 'spelling' of https://github.com/jwilk-forks/util-linux:
  mount: (man) add missing word

3 months agoMerge branch 'no_strerror_shlib' of https://github.com/crrodriguez/util-linux
Karel Zak [Tue, 22 Apr 2025 10:23:31 +0000 (12:23 +0200)] 
Merge branch 'no_strerror_shlib' of https://github.com/crrodriguez/util-linux

* 'no_strerror_shlib' of https://github.com/crrodriguez/util-linux:
  Do not use strerror on shared libraries

3 months agoMerge branch 'losetup/udev' of https://github.com/t-8ch/util-linux
Karel Zak [Tue, 22 Apr 2025 10:21:59 +0000 (12:21 +0200)] 
Merge branch 'losetup/udev' of https://github.com/t-8ch/util-linux

* 'losetup/udev' of https://github.com/t-8ch/util-linux:
  lib/loopdev: open loop control device read-only if possible
  lib/loopdev: clarify comment about device and backing file modes
  lib/loopdev: remove loopcxt_set_fd()

3 months agoMerge branch 'fix-befs-fuzz' of https://github.com/mbroz/util-linux
Karel Zak [Tue, 22 Apr 2025 10:20:57 +0000 (12:20 +0200)] 
Merge branch 'fix-befs-fuzz' of https://github.com/mbroz/util-linux

* 'fix-befs-fuzz' of https://github.com/mbroz/util-linux:
  libblkid: befs: fix underflow

3 months agostrutils.c: ignore escape characters while parsing options.
WanBingjiang [Tue, 22 Apr 2025 10:16:41 +0000 (18:16 +0800)] 
strutils.c: ignore escape characters while parsing options.

3 months agoinclude/mount-api-utils: include linux/unistd.h
Thomas Weißschuh [Sat, 19 Apr 2025 20:02:11 +0000 (22:02 +0200)] 
include/mount-api-utils: include linux/unistd.h

If SYS_statmount/SYS_listmount is not provided by the libc,
util-linux will fall back to __NR_statmount/__NR_listmount from the
kernel UAPI headers.
However it is not guaranteed that these symbols are actually visible in
mount-api-utils.

Include linux/unistd.h which provides syscall numbers.
While this header is specific to Linux, the code is already using
linux/mount.h.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agolibblkid: befs: fix underflow
Milan Broz [Sat, 19 Apr 2025 13:54:40 +0000 (15:54 +0200)] 
libblkid: befs: fix underflow

Fix segfault caused by underflow while parsing a corrupted metadata.

Found by OSS-Fuzz by cryptsetup project fuzzers (issue 411003898).

Signed-off-by: Milan Broz <gmazyland@gmail.com>
3 months agoMerge branch 'PR/libmount-subdir' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 16 Apr 2025 11:21:47 +0000 (13:21 +0200)] 
Merge branch 'PR/libmount-subdir' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-subdir' of https://github.com/karelzak/util-linux-work:
  libmount: (subdir) support detached open_tree() (>=6.15)
  libmount: (subdir) restrict for real mounts only
  libmount: (subdir) remove unused code

3 months agolib/loopdev: open loop control device read-only if possible
Thomas Weißschuh [Wed, 16 Apr 2025 09:55:31 +0000 (11:55 +0200)] 
lib/loopdev: open loop control device read-only if possible

Opening the control device read-write to trigger udev events is a hack.
It works around a kernel bug which fails to send uevents directly from the
kernel by triggering a full udev reprobe.
While it works to trigger the events, it is problematic.
The udev reprobe will asynchronously recreate all partition devices which
requires an ungly locking and synchronization scheme after losetup has
completed to guarantee the usability of the partition devices.

The kernel has been fixed to properly emit these uevents in
commit 7ed2a771b5fb ("loop: properly send KOBJ_CHANGED uevent for disk device").

Drop the workaround.

This is a partial revert of
commit ced1142d6f25 ("losetup: cleanup device node modes").

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
3 months agolib/loopdev: clarify comment about device and backing file modes
Thomas Weißschuh [Wed, 16 Apr 2025 09:53:36 +0000 (11:53 +0200)] 
lib/loopdev: clarify comment about device and backing file modes

If either the backing file or ioctl loop device are opened read-only the
kernel will silently downgrade the resulting loop device to read-only.

Adapt the comment to this.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
3 months agologger: (man) improve --prio-prefix and --stderr description
Karel Zak [Wed, 16 Apr 2025 08:41:26 +0000 (10:41 +0200)] 
logger: (man) improve --prio-prefix and --stderr description

Fixes: https://github.com/util-linux/util-linux/issues/3527
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolibmount: (subdir) support detached open_tree() (>=6.15)
Karel Zak [Tue, 15 Apr 2025 10:29:37 +0000 (12:29 +0200)] 
libmount: (subdir) support detached open_tree() (>=6.15)

The latest kernel can open a directory as a tree (open_tree()) on a
detached mount tree. This means we do not need to unshare and
attach the root of the filesystem to a private temporary directory. All
this machinery can be replaced by one open_tree() call.

Old version:
fsopen("ext4", FSOPEN_CLOEXEC)          = 3
unshare(CLONE_NEWNS)                    = 0
fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sdc", 0) = 0
fsconfig(3, FSCONFIG_CMD_CREATE, NULL, NULL, 0) = 0
fsmount(3, FSMOUNT_CLOEXEC, 0)          = 6
move_mount(6, "", AT_FDCWD, "/run/mount/tmptgt", MOVE_MOUNT_F_EMPTY_PATH) = 0
open_tree(6, "subdir", OPEN_TREE_CLONE|OPEN_TREE_CLOEXEC) = 7
setns(4, CLONE_NEWNS)                   = 0
move_mount(7, "", AT_FDCWD, "/mnt/test", MOVE_MOUNT_F_EMPTY_PATH) = 0
setns(5, CLONE_NEWNS)                   = 0
umount2("/run/mount/tmptgt", 0)         = 0
setns(4, CLONE_NEWNS)                   = 0

New version:
fsopen("ext4", FSOPEN_CLOEXEC)          = 3
fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sda", 0) = 0
fsconfig(3, FSCONFIG_CMD_CREATE, NULL, NULL, 0) = 0
fsmount(3, FSMOUNT_CLOEXEC, 0)          = 4
open_tree(4, "subdir", OPEN_TREE_CLONE|OPEN_TREE_CLOEXEC|AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT|AT_RECURSIVE
move_mount(5, "", AT_FDCWD, "/mnt/test", MOVE_MOUNT_F_EMPTY_PATH) = 0

Note that this commit does not completely deactivate hook_subdir.c
because it is better to keep things in one place. It only adds a "subdir"
to the struct libmnt_sysapi to force hook_mount.c to call open_tree(subdir),
but all the logic and checks are still in hook_subdir.c.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agosetarch: (man) correct the markup of the synopsis and of two options
Benno Schulenberg [Wed, 9 Apr 2025 09:36:35 +0000 (11:36 +0200)] 
setarch: (man) correct the markup of the synopsis and of two options

Drop the second line of the synopsis as it is unneeded (it is covered
by the first line since argument "arch" became optional) and distracts
from the similarity/contrast between the other two lines.

Mark "arch" in the new second synopsis line in italics, as it is a
placeholder, not a literal.

Also, improve some wording, reduce redundancy by reshuffling the --pid
option, and remove a redudant -v from an example.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agoMerge branch 'PR/Benno-14Apr' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 16 Apr 2025 08:17:49 +0000 (10:17 +0200)] 
Merge branch 'PR/Benno-14Apr' of https://github.com/karelzak/util-linux-work

* 'PR/Benno-14Apr' of https://github.com/karelzak/util-linux-work:
  lastlog2: besides -v, recognize also the standard -V for --version
  lastlog2: (man) fix some broken markup, and lowercase option arguments
  docs: add -h/--help and -V/--version to three man pages that lacked them
  losetup,lscpu: (man) add the missing -h/--help and -V/--version options
  agetty,setterm: (man) remove the mistakenly added -h and -V short options
  docs: fix a few indentation issues
  docs: improve and harmonize the description of -H / --list-columns
  docs: rewrite the description of --bytes, to be clearer

3 months agoMerge branch 'ci/llvm-20' of https://github.com/t-8ch/util-linux
Karel Zak [Wed, 16 Apr 2025 08:17:07 +0000 (10:17 +0200)] 
Merge branch 'ci/llvm-20' of https://github.com/t-8ch/util-linux

* 'ci/llvm-20' of https://github.com/t-8ch/util-linux:
  ci: update gcc to version 14
  ci: update clang to version 20

3 months agolib/loopdev: remove loopcxt_set_fd()
Thomas Weißschuh [Tue, 15 Apr 2025 15:03:30 +0000 (17:03 +0200)] 
lib/loopdev: remove loopcxt_set_fd()

It is not used.

Signed-off-by: Thomas Weißschuh <thomas.weissschuh@linutronix.de>
3 months agoci: update gcc to version 14
Thomas Weißschuh [Tue, 15 Apr 2025 15:17:38 +0000 (17:17 +0200)] 
ci: update gcc to version 14

Also drop the note about GCC which is obsolete.
Skip the coveralls job as it does not yet support GCC 14.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agoci: update clang to version 20
Thomas Weißschuh [Tue, 15 Apr 2025 15:16:49 +0000 (17:16 +0200)] 
ci: update clang to version 20

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
3 months agomeson: fix a bug in posixipc_libs configuration
Martin Valgur [Tue, 15 Apr 2025 13:19:21 +0000 (16:19 +0300)] 
meson: fix a bug in posixipc_libs configuration

Should append instead of assigning. Otherwise fails with

meson.build:1482:22: ERROR: Object <[ExternalLibraryHolder] holds [ExternalLibrary]: <ExternalLibrary rt: True>> of type ExternalLibrary does not support the `+` operator.