agetty,setterm: (man) remove the mistakenly added -h and -V short options
Three years ago, commit 2b2d317242 was a little overzealous and replaced
also occurrences of --help and --version that were *not* paired with -h
and -V: `agetty` does not know -V and uses -h for something else, and
`setterm` does not know any short options at all.
Karel Zak [Tue, 15 Apr 2025 10:48:32 +0000 (12:48 +0200)]
Merge branch 'meson-fixes' of https://github.com/t-8ch/util-linux
* 'meson-fixes' of https://github.com/t-8ch/util-linux:
meson: use .to_string() in configuration data check
meson: add feature for translated documentation
meson: remove tinfo dependency from 'more'
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
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.
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.
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>
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
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.
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.
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);
^~~~~~~~~
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]
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>
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>
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
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.
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.
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).
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>
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
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
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.
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.
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.
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>