]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
3 months agoswapoff: clean up tag resolution
Karel Zak [Wed, 9 Apr 2025 08:51:59 +0000 (10:51 +0200)] 
swapoff: clean up tag resolution

- Rename swapoff_resolve_tag() to resolve_swapfile_tag() and retain
  only code relevant to swapfiles.

- Always call mnt_resolve_*() before resolve_swapfile_tag() to resolve
  tags/paths on standard block devices.

- Call free() for resolve_swapfile_tag() to avoid memory leaks.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'PR/Benno-8Apr' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 8 Apr 2025 11:41:11 +0000 (13:41 +0200)] 
Merge branch 'PR/Benno-8Apr' of https://github.com/karelzak/util-linux-work

* 'PR/Benno-8Apr' of https://github.com/karelzak/util-linux-work:
  zramctl: (man) mention the required arguments for -p and -r
  zramctl: restore normal description indentations in the usage text
  textual: fix a mistruncated message, and fix a typo
  hwclock: remove two comments about parameters that no longer exist

3 months agocolumn: (man) fix broken markup, and improve other markup and wordings
Benno Schulenberg [Mon, 7 Apr 2025 15:14:39 +0000 (17:14 +0200)] 
column: (man) fix broken markup, and improve other markup and wordings

Since commit aa4efb2030 from five months ago, almost the entire text
of the section OPTIONS was underlined / in italics.  Correct that.

Also improve various other markup and wordings, and unswap the names of
--table-column and --table-columns in the first paragraph of OPTIONS.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agomount: (man) shorten an overlong line, and improve some markup
Benno Schulenberg [Mon, 7 Apr 2025 15:14:38 +0000 (17:14 +0200)] 
mount: (man) shorten an overlong line, and improve some markup

Also, in the synopis mention -F separately to make it more obvious that
it applies only to -A, swap two options to make a line more similar to
the preceding one, and improve some wording.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agomount: (man) fix some indentation issues, and improve a few wordings
Benno Schulenberg [Mon, 7 Apr 2025 15:14:37 +0000 (17:14 +0200)] 
mount: (man) fix some indentation issues, and improve a few wordings

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agoeject: (man) add the missing SYNOPSIS header
Benno Schulenberg [Mon, 7 Apr 2025 15:14:36 +0000 (17:14 +0200)] 
eject: (man) add the missing SYNOPSIS header

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agoblkzone: (man) reduce two overblown tables to legible proportions
Benno Schulenberg [Mon, 7 Apr 2025 15:14:35 +0000 (17:14 +0200)] 
blkzone: (man) reduce two overblown tables to legible proportions

Before version 2.37, before asciidoctor was used, the first three lines
of the first table looked like this:

       start     Zone start sector
       len       Zone length in number of sectors
       wptr      Zone write pointer position

After the move to asciidoctor, the first three lines of the first table
in the generated man page looked like this:

       ┌────────┬────────────────────────────┐
       │        │                            │
       │start   │ Zone start sector          │
       ├────────┼────────────────────────────┤
       │        │                            │
       │len     │ Zone length in number of   │
       │        │ sectors                    │
       ├────────┼────────────────────────────┤
       │        │                            │
       │wptr    │ Zone write pointer         │
       │        │ position                   │
       ├────────┼────────────────────────────┤

Three to four screen lines for just one line of information!

Reduce the tables to sane proportions again by simply using blocks
of preformatted text.

(The substition of xN for x? is needed because somehow the ? in the
indented text is a special character in groff.)

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agohexdump: (man) normalize the synopsis, and shrink a list and two tables
Benno Schulenberg [Mon, 7 Apr 2025 15:14:34 +0000 (17:14 +0200)] 
hexdump: (man) normalize the synopsis, and shrink a list and two tables

Simply use blocks of preformatted text for the tables, as asciidoctor
inflates true tables to overblown proportions on a man page.

Also, correct the code for DEL from FF to 7F.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agochoom: (man) add the missing SYNOPSIS section header, and improve wording
Benno Schulenberg [Mon, 7 Apr 2025 15:14:33 +0000 (17:14 +0200)] 
choom: (man) add the missing SYNOPSIS section header, and improve wording

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agozramctl: (man) mention the required arguments for -p and -r
Benno Schulenberg [Sun, 6 Apr 2025 15:21:47 +0000 (17:21 +0200)] 
zramctl: (man) mention the required arguments for -p and -r

Also, sort the options strictly alphabetically ("r" before "raw").

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agozramctl: restore normal description indentations in the usage text
Benno Schulenberg [Sun, 6 Apr 2025 15:21:46 +0000 (17:21 +0200)] 
zramctl: restore normal description indentations in the usage text

Commit 19c12e63b1 from four months ago changed the indentation of *all*
the option descriptions in the usage text.  That was the wrong thing to
do, as it invalidates all existing translations for no good reason.

When one of the options is (or needs to become) overlong, then the thing
to do is: to put the description of this option on the next line.

So, restore the indentation of the descriptions to what they were
before commit 19c12e63b1, and wrap the description of -p.

Also, make the description of -b fit within 80 columns, and sort the
options better: alphabetically, but single letter before long option.

CC: LiviaMedeiros <livia@cirno.name>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agotextual: fix a mistruncated message, and fix a typo
Benno Schulenberg [Sun, 6 Apr 2025 15:21:45 +0000 (17:21 +0200)] 
textual: fix a mistruncated message, and fix a typo

The phrase "in human-readable form" was chosen rather than
"in human-readable format" because it's shorter and lets
the line fit *just* within 80 columns.

Reported-by: Petr Písař <petr.pisar@atlas.cz>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agohwclock: remove two comments about parameters that no longer exist
Benno Schulenberg [Sun, 6 Apr 2025 15:21:44 +0000 (17:21 +0200)] 
hwclock: remove two comments about parameters that no longer exist

Commit 336f7c5f68 from nine years ago removed the 'universal' and
'testing' parameters of do_adjustment() but forgot to update the
leading comment.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agoMerge branch 'fallthrough' of https://github.com/teknoraver/util-linux
Karel Zak [Tue, 8 Apr 2025 08:58:14 +0000 (10:58 +0200)] 
Merge branch 'fallthrough' of https://github.com/teknoraver/util-linux

* 'fallthrough' of https://github.com/teknoraver/util-linux:
  Use the 'fallthrough' attribute
  move XXH_FALLTHROUGH into a generic include file
  Fix XXH_HAS_C_ATTRIBUTE check

3 months agoMerge branch 'PR/treewide-fix-optarg' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 8 Apr 2025 08:50:11 +0000 (10:50 +0200)] 
Merge branch 'PR/treewide-fix-optarg' of https://github.com/karelzak/util-linux-work

* 'PR/treewide-fix-optarg' of https://github.com/karelzak/util-linux-work:
  treewide: fix optional arguments usage

3 months agoMerge branch 'PR/findmnt-fix-k' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 8 Apr 2025 08:49:40 +0000 (10:49 +0200)] 
Merge branch 'PR/findmnt-fix-k' of https://github.com/karelzak/util-linux-work

* 'PR/findmnt-fix-k' of https://github.com/karelzak/util-linux-work:
  findmnt: fix -k option parsing regression

3 months agoUse the 'fallthrough' attribute
Matteo Croce [Thu, 27 Mar 2025 19:49:10 +0000 (20:49 +0100)] 
Use the 'fallthrough' attribute

C23[1] and CPP17[2] introduced the 'fallthrough' attribute to let the
compiler know that we're intentionally falling through a case statement.
This suppress a warning with new compilers when doing an implicit fallthrough.

[1] https://en.cppreference.com/w/c/language/attributes/fallthrough
[2] https://en.cppreference.com/w/cpp/language/attributes/fallthrough

3 months agomove XXH_FALLTHROUGH into a generic include file
Matteo Croce [Thu, 3 Apr 2025 01:09:47 +0000 (03:09 +0200)] 
move XXH_FALLTHROUGH into a generic include file

Move XXH_FALLTHROUGH in c.h, and rename it to FALLTHROUGH

3 months agoFix XXH_HAS_C_ATTRIBUTE check
easyaspi314 (Devin) [Mon, 13 Dec 2021 20:08:50 +0000 (15:08 -0500)] 
Fix XXH_HAS_C_ATTRIBUTE check

3 months agotreewide: fix optional arguments usage
Karel Zak [Mon, 7 Apr 2025 11:49:43 +0000 (13:49 +0200)] 
treewide: fix optional arguments usage

In some parts of the code, the optional argument handling is missing
for cases where the argument starts with '='. This is particularly
important for short options with optional arguments, as suggested by
our man pages. The libc getopt_long() handles this for long options,
but for short options, it's our responsibility.

Note that some argument parsing functions (mostly colormode_or_err())
already implement this, as they are usually used with optional
arguments.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agonamespace.h: fix compilation on Linux < 4.10
Thomas Devoogdt [Mon, 7 Apr 2025 12:20:12 +0000 (14:20 +0200)] 
namespace.h: fix compilation on Linux < 4.10

sys-utils/lsns.c: In function ‘add_namespace_from_sock’:
sys-utils/lsns.c:580:19: error: ‘SIOCGSKNS’ undeclared (first use in this function)
  nsfd = ioctl(sk, SIOCGSKNS);
                   ^~~~~~~~~

SIOCGSKNS was added in https://github.com/torvalds/linux/commit/c62cce2caee558e18aa05c01c2fd3b40f07174f2.

Fixes: https://github.com/util-linux/util-linux/issues/3502
Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
3 months agoMerge branch 'fix/leading_colon_run_shell' of https://github.com/cgoesche/util-linux...
Karel Zak [Mon, 7 Apr 2025 12:11:42 +0000 (14:11 +0200)] 
Merge branch 'fix/leading_colon_run_shell' of https://github.com/cgoesche/util-linux-fork

* 'fix/leading_colon_run_shell' of https://github.com/cgoesche/util-linux-fork:
  more: fix broken ':!command' command key

3 months agoMerge branch 'fix/implicit_prev_shell_command' of https://github.com/cgoesche/util...
Karel Zak [Mon, 7 Apr 2025 12:11:05 +0000 (14:11 +0200)] 
Merge branch 'fix/implicit_prev_shell_command' of https://github.com/cgoesche/util-linux-fork

* 'fix/implicit_prev_shell_command' of https://github.com/cgoesche/util-linux-fork:
  more: fix implicit previous shell_line execution #3508

3 months agoMerge branch 'treewide--use-strtopid_or_err' of https://github.com/masatake/util...
Karel Zak [Mon, 7 Apr 2025 12:09:57 +0000 (14:09 +0200)] 
Merge branch 'treewide--use-strtopid_or_err' of https://github.com/masatake/util-linux

* 'treewide--use-strtopid_or_err' of https://github.com/masatake/util-linux:
  treewide: use strtopid_or_err()

3 months agoMerge branch 'PR/coverity' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 7 Apr 2025 12:03:07 +0000 (14:03 +0200)] 
Merge branch 'PR/coverity' of https://github.com/karelzak/util-linux-work

* 'PR/coverity' of https://github.com/karelzak/util-linux-work:
  fdisk: fix possible memory leak
  fdformat: use size_t and ssize_t
  cfdisk: fix memory leak and possible NULL dereference [gcc-analyzer]

3 months agoMerge branch 'feat/add_secure_mode' of https://github.com/cgoesche/util-linux-fork
Karel Zak [Mon, 7 Apr 2025 12:02:45 +0000 (14:02 +0200)] 
Merge branch 'feat/add_secure_mode' of https://github.com/cgoesche/util-linux-fork

* 'feat/add_secure_mode' of https://github.com/cgoesche/util-linux-fork:
  more: Add MORESECURE and PAGERSECURE environment variables #3503

3 months agofindmnt: fix -k option parsing regression
Karel Zak [Mon, 7 Apr 2025 10:35:02 +0000 (12:35 +0200)] 
findmnt: fix -k option parsing regression

It's a really bad idea to change any existing short option to support
optional arguments.

Fixes: https://github.com/util-linux/util-linux/issues/3512
References: 841d15e5d13dd0cc56e450c8dcc592211d66be27
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agomore: fix broken ':!command' command key
cgoesche [Sat, 5 Apr 2025 05:43:04 +0000 (01:43 -0400)] 
more: fix broken ':!command' command key

Addresses: #3509
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agomore: fix implicit previous shell_line execution #3508
cgoesche [Sat, 5 Apr 2025 05:29:35 +0000 (01:29 -0400)] 
more: fix implicit previous shell_line execution #3508

run_shell() will implicitly execute the previous ctl->shell_line
not only if the function was indirectly invoked by the '.' command
but also by a subsequent '!' command.

Addresses: #3508
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agotreewide: use strtopid_or_err()
Masatake YAMATO [Fri, 4 Apr 2025 00:27:10 +0000 (09:27 +0900)] 
treewide: use strtopid_or_err()

Addresses: https://github.com/util-linux/util-linux/pull/3486
Suggested-by: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
3 months agomore: Add MORESECURE and PAGERSECURE environment variables #3503
Christian Goeschel Ndjomouo [Thu, 3 Apr 2025 04:38:29 +0000 (00:38 -0400)] 
more: Add MORESECURE and PAGERSECURE environment variables #3503

Add MORESECURE and PAGERSECURE environment variables to run 'more' in secure mode,
which will effectively disable the _!_ and _v_ commands. This helps to prevent
unprivileged users from running arbitrary shell commands or file manipulations.

Addresses: #3503
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
3 months agofdisk: fix possible memory leak
Karel Zak [Tue, 25 Mar 2025 11:44:13 +0000 (12:44 +0100)] 
fdisk: fix possible memory leak

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agofdformat: use size_t and ssize_t
Karel Zak [Tue, 25 Mar 2025 11:23:35 +0000 (12:23 +0100)] 
fdformat: use size_t and ssize_t

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agocfdisk: fix memory leak and possible NULL dereference [gcc-analyzer]
Karel Zak [Tue, 25 Mar 2025 11:14:14 +0000 (12:14 +0100)] 
cfdisk: fix memory leak and possible NULL dereference [gcc-analyzer]

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'PR/Benno-31Mar' of https://github.com/karelzak/util-linux-work
Karel Zak [Thu, 3 Apr 2025 12:07:35 +0000 (14:07 +0200)] 
Merge branch 'PR/Benno-31Mar' of https://github.com/karelzak/util-linux-work

* 'PR/Benno-31Mar' of https://github.com/karelzak/util-linux-work:
  tests: update coresched tests
  coresched: reduce excessive whitespace and verbosity in usage text
  lsblk: (man) remove the incorrect spaces between the arguments of --ct
  hardlink: fix typoed semicolon to colon in error message
  findmnt: (man) remove duplicated option, and correct a description
  irqtop: improve several more option descriptions, and align them all
  irqtop: improve the description of --batch, and align it with others
  last: don't use a tab character in the --help usage text
  uclampset: simplify the synopsis in the --help usage text
  enosys: add the missing arguments of -s and -i to the usage text

3 months agosetarch: use strtopid_or_err()
Karel Zak [Thu, 3 Apr 2025 12:05:09 +0000 (14:05 +0200)] 
setarch: use strtopid_or_err()

Addresses: https://github.com/util-linux/util-linux/pull/3486
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'PR/fix-strcasecmp' of https://github.com/karelzak/util-linux-work
Karel Zak [Thu, 3 Apr 2025 08:00:16 +0000 (10:00 +0200)] 
Merge branch 'PR/fix-strcasecmp' of https://github.com/karelzak/util-linux-work

* 'PR/fix-strcasecmp' of https://github.com/karelzak/util-linux-work:
  treewide: avoid strcasecmp() for ASCII-only strings
  fdisk,partx: avoid strcasecmp() for ASCII-only strings
  libmount: avoid strcasecmp() for ASCII-only strings
  lsblk: avoid strcasecmp() for ASCII-only strings
  libfdisk: avoid strcasecmp() for ASCII-only strings
  libblkid: avoid strcasecmp() for ASCII-only strings
  include/cctype: fix string comparison

3 months agotests: update coresched tests
Karel Zak [Wed, 2 Apr 2025 11:17:07 +0000 (13:17 +0200)] 
tests: update coresched tests

References: fe62e0a1109e2a108d9a8868211875811b1935b3
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agocoresched: reduce excessive whitespace and verbosity in usage text
Benno Schulenberg [Mon, 31 Mar 2025 09:44:42 +0000 (11:44 +0200)] 
coresched: reduce excessive whitespace and verbosity in usage text

Also, use semicolons instead of periods in option descriptions.

And consistently use an uppercased "PID" in feedback messages.

CC: Phil Auld <pauld@redhat.com>
CC: Thijs Raymakers <thijs@raymakers.nl>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agolsblk: (man) remove the incorrect spaces between the arguments of --ct
Benno Schulenberg [Mon, 31 Mar 2025 09:44:41 +0000 (11:44 +0200)] 
lsblk: (man) remove the incorrect spaces between the arguments of --ct

Also, unabbreviate some needless abbreviations,
and improve some wordings and markup.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agohardlink: fix typoed semicolon to colon in error message
Benno Schulenberg [Mon, 31 Mar 2025 09:44:40 +0000 (11:44 +0200)] 
hardlink: fix typoed semicolon to colon in error message

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agofindmnt: (man) remove duplicated option, and correct a description
Benno Schulenberg [Mon, 31 Mar 2025 09:44:39 +0000 (11:44 +0200)] 
findmnt: (man) remove duplicated option, and correct a description

The page listed both '--shadowed' and '--shadow', while the description
of '--hyperlink' duplicated the possible values of the _mode_ argument
and mistakenly spoke of _when_.

Also, sort the options alphabetically and fix two bits of markup.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agoirqtop: improve several more option descriptions, and align them all
Benno Schulenberg [Mon, 31 Mar 2025 09:44:38 +0000 (11:44 +0200)] 
irqtop: improve several more option descriptions, and align them all

Keep at least two spaces between option+argument and its description,
while making sure not to go above 80 columns per line.

Also, improve the docstring (there is no need to mention that irqtop
is a utility) and remove the ugly Q from the list of interactive keys.

CC: Joe Jin <joe.jin@oracle.com>
CC: Zhenwei Pi <pizhenwei@bytedance.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agoirqtop: improve the description of --batch, and align it with others
Benno Schulenberg [Mon, 31 Mar 2025 09:44:37 +0000 (11:44 +0200)] 
irqtop: improve the description of --batch, and align it with others

Also improve the description of --delay and tweak the one of --json,
and align both descriptions with the preceding ones.

CC: Joe Jin <joe.jin@oracle.com>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agolast: don't use a tab character in the --help usage text
Benno Schulenberg [Mon, 31 Mar 2025 09:44:36 +0000 (11:44 +0200)] 
last: don't use a tab character in the --help usage text

Also, sort options -p and --time-format alphabetically,
like in the man page.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agouclampset: simplify the synopsis in the --help usage text
Benno Schulenberg [Mon, 31 Mar 2025 09:44:35 +0000 (11:44 +0200)] 
uclampset: simplify the synopsis in the --help usage text

The synopsis cannot express all possible forms of the command and still
stay readable, so do not even try.  Giving one, single synopsis is far
clearer.  Also, unabbreviate two words in the option descriptions.

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

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agoenosys: add the missing arguments of -s and -i to the usage text
Benno Schulenberg [Mon, 31 Mar 2025 09:44:34 +0000 (11:44 +0200)] 
enosys: add the missing arguments of -s and -i to the usage text

Also, add a docstring, drop the redundant double dash from the synopsis,
add the missing -m option, and add a missing word to an error message.

CC: Thomas Weißschuh <thomas@t-8ch.de>
Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
3 months agotreewide: avoid strcasecmp() for ASCII-only strings
Karel Zak [Tue, 1 Apr 2025 15:45:01 +0000 (17:45 +0200)] 
treewide: avoid strcasecmp() for ASCII-only strings

Use cctype.h for locale-independent string comparison and to avoid
tricky string conversions like in tr_TR locales.

Fixes: https://github.com/util-linux/util-linux/issues/3490
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agofdisk,partx: avoid strcasecmp() for ASCII-only strings
Karel Zak [Tue, 1 Apr 2025 15:45:01 +0000 (17:45 +0200)] 
fdisk,partx: avoid strcasecmp() for ASCII-only strings

Use cctype.h for locale-independent string comparison and to avoid
tricky string conversions like in tr_TR locales.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolibmount: avoid strcasecmp() for ASCII-only strings
Karel Zak [Tue, 1 Apr 2025 15:45:01 +0000 (17:45 +0200)] 
libmount: avoid strcasecmp() for ASCII-only strings

Use cctype.h for locale-independent string comparison and to avoid
tricky string conversions like in tr_TR locales.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolsblk: avoid strcasecmp() for ASCII-only strings
Karel Zak [Tue, 1 Apr 2025 15:45:01 +0000 (17:45 +0200)] 
lsblk: avoid strcasecmp() for ASCII-only strings

Use cctype.h for locale-independent string comparison and to avoid
tricky string conversions like in tr_TR locales.

Fixes: https://github.com/util-linux/util-linux/issues/3490
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolibfdisk: avoid strcasecmp() for ASCII-only strings
Karel Zak [Tue, 1 Apr 2025 15:45:01 +0000 (17:45 +0200)] 
libfdisk: avoid strcasecmp() for ASCII-only strings

Use cctype.h for locale-independent string comparison and to avoid
tricky string conversions like in tr_TR locales.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agolibblkid: avoid strcasecmp() for ASCII-only strings
Karel Zak [Tue, 1 Apr 2025 15:45:01 +0000 (17:45 +0200)] 
libblkid: avoid strcasecmp() for ASCII-only strings

Use cctype.h for locale-independent string comparison and to avoid
tricky string conversions like in tr_TR locales.

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoinclude/cctype: fix string comparison
Karel Zak [Wed, 2 Apr 2025 09:00:47 +0000 (11:00 +0200)] 
include/cctype: fix string comparison

Reimplement c_strcasecmp() and c_strncasecmp() to be libc compatible
and fix c_strncasecmp() to avoid \0 misinterpretation. The original
implementation was pretty stupid (sorry).

Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agomkfs.bfs: fix memory leaks and weak code
Karel Zak [Tue, 1 Apr 2025 13:54:07 +0000 (15:54 +0200)] 
mkfs.bfs: fix memory leaks and weak code

- use size_t to store strlen() result
- init superblock with the default volume and fsname
- don't use strdup(), it's unnecessary as getopt_long() does not
  modify arguments
- don't use memcpy() as we need to check string sizes
- restrict verbose output 6 bytes

Addresses: https://github.com/util-linux/util-linux/pull/3488
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agotests: mark lsns/filer as TS_KNOWN_FAIL
Karel Zak [Tue, 18 Feb 2025 16:55:36 +0000 (17:55 +0100)] 
tests: mark lsns/filer as TS_KNOWN_FAIL

Let's make the test more robust for stable/ branch.

Addresses: https://github.com/util-linux/util-linux/pull/3205
Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit f589580816220bd70ec5970b41006e1adc82bcf7)

3 months agoMerge branch 'setarch--show-pid' of https://github.com/masatake/util-linux
Karel Zak [Tue, 1 Apr 2025 13:06:54 +0000 (15:06 +0200)] 
Merge branch 'setarch--show-pid' of https://github.com/masatake/util-linux

* 'setarch--show-pid' of https://github.com/masatake/util-linux:
  setarch: add -p/--pid option showing the personality of specified process
  procfs: add a helper function to access /proc/$pid/personality
  bash-completion: (setarch) show some options as the 1st arg

3 months agoMerge branch 'lsfd--bugfix-af-packet' of https://github.com/masatake/util-linux
Karel Zak [Tue, 1 Apr 2025 12:59:24 +0000 (14:59 +0200)] 
Merge branch 'lsfd--bugfix-af-packet' of https://github.com/masatake/util-linux

* 'lsfd--bugfix-af-packet' of https://github.com/masatake/util-linux:
  lsfd: (bug fix) scan the protocol field of /proc/net/packet as a hex number
  tests: (test_mkfds::mapped-packet-socket) add a new parameter, protocol
  lsfd: fix the description for PACKET.PROTOCOL column

3 months agoMerge branch 'master' of https://github.com/pls-no-hack/util-linux
Karel Zak [Tue, 1 Apr 2025 12:43:05 +0000 (14:43 +0200)] 
Merge branch 'master' of https://github.com/pls-no-hack/util-linux

* 'master' of https://github.com/pls-no-hack/util-linux:
  Fix typo in blkdiscard docs

3 months agoMerge branch 'remove-list-head-macro' of https://github.com/masatake/util-linux
Karel Zak [Tue, 1 Apr 2025 12:40:23 +0000 (14:40 +0200)] 
Merge branch 'remove-list-head-macro' of https://github.com/masatake/util-linux

* 'remove-list-head-macro' of https://github.com/masatake/util-linux:
  include/list,lsfd: remove LIST_HEAD macro again

3 months agolsns: enhance compilation without USE_NS_GET_API
Karel Zak [Tue, 1 Apr 2025 12:36:36 +0000 (14:36 +0200)] 
lsns: enhance compilation without USE_NS_GET_API

- Move add_namespace_for_nsfd() declaration to the #ifdef block
- Replace get_netnsid_for_fd() with inline code as it's used only once

References: 2ced43400f35f7bd45b29364e04166a63a06e16a
Signed-off-by: Karel Zak <kzak@redhat.com>
3 months agoMerge branch 'bugfix/undefined-reference-add_namespace_for_nsfd' of https://github...
Karel Zak [Tue, 1 Apr 2025 12:26:44 +0000 (14:26 +0200)] 
Merge branch 'bugfix/undefined-reference-add_namespace_for_nsfd' of https://github.com/ThomasDevoogdt/util-linux

* 'bugfix/undefined-reference-add_namespace_for_nsfd' of https://github.com/ThomasDevoogdt/util-linux:
  lsns: fix undefined reference to add_namespace_for_nsfd #3483

4 months agolsfd: (bug fix) scan the protocol field of /proc/net/packet as a hex number
Masatake YAMATO [Sun, 5 Jan 2025 18:30:25 +0000 (03:30 +0900)] 
lsfd: (bug fix) scan the protocol field of /proc/net/packet as a hex number

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agotests: (test_mkfds::mapped-packet-socket) add a new parameter, protocol
Masatake YAMATO [Sun, 5 Jan 2025 18:49:46 +0000 (03:49 +0900)] 
tests: (test_mkfds::mapped-packet-socket) add a new parameter, protocol

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agolsfd: fix the description for PACKET.PROTOCOL column
Masatake YAMATO [Sun, 5 Jan 2025 17:55:19 +0000 (02:55 +0900)] 
lsfd: fix the description for PACKET.PROTOCOL column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agoFix typo in blkdiscard docs
pls-no-hack [Fri, 28 Mar 2025 13:52:49 +0000 (13:52 +0000)] 
Fix typo in blkdiscard docs

4 months agosetarch: add -p/--pid option showing the personality of specified process
Masatake YAMATO [Tue, 25 Mar 2025 19:49:02 +0000 (04:49 +0900)] 
setarch: add -p/--pid option showing the personality of specified process

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agoprocfs: add a helper function to access /proc/$pid/personality
Masatake YAMATO [Tue, 25 Mar 2025 19:44:14 +0000 (04:44 +0900)] 
procfs: add a helper function to access /proc/$pid/personality

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agobash-completion: (setarch) show some options as the 1st arg
Masatake YAMATO [Thu, 27 Mar 2025 20:41:47 +0000 (05:41 +0900)] 
bash-completion: (setarch) show some options as the 1st arg

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agomore: improve help readability
Karel Zak [Thu, 27 Mar 2025 09:58:24 +0000 (10:58 +0100)] 
more: improve help readability

The internal help can be printed within the current content. In this
case, it's hard to see where the help starts. Add a separator to make
it easier to read.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoipcs: align the first group of options with later ones in the usage text
Benno Schulenberg [Tue, 25 Mar 2025 10:43:05 +0000 (11:43 +0100)] 
ipcs: align the first group of options with later ones in the usage text

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agomkfs.cramfs: (man) mark arguments of -N and -l in bold, not italics
Benno Schulenberg [Tue, 25 Mar 2025 10:43:04 +0000 (11:43 +0100)] 
mkfs.cramfs: (man) mark arguments of -N and -l in bold, not italics

Those possible arguments are literal values, not placeholder words.

Also, improve the description of option -l.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agomkfs.cramfs: vertically align the option descriptions of the usage text
Benno Schulenberg [Tue, 25 Mar 2025 10:43:03 +0000 (11:43 +0100)] 
mkfs.cramfs: vertically align the option descriptions of the usage text

And trim unneeded whitespace.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agomkfs.cramfs: reduce the synopsis to the standard, succinct form
Benno Schulenberg [Tue, 25 Mar 2025 10:43:02 +0000 (11:43 +0100)] 
mkfs.cramfs: reduce the synopsis to the standard, succinct form

The old synopsis was 1) incomplete (mentioning -h and -v, but not
-V and -E and -z, for example), and 2) overlong, being wider than
80 columns.  So, change the synposis to what most other utilities
nowadays use: "<name> [options] <arguments>..." -- this makes it
much clearer what the two required arguments are.

Also, reshuffle the descriptions of the two arguments, to not hide
them among the options.

And remove the description of option -s, as listing an option that
does nothing is not helpful.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoswapon: improve a translator hint, and remove a pointless one
Benno Schulenberg [Tue, 25 Mar 2025 10:43:01 +0000 (11:43 +0100)] 
swapon: improve a translator hint, and remove a pointless one

The reference to "each entry below" made no sense, as that second
translator hint is not before a gettextized message and therefore
did not make it into the POT file.  Gettextizing that message is
not useful as 1) there is nothing to translate, and 2) allowing
the translators to fiddle with the tabs is too complicated, and
3) the --summary output is deprecated anyway.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agofstrim: mark only the mountpoint as placeholder, not options -A and -a
Benno Schulenberg [Tue, 25 Mar 2025 10:43:00 +0000 (11:43 +0100)] 
fstrim: mark only the mountpoint as placeholder, not options -A and -a

Also, write "mountpoint" as one word here, because it's clearer.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agochmem: (man) add missing end-of-bold marker, and add missing OR bar
Benno Schulenberg [Tue, 25 Mar 2025 10:42:59 +0000 (11:42 +0100)] 
chmem: (man) add missing end-of-bold marker, and add missing OR bar

Also, use "EXAMPLES", in the plural, as there are four examples.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agochmem: print warnings about failures always (not only with --verbose)
Benno Schulenberg [Tue, 25 Mar 2025 10:42:58 +0000 (11:42 +0100)] 
chmem: print warnings about failures always (not only with --verbose)

This makes the handling of errors the same as some 90 lines down.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoipcutils, lsipc: unabbreviate two words in some error messages
Benno Schulenberg [Tue, 25 Mar 2025 10:42:57 +0000 (11:42 +0100)] 
ipcutils, lsipc: unabbreviate two words in some error messages

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoipcrm: in usage text, use two lines when option+arguments is very long
Benno Schulenberg [Tue, 25 Mar 2025 10:42:56 +0000 (11:42 +0100)] 
ipcrm: in usage text, use two lines when option+arguments is very long

Also, do not use tabs in the usage text, and keep it within 80 columns.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoipcrm: move a constant argument in order to gettextize the message
Benno Schulenberg [Tue, 25 Mar 2025 10:42:55 +0000 (11:42 +0100)] 
ipcrm: move a constant argument in order to gettextize the message

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoinclude/list,lsfd: remove LIST_HEAD macro again
Masatake YAMATO [Tue, 25 Mar 2025 18:36:50 +0000 (03:36 +0900)] 
include/list,lsfd: remove LIST_HEAD macro again

This reverts commit cafae2d19742ad56a05a51bb23b798dbbd5c62a8.
See 5d74cf0092b132bf224024548e46566033c84937 about the reason.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agolsns: fix undefined reference to add_namespace_for_nsfd #3483
Thomas Devoogdt [Tue, 25 Mar 2025 10:58:18 +0000 (11:58 +0100)] 
lsns: fix undefined reference to add_namespace_for_nsfd #3483

Fixes:

sys-utils/lsns-lsns.o: In function `read_process':
lsns.c:(.text+0x9e8): undefined reference to `add_namespace_for_nsfd'
collect2: error: ld returned 1 exit status

Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
4 months agoMerge branch 'PR/meson-fix-manadocs' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 25 Mar 2025 12:40:36 +0000 (13:40 +0100)] 
Merge branch 'PR/meson-fix-manadocs' of https://github.com/karelzak/util-linux-work

* 'PR/meson-fix-manadocs' of https://github.com/karelzak/util-linux-work:
  meson: fix manadocs for libsmartcols and libblkid

4 months agoMerge branch 'PR/libmount-fix-nocanonicalize' of https://github.com/karelzak/util...
Karel Zak [Tue, 25 Mar 2025 10:15:13 +0000 (11:15 +0100)] 
Merge branch 'PR/libmount-fix-nocanonicalize' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-fix-nocanonicalize' of https://github.com/karelzak/util-linux-work:
  libmount: fix --no-canonicalize regression

4 months agomeson: fix manadocs for libsmartcols and libblkid
Karel Zak [Mon, 24 Mar 2025 14:18:24 +0000 (15:18 +0100)] 
meson: fix manadocs for libsmartcols and libblkid

Fixes: https://github.com/util-linux/util-linux/issues/3475
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'rtc-default' of https://github.com/Villemoes/util-linux
Karel Zak [Mon, 24 Mar 2025 14:05:42 +0000 (15:05 +0100)] 
Merge branch 'rtc-default' of https://github.com/Villemoes/util-linux

* 'rtc-default' of https://github.com/Villemoes/util-linux:
  Revert "hwclock-rtc.c: try the 'new' rtc class first"

4 months agoMerge branch 'PR/meson-poman-install' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 24 Mar 2025 13:45:34 +0000 (14:45 +0100)] 
Merge branch 'PR/meson-poman-install' of https://github.com/karelzak/util-linux-work

* 'PR/meson-poman-install' of https://github.com/karelzak/util-linux-work:
  meson: fix po-man installation

4 months agoMerge branch 'PR/fix-non-widechar' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 24 Mar 2025 13:44:46 +0000 (14:44 +0100)] 
Merge branch 'PR/fix-non-widechar' of https://github.com/karelzak/util-linux-work

* 'PR/fix-non-widechar' of https://github.com/karelzak/util-linux-work:
  misc: never include wchar.h
  autotools: don't use wide-character ncurses if --disable-widechar
  column: fix compiler warning for non-widechar compilation

4 months agoMerge branch 'fix-2nd-typo' of https://github.com/standby24x7/util-linux
Karel Zak [Mon, 24 Mar 2025 13:43:59 +0000 (14:43 +0100)] 
Merge branch 'fix-2nd-typo' of https://github.com/standby24x7/util-linux

* 'fix-2nd-typo' of https://github.com/standby24x7/util-linux:
  sys-utils/flock.c Fix a typo in flock.c

4 months agolibmount: fix --no-canonicalize regression
Karel Zak [Mon, 24 Mar 2025 13:31:05 +0000 (14:31 +0100)] 
libmount: fix --no-canonicalize regression

Fixes: https://github.com/util-linux/util-linux/issues/3474
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agosys-utils/flock.c Fix a typo in flock.c
Masanari Iida [Mon, 24 Mar 2025 09:21:48 +0000 (18:21 +0900)] 
sys-utils/flock.c Fix a typo in flock.c

This patch fixes a spelling typo in a message.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
4 months agolib/fileeq.c Fix a typo in message.
Masanari Iida [Mon, 24 Mar 2025 07:21:44 +0000 (16:21 +0900)] 
lib/fileeq.c Fix a typo in message.

This patch fixes a spelling typo in a command message.

Signed-off-by: Masanari Iida <standby24x7@gmail.com>
4 months agoirqtop: use output string in a more robust way
Karel Zak [Thu, 20 Mar 2025 13:28:17 +0000 (14:28 +0100)] 
irqtop: use output string in a more robust way

Reporte-by: Benno Schulenberg <bensberg@telfort.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agolibsmartcols: report cells data size on debug
Karel Zak [Thu, 20 Mar 2025 13:19:52 +0000 (14:19 +0100)] 
libsmartcols: report cells data size on debug

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoirqtop,lsirq: use scols debug
Karel Zak [Thu, 20 Mar 2025 13:18:14 +0000 (14:18 +0100)] 
irqtop,lsirq: use scols debug

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agomeson: fix po-man installation
Karel Zak [Thu, 20 Mar 2025 12:15:26 +0000 (13:15 +0100)] 
meson: fix po-man installation

* in po-man/meson.build use already defined mandir
* make sure $DESTDIR is used in the install script

Addresses: https://github.com/util-linux/util-linux/pull/3378
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agomisc: never include wchar.h
Karel Zak [Thu, 20 Mar 2025 10:57:06 +0000 (11:57 +0100)] 
misc: never include wchar.h

We have a portable "widechar.h" that follows --disable-widechar and
provides portability. It is a bug to directly include libc's wchar.h
or wctype.h.

Fixes: https://github.com/util-linux/util-linux/issues/3470
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoautotools: don't use wide-character ncurses if --disable-widechar
Karel Zak [Thu, 20 Mar 2025 10:56:07 +0000 (11:56 +0100)] 
autotools: don't use wide-character ncurses if --disable-widechar

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agocolumn: fix compiler warning for non-widechar compilation
Karel Zak [Thu, 20 Mar 2025 10:53:59 +0000 (11:53 +0100)] 
column: fix compiler warning for non-widechar compilation

text-utils/column.c: In function ‘ansi_esc_width’:
text-utils/column.c:212:17: warning: case label value exceeds maximum value for type [-Wswitch-outside-range]

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