]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
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 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>
4 months agodocs: cherry-pick 2.41-ReleaseNotes
Karel Zak [Tue, 18 Mar 2025 13:52:34 +0000 (14:52 +0100)] 
docs: cherry-pick 2.41-ReleaseNotes

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agobuild-sys: update release dates
Karel Zak [Tue, 18 Mar 2025 13:33:47 +0000 (14:33 +0100)] 
build-sys: update release dates

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agopo: update uk.po (from translationproject.org)
Yuri Chornoivan [Tue, 18 Mar 2025 13:33:43 +0000 (14:33 +0100)] 
po: update uk.po (from translationproject.org)

4 months agopo: update ro.po (from translationproject.org)
Remus-Gabriel Chelu [Tue, 18 Mar 2025 13:33:42 +0000 (14:33 +0100)] 
po: update ro.po (from translationproject.org)

4 months agopo: update pl.po (from translationproject.org)
Jakub Bogusz [Tue, 18 Mar 2025 13:33:42 +0000 (14:33 +0100)] 
po: update pl.po (from translationproject.org)

4 months agopo: update nl.po (from translationproject.org)
Benno Schulenberg [Tue, 18 Mar 2025 13:33:42 +0000 (14:33 +0100)] 
po: update nl.po (from translationproject.org)

4 months agopo: update ko.po (from translationproject.org)
Seong-ho Cho [Tue, 18 Mar 2025 13:33:42 +0000 (14:33 +0100)] 
po: update ko.po (from translationproject.org)

4 months agopo: update hr.po (from translationproject.org)
Božidar Putanec [Tue, 18 Mar 2025 13:33:42 +0000 (14:33 +0100)] 
po: update hr.po (from translationproject.org)

4 months agopo: update fr.po (from translationproject.org)
Frédéric Marchal [Tue, 18 Mar 2025 13:33:42 +0000 (14:33 +0100)] 
po: update fr.po (from translationproject.org)

4 months agopo: update es.po (from translationproject.org)
Antonio Ceballos Roa [Tue, 18 Mar 2025 13:33:42 +0000 (14:33 +0100)] 
po: update es.po (from translationproject.org)

4 months agopo-man: merge changes
Karel Zak [Tue, 18 Mar 2025 13:33:40 +0000 (14:33 +0100)] 
po-man: merge changes

4 months agopo-man: add pl.po (from translationproject.org)
Michał Kułach [Tue, 18 Mar 2025 13:33:30 +0000 (14:33 +0100)] 
po-man: add pl.po (from translationproject.org)

4 months agopo-man: update uk.po (from translationproject.org)
Yuri Chornoivan [Tue, 18 Mar 2025 13:33:30 +0000 (14:33 +0100)] 
po-man: update uk.po (from translationproject.org)

4 months agopo-man: update ro.po (from translationproject.org)
Remus-Gabriel Chelu [Tue, 18 Mar 2025 13:33:30 +0000 (14:33 +0100)] 
po-man: update ro.po (from translationproject.org)

4 months agopo-man: update fr.po (from translationproject.org)
Frédéric Marchal [Tue, 18 Mar 2025 13:33:30 +0000 (14:33 +0100)] 
po-man: update fr.po (from translationproject.org)

4 months agopo-man: fix typos in configuration
Karel Zak [Tue, 18 Mar 2025 12:39:09 +0000 (13:39 +0100)] 
po-man: fix typos in configuration

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'PR/no_color' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 18 Mar 2025 11:51:09 +0000 (12:51 +0100)] 
Merge branch 'PR/no_color' of https://github.com/karelzak/util-linux-work

* 'PR/no_color' of https://github.com/karelzak/util-linux-work:
  terminal-colors.d: support NO_COLOR

4 months agosu: (man) fix duplicate asterisk
Gaël PORTAY [Tue, 18 Mar 2025 08:58:32 +0000 (09:58 +0100)] 
su: (man) fix duplicate asterisk

Signed-off-by: Gaël PORTAY <gael.portay@rtone.fr>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoinclude: use public domain for colors.{c,h} and xalloc.h
Karel Zak [Mon, 17 Mar 2025 13:35:10 +0000 (14:35 +0100)] 
include: use public domain for colors.{c,h} and xalloc.h

The LGPL makes it difficult to use the code in the old BSD tools we
have in util-linux. After obtaining agreement from the major
contributors to the files, we are changing it to "Public Domain".

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agounshare: fix typo in --map-groups=subids map name [coverity scan]
Karel Zak [Mon, 17 Mar 2025 12:55:06 +0000 (13:55 +0100)] 
unshare: fix typo in --map-groups=subids map name [coverity scan]

Addresses: https://github.com/util-linux/util-linux/pull/3121
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoterminal-colors.d: support NO_COLOR
Karel Zak [Mon, 17 Mar 2025 12:38:20 +0000 (13:38 +0100)] 
terminal-colors.d: support NO_COLOR

We already provide the ability to easily disable output colorization,
but there is also the https://no-color.org initiative based on the
NO_COLOR environment variable. Let's support this method to disable
colors. Let's be friendly :-)

Addresses: https://github.com/util-linux/util-linux/issues/3463
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'PR/lscpu-risc' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 17 Mar 2025 11:11:08 +0000 (12:11 +0100)] 
Merge branch 'PR/lscpu-risc' of https://github.com/karelzak/util-linux-work

* 'PR/lscpu-risc' of https://github.com/karelzak/util-linux-work:
  tests: (lscpu) update RISC-V tests to add ISA line
  lscpu: RISC-V: Print ISA information in summary

4 months agoMerge branch 'lsfd--revise-unix-endpoints' of https://github.com/masatake/util-linux
Karel Zak [Mon, 17 Mar 2025 11:10:26 +0000 (12:10 +0100)] 
Merge branch 'lsfd--revise-unix-endpoints' of https://github.com/masatake/util-linux

* 'lsfd--revise-unix-endpoints' of https://github.com/masatake/util-linux:
  lsfd: (man) fix a typo
  lsfd: add UNIX.IPEER column
  lsfd: fill ENDPOINTS column for UNIX one-way sockets
  include/list: add a macro for initializing list_head a declarative way
  lsfd: (refactor) add a helper function building ENDPOINTS strings for UNIX socket
  lsfd: add a dummy entry for UNIX socket having no peer to the IPC table
  tests: (lsfd::mkfds-unix-dgram, refactor) split the test into subtests
  tests: add ts_is_in_docker as a helper function
  lsfd: (man) fix a typo

4 months agomore: fix repeat command
Karel Zak [Mon, 17 Mar 2025 10:49:57 +0000 (11:49 +0100)] 
more: fix repeat command

The function more_key_command() may modify the current command setting.
We need to remember the original unmodified version, as specified by
the user, as the previous command; otherwise, the output will be affected
by unexpected cmd.number settings.

Simple reproducer:

 $ more -c /etc/passwd

 - Press <enter> to jump to the next line.
 - Press '.' to repeat the last command.

Old version:
 - It clears the screen and prints only one line (like the "1 <enter>" command).
Fixed version:
 - It jumps to the next line (like the "<enter>" command).

Reported-by: Benno Schulenberg <bensberg@telfort.nl>
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agotests: (lscpu) update RISC-V tests to add ISA line
Karel Zak [Mon, 17 Mar 2025 10:03:52 +0000 (11:03 +0100)] 
tests: (lscpu) update RISC-V tests to add ISA line

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agolscpu: RISC-V: Print ISA information in summary
Sunil V L [Tue, 11 Mar 2025 16:06:46 +0000 (21:36 +0530)] 
lscpu: RISC-V: Print ISA information in summary

The ISA information for RISC-V is important for understanding the
different extensions supported by the CPU. Print the ISA information in
the summary, with the Base ISA and single-letter extensions at the
beginning, followed by multi-letter extensions sorted in alphabetical
order. The information is the same as the cpuinfo information, except
that underscores are replaced by spaces and multi-letter extensions are
simply sorted instead of following any ISA string ordering rule.

The sample output below shows the difference between cpuinfo and lscpu.

cpuinfo output:
isa             : rv64imafdch_zicbom_zicboz_zicntr_zicsr_zifencei_zihintntl_zihintpause_zihpm_zawrs_zfa_zba_zbb_zbc_zbs_smaia_ssaia_sstc

lscpu output:
ISA:                rv64imafdch smaia ssaia sstc zawrs zba zbb zbc zbs zfa zicbom zicboz zicntr zicsr zifencei zihintntl zihintpause zihpm

Signed-off-by: Sunil V L <sunilvl@ventanamicro.com>
4 months agoswapon: remove unnecessary variable usage
Karel Zak [Mon, 17 Mar 2025 09:54:55 +0000 (10:54 +0100)] 
swapon: remove unnecessary variable usage

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agovarious: (man) list --help and --version last among the options
Benno Schulenberg [Sun, 16 Mar 2025 15:20:39 +0000 (16:20 +0100)] 
various: (man) list --help and --version last among the options

Almost all util-linux man pages mention -h/--help and -V/--version
last in the list of options.  Make the few deviant pages conform.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agomore: remove a duplicate call of setlocale()
Benno Schulenberg [Sun, 16 Mar 2025 15:20:38 +0000 (16:20 +0100)] 
more: remove a duplicate call of setlocale()

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoirqtop,lsirq: set up locale path, so messages get actually translated
Benno Schulenberg [Sun, 16 Mar 2025 15:20:37 +0000 (16:20 +0100)] 
irqtop,lsirq: set up locale path, so messages get actually translated

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoswapon: make options --help and --version override --summary
Benno Schulenberg [Thu, 13 Mar 2025 14:51:49 +0000 (15:51 +0100)] 
swapon: make options --help and --version override --summary

When -h or --help is among the given options, most utilities
print a help text, ignoring all other options and arguments.
Make `swapon --summary --help` conform to this general pattern.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoMerge branch 'master' of https://github.com/mdcssw/c-util-linux
Karel Zak [Mon, 17 Mar 2025 09:33:53 +0000 (10:33 +0100)] 
Merge branch 'master' of https://github.com/mdcssw/c-util-linux

* 'master' of https://github.com/mdcssw/c-util-linux:
  Use ipc_stat::cgid for the column COL_CGID.

4 months agoMerge branch 'PR/meson-poman' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 17 Mar 2025 09:32:31 +0000 (10:32 +0100)] 
Merge branch 'PR/meson-poman' of https://github.com/karelzak/util-linux-work

* 'PR/meson-poman' of https://github.com/karelzak/util-linux-work:
  tools/poman-translate: fix to work outside on source dir

4 months agolslogins: fix typo
Karel Zak [Mon, 17 Mar 2025 09:32:08 +0000 (10:32 +0100)] 
lslogins: fix typo

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'PR/coverity' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 17 Mar 2025 09:30:16 +0000 (10:30 +0100)] 
Merge branch 'PR/coverity' of https://github.com/karelzak/util-linux-work

* 'PR/coverity' of https://github.com/karelzak/util-linux-work:
  hwclock: avoid dereferencing a pointer [coverity scan]
  lsfd: initialize struct stat [coverity scan]
  unshare: make strings more robust
  liblastlog2: (test) fix memory leak in failed test [coverity scan]
  libmount: remove possible leak in mnt_context_guess_srcpath_fstype() [coverity scan]
  test_sysinfo: remove memory lea [coverity scan]
  lslogins: remove possible memory leaks [coverity scan]

4 months agolsfd: (man) fix a typo
Masatake YAMATO [Fri, 14 Mar 2025 21:54:02 +0000 (06:54 +0900)] 
lsfd: (man) fix a typo

4 months agolsfd: add UNIX.IPEER column
Masatake YAMATO [Sun, 9 Mar 2025 22:26:49 +0000 (07:26 +0900)] 
lsfd: add UNIX.IPEER column

An example output:

    # ./lsfd -Q 'TYPE == "UNIX" && SOCK.TYPE == "dgram"' \
             -oCOMMAND,PID,TYPE,INODE,UNIX.IPEER,NAME | head

    COMMAND             PID TYPE   INODE UNIX.IPEER NAME
    systemd               1 UNIX    3239      13482 state=connected type=dgram
    systemd               1 UNIX 1649064    1649065 state=connected type=dgram
    systemd               1 UNIX 1649065    1649064 state=connected type=dgram
    systemd               1 UNIX   13465          0 state=connected path=/run/systemd/notify type=dgram
    ...

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agolsfd: fill ENDPOINTS column for UNIX one-way sockets
Masatake YAMATO [Sun, 9 Mar 2025 21:54:04 +0000 (06:54 +0900)] 
lsfd: fill ENDPOINTS column for UNIX one-way sockets

With recvfrom(2) and sendto(2), we can use a UNIX datagram socket at
server side without assigning a peer address with connect(2). Here, I
call such sockets one-way sockets.

    # ss -x -p
    Netid State Recv-Q Send-Q        Local Address:Port  Peer Address:Port Process
    ...
    u_dgr ESTAB      0      0 /run/systemd/notify 13465               * 0  users:(("systemd",pid=1,fd=227))
    u_dgr ESTAB      0      0                   * 35438           * 13465  users:(("systemd-journal",pid=1280,fd=15))
    u_dgr ESTAB      0      0                   * 74792           * 13465  users:(("bluetoothd",pid=13874,fd=4))
    ...

The orignal code could not fill ENDPOINTS for UNIX one-way sockets:

  # ./original-lsfd -Q 'INODE == 13465' -oCOMMAND,PID,TYPE,INODE,NAME,ENDPOINTS
  COMMAND PID TYPE INODE NAME                                                ENDPOINTS
  systemd   1 UNIX 13465 state=connected path=/run/systemd/notify type=dgram

With this change, lsfd can fill the column:

  # ./new-lsfd -Q 'INODE == 13465' -oCOMMAND,PID,TYPE,INODE,NAME,ENDPOINTS
  COMMAND PID TYPE INODE NAME                                                ENDPOINTS
  systemd   1 UNIX 13465 state=connected path=/run/systemd/notify type=dgram 1280,systemd-journal,15rw
                                                                             13874,bluetoothd,4rw

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agoinclude/list: add a macro for initializing list_head a declarative way
Masatake YAMATO [Sun, 9 Mar 2025 21:52:19 +0000 (06:52 +0900)] 
include/list: add a macro for initializing list_head a declarative way

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agolsfd: (refactor) add a helper function building ENDPOINTS strings for UNIX socket
Masatake YAMATO [Sun, 9 Mar 2025 21:40:01 +0000 (06:40 +0900)] 
lsfd: (refactor) add a helper function building ENDPOINTS strings for UNIX socket

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agolsfd: add a dummy entry for UNIX socket having no peer to the IPC table
Masatake YAMATO [Sun, 9 Mar 2025 03:48:34 +0000 (12:48 +0900)] 
lsfd: add a dummy entry for UNIX socket having no peer to the IPC table

With recvfrom(2) and sendto(2), we can use a UNIX datagram socket at
server side without assigning a peer address with connect(2). Here, I
call such sockets one-way sockets.

   # ss -x -p
   Netid State Recv-Q Send-Q        Local Address:Port  Peer Address:Port Process
   ...
   u_dgr ESTAB      0      0 /run/systemd/notify 13465               * 0  users:(("systemd",pid=1,fd=227))
   u_dgr ESTAB      0      0                   * 35438           * 13465  users:(("systemd-journal",pid=1280,fd=15))
   u_dgr ESTAB      0      0                   * 74792           * 13465  users:(("bluetoothd",pid=13874,fd=4))
   ...

The socket, opened with systemd as fd 227, is an example of one-way
socket (13465). It has 0 as "Peer Address:Port". From the side of
systemd process, there is no communication peers. However, the
sockets (35438 and 74792) opened with systemd-journal and bluetoothd
have the one-way socket (13465) as their communication peers.

We expect lsfd prints these connections if user specifies
-o+ENDPOINTS. This change and subsequent changes remove limitations in
this area.

In the early stage of lsfd process, lsfd collects information about
UNIX sockets on the system via unix-diag netlink. lsfd stores the
information to the IPC table. lsfd looks up the IPC table when
printing ENDPOINTS column.

With the original code, lsfd could not fill the ENDPOINTS columns
for sockets connecting to an one-way socket because lsfd did not
store one-way sockets to the IPC table.

  # ./original-lsfd -Q 'INODE == 35438 || INODE == 74792' -oCOMMAND,PID,TYPE,INODE,NAME,ENDPOINTS
  COMMAND           PID TYPE INODE NAME                       ENDPOINTS
  systemd-journal  1280 UNIX 35438 state=connected type=dgram
  bluetoothd      13874 UNIX 74792 state=connected type=dgram

With this change, lsfd can fill the ENDPOINTS columns for sockets
connecting to an one-way socket. The new code puts dummy entries for
the one-way sockets to the IPC table. The dummy entries help lsfd to
find the connections.

  # ./new-lsfd -Q 'INODE == 35438 || INODE == 74792' -oCOMMAND,PID,TYPE,INODE,NAME,ENDPOINTS
  COMMAND           PID TYPE INODE NAME                       ENDPOINTS
  systemd-journal  1280 UNIX 35438 state=connected type=dgram 1,systemd,227rw
  bluetoothd      13874 UNIX 74792 state=connected type=dgram 1,systemd,227rw

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agotests: (lsfd::mkfds-unix-dgram, refactor) split the test into subtests
Masatake YAMATO [Mon, 10 Mar 2025 16:21:16 +0000 (01:21 +0900)] 
tests: (lsfd::mkfds-unix-dgram, refactor) split the test into subtests

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agotests: add ts_is_in_docker as a helper function
Masatake YAMATO [Tue, 11 Mar 2025 16:32:34 +0000 (01:32 +0900)] 
tests: add ts_is_in_docker as a helper function

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agolsfd: (man) fix a typo
Masatake YAMATO [Tue, 11 Mar 2025 15:19:45 +0000 (00:19 +0900)] 
lsfd: (man) fix a typo

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agotools/poman-translate: fix to work outside on source dir
Karel Zak [Thu, 13 Mar 2025 13:46:38 +0000 (14:46 +0100)] 
tools/poman-translate: fix to work outside on source dir

* Let's check only the adoc file name if defined in po4a.cfg, not the
  complete path.

 cd ..
 meson setup build-dir util-linux
 ninja -C build-dir

* Exclude manpage-stub.adoc (it's just an example)

Addresses: https://github.com/util-linux/util-linux/pull/3378
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoUse ipc_stat::cgid for the column COL_CGID.
Koutheir Attouchi [Thu, 13 Mar 2025 18:45:01 +0000 (14:45 -0400)] 
Use ipc_stat::cgid for the column COL_CGID.

4 months agoMerge branch 'hexdump' of https://github.com/eworm-de/util-linux
Karel Zak [Thu, 13 Mar 2025 09:20:36 +0000 (10:20 +0100)] 
Merge branch 'hexdump' of https://github.com/eworm-de/util-linux

* 'hexdump' of https://github.com/eworm-de/util-linux:
  meson: bring hexdump in line with others

4 months agotools: add checktarball-meson.sh
Karel Zak [Thu, 13 Mar 2025 09:12:26 +0000 (10:12 +0100)] 
tools: add checktarball-meson.sh

Simple script to check for missing meson.build files in the release tarball.

Addresses: https://github.com/util-linux/util-linux/issues/3460
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoautotools: add missing meson.build files
Karel Zak [Thu, 13 Mar 2025 09:09:21 +0000 (10:09 +0100)] 
autotools: add missing meson.build files

Fixes: https://github.com/util-linux/util-linux/issues/3460
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agotools: add SPDX-License-Identifier
Karel Zak [Thu, 13 Mar 2025 08:54:45 +0000 (09:54 +0100)] 
tools: add SPDX-License-Identifier

Add an SPDX label to the newly added scripts.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agohwclock: avoid dereferencing a pointer [coverity scan]
Karel Zak [Wed, 12 Mar 2025 14:34:17 +0000 (15:34 +0100)] 
hwclock: avoid dereferencing a pointer [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agolsfd: initialize struct stat [coverity scan]
Karel Zak [Wed, 12 Mar 2025 14:16:18 +0000 (15:16 +0100)] 
lsfd: initialize struct stat [coverity scan]

It's probably unnecessary, but for a complicated function, it's
probably better just to keep the static analyzer happy.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agounshare: make strings more robust
Karel Zak [Wed, 12 Mar 2025 14:05:47 +0000 (15:05 +0100)] 
unshare: make strings more robust

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoliblastlog2: (test) fix memory leak in failed test [coverity scan]
Karel Zak [Wed, 12 Mar 2025 13:29:10 +0000 (14:29 +0100)] 
liblastlog2: (test) fix memory leak in failed test [coverity scan]

This is just a cosmetic change to satisfy the static analyzer. The
free-before-exit is unnecessary, but in this case (library test), it's
better.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agomeson: bring hexdump in line with others
Christian Hesse [Wed, 12 Mar 2025 13:06:14 +0000 (14:06 +0100)] 
meson: bring hexdump in line with others

Before it was different, and the executable was not installed.

4 months agolibmount: remove possible leak in mnt_context_guess_srcpath_fstype() [coverity scan]
Karel Zak [Wed, 12 Mar 2025 13:11:49 +0000 (14:11 +0100)] 
libmount: remove possible leak in mnt_context_guess_srcpath_fstype() [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agotest_sysinfo: remove memory lea [coverity scan]
Karel Zak [Wed, 12 Mar 2025 12:55:12 +0000 (13:55 +0100)] 
test_sysinfo: remove memory lea [coverity scan]

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agolslogins: remove possible memory leaks [coverity scan]
Karel Zak [Wed, 12 Mar 2025 12:49:02 +0000 (13:49 +0100)] 
lslogins: remove possible memory leaks [coverity scan]

The column can be specified more than once. In this case, the code
will gather the column data multiple times, resulting in a memory
leak.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agolibsmartcols: add scols_filter_has_holder()
Karel Zak [Mon, 10 Mar 2025 14:32:58 +0000 (15:32 +0100)] 
libsmartcols: add scols_filter_has_holder()

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'github-issue-3442' of https://github.com/masatake/util-linux
Karel Zak [Mon, 10 Mar 2025 14:19:52 +0000 (15:19 +0100)] 
Merge branch 'github-issue-3442' of https://github.com/masatake/util-linux

* 'github-issue-3442' of https://github.com/masatake/util-linux:
  tests: (lsns) verify NETNSID column for namespaces with no process running
  lsns: make "-Q NETNSID ..." work even if NETNSID column is not enabled
  lsns: show NETNSID for namespaces with no process running
  lsns: (refactor) generalize the code for collecting netnsid information

4 months agoMerge branch 'master' of https://github.com/echoechoin/util-linux
Karel Zak [Mon, 10 Mar 2025 13:48:14 +0000 (14:48 +0100)] 
Merge branch 'master' of https://github.com/echoechoin/util-linux

* 'master' of https://github.com/echoechoin/util-linux:
  sys-utils/chmem: fix typo.

4 months agoMerge branch 'master' of https://github.com/jlinton/util-linux
Karel Zak [Mon, 10 Mar 2025 13:47:19 +0000 (14:47 +0100)] 
Merge branch 'master' of https://github.com/jlinton/util-linux

* 'master' of https://github.com/jlinton/util-linux:
  lscpu: New Arm part numbers

4 months agoexch: cosmetic code changes
Karel Zak [Mon, 10 Mar 2025 13:43:00 +0000 (14:43 +0100)] 
exch: cosmetic code changes

* Remove unnecessary dirfd (use AT_FDCWD directly)
* Remove unnecessary 'rc' variable

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'bugfix/exch-renameat2' of https://github.com/ThomasDevoogdt/util-linux
Karel Zak [Mon, 10 Mar 2025 13:32:40 +0000 (14:32 +0100)] 
Merge branch 'bugfix/exch-renameat2' of https://github.com/ThomasDevoogdt/util-linux

* 'bugfix/exch-renameat2' of https://github.com/ThomasDevoogdt/util-linux:
  exch: fix compile error if renameat2 is not present

4 months agotests: (lsns) verify NETNSID column for namespaces with no process running
Masatake YAMATO [Fri, 7 Mar 2025 22:27:31 +0000 (07:27 +0900)] 
tests: (lsns) verify NETNSID column for namespaces with no process running

This case tests the two changes about lsns:

- make "-Q NETNSID ..." work even if NETNSID column is not enabled, and
- show NETNSID for namespaces with no process running

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agolsns: make "-Q NETNSID ..." work even if NETNSID column is not enabled
Masatake YAMATO [Fri, 7 Mar 2025 21:42:18 +0000 (06:42 +0900)] 
lsns: make "-Q NETNSID ..." work even if NETNSID column is not enabled

With the original code, lsns didn't collect values for NETNSID
unless NETNSID column was enabled. As a result, a filter expression
referencing NETNSID value didn't work expectedly.

  # ip netns add X
  # ip netns set X 99999
  # lsns-original -Q 'NETNSID == "99999"
(PRINT NOTHING)
  # lsns-original -Q 'NETNSID == "99999" -o NETNSID
  NETNSID
    99999

With this change, lsns collects values for NETNSID if the
filter expression given to -Q option refers to NETNSID.

  # lsns-new -Q 'NETNSID == "99999"
            NS TYPE NPROCS PID USER COMMAND
    4026535564 net       0     root

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agolsns: show NETNSID for namespaces with no process running
Masatake YAMATO [Thu, 6 Mar 2025 23:44:30 +0000 (08:44 +0900)] 
lsns: show NETNSID for namespaces with no process running

Fixes #3445

The original code doesn't collect NETNSID for netns namespaces with no
process running.

A way to reproduce this issue:

    # ip netns delete X
    # ip netns add X
    # ip netns set X 117
    # ip netns show
    X (id: 117)
    netns-813c699f-4651-e5e9-6af4-cca568bf2c3a (id: 0)
    # stat /var/run/netns/X
      File: /var/run/netns/X
      Size: 0          Blocks: 0          IO Block: 4096   regular empty file
    Device: 0,4 Inode: 4026533679  Links: 1
    Access: (0444/-r--r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
    Context: system_u:object_r:nsfs_t:s0
    Access: 2025-03-06 00:29:58.598605182 +0900
    Modify: 2025-03-06 00:29:58.598605182 +0900
    Change: 2025-03-06 00:29:58.598605182 +0900
     Birth: -

    # ./lsns -P -o+NETNSID
    NS TYPE  NPROCS PID USER   COMMAND NETNSID
    4026533679 net        0     root
    4026534230 user       0     yamato

NS 4026533679 should have "117" as the value of NETNSID.

Though the original code defined netnsid member in struct
lsns_namespace, the member wasn't used at all. struct lsns_process had
a member having the same name.  The original code used only the one in
struct lsns_process.

This change utilizes the netnsid member in struct lsns_namespace.

I found another bug, so I will provide a test case for this fix in a
subsequent commit.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agolsns: (refactor) generalize the code for collecting netnsid information
Masatake YAMATO [Fri, 7 Mar 2025 22:59:21 +0000 (07:59 +0900)] 
lsns: (refactor) generalize the code for collecting netnsid information

This change is preparation for subsequent bug fixes.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agoexch: fix compile error if renameat2 is not present
Thomas Devoogdt [Thu, 6 Mar 2025 13:18:48 +0000 (14:18 +0100)] 
exch: fix compile error if renameat2 is not present

https://www.man7.org/linux/man-pages/man2/rename.2.html
Available since Linux 3.15 or glibc 2.28,
add a fallback for older systems.

My initial implementation did the exchange using a swap
file if both HAVE_RENAMEAT2 and SYS_renameat2 were absent.
But that is not really what is desired since exch is supposed
to be atomic. So simply return -1 renameat2 is available.

Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
4 months ago{configure.ac,meson.build}: conditionally build {enosys,setpriv} if seccomp is presen...
Thomas Devoogdt [Thu, 6 Mar 2025 10:49:12 +0000 (11:49 +0100)] 
{configure.ac,meson.build}: conditionally build {enosys,setpriv} if seccomp is present #3280

misc-utils/enosys.c:25:27: fatal error: linux/seccomp.h: No such file or directory
 #include <linux/seccomp.h>

Signed-off-by: Thomas Devoogdt <thomas.devoogdt@barco.com>
4 months agosys-utils/chmem: fix typo.
WanBingjiang [Fri, 7 Mar 2025 02:11:54 +0000 (10:11 +0800)] 
sys-utils/chmem: fix typo.