]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
3 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>
3 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>
3 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

3 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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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.

3 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

3 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>
3 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]

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

3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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>
3 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.

3 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

3 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>
3 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>
3 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.

4 months agolscpu: New Arm part numbers
Jeremy Linton [Thu, 6 Mar 2025 18:17:30 +0000 (12:17 -0600)] 
lscpu: New Arm part numbers

Arm has announced the Cortex-A320 and published the TRM here:
https://developer.arm.com/documentation/109551

The Cortex-A520AE with a TRM here:
https://developer.arm.com/documentation/107726

The Cortex-A720AE with a TRM here:
https://developer.arm.com/documentation/102828

The Neoverse-V3AE with a TRM here:
https://developer.arm.com/documentation/101595

Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
4 months agotools/git-grouped-log: sort output
Karel Zak [Thu, 6 Mar 2025 10:05:55 +0000 (11:05 +0100)] 
tools/git-grouped-log: sort output

Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit 0cd3a9030d9ad611ca7773280c55b9e9d2ccceed)

4 months agotools/git-tp-sync: update also po-man
Karel Zak [Thu, 6 Mar 2025 09:39:15 +0000 (10:39 +0100)] 
tools/git-tp-sync: update also po-man

Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit a7541e95b1396d4a80ca18fa4e3d9dcc56bc1561)

4 months agotools/git-tp-sync: fix checkout -f use
Karel Zak [Thu, 6 Mar 2025 09:23:36 +0000 (10:23 +0100)] 
tools/git-tp-sync: fix checkout -f use

Signed-off-by: Karel Zak <kzak@redhat.com>
(cherry picked from commit e21b9fa759b07b251b1e790ee5356dcdf46da55a)

4 months agotests: update lsmem outputs
Karel Zak [Thu, 6 Mar 2025 11:11:37 +0000 (12:11 +0100)] 
tests: update lsmem outputs

Addresses: 68c9f5578230b8a715204d7f05b52b65f97f808a
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agohardlink: replace a strange word in an error message
Benno Schulenberg [Tue, 4 Mar 2025 16:08:06 +0000 (17:08 +0100)] 
hardlink: replace a strange word in an error message

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agolsmem: increase the available width for the summary text labels
Benno Schulenberg [Tue, 4 Mar 2025 16:08:05 +0000 (17:08 +0100)] 
lsmem: increase the available width for the summary text labels

This allows the subsequent numbers to get vertically aligned for
most translations too.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agotests: (lsns/nsfs) consider the cases that lsns returns multiple paths
Masatake YAMATO [Wed, 5 Mar 2025 14:25:52 +0000 (23:25 +0900)] 
tests: (lsns/nsfs) consider the cases that lsns returns multiple paths

Fixes #3442

If a target directory is bind-mount'ed, lsns returns multiple paths
as the value for NSFS column. This change considers this case.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agotests: (lsns/nsfs) check test_sysinfo helper
Masatake YAMATO [Tue, 4 Mar 2025 19:39:12 +0000 (04:39 +0900)] 
tests: (lsns/nsfs) check test_sysinfo helper

This check was missed though the command was used in
the test case.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agotests: improve test_sysinfo to check for NS_GET_NSTYPE usability
Karel Zak [Wed, 5 Mar 2025 08:53:34 +0000 (09:53 +0100)] 
tests: improve test_sysinfo to check for NS_GET_NSTYPE usability

Now the test checks if the kernel supports the NS_GET_NSTYPE ioctl,
but it seems that on some platforms it's implemented but does not work
as expected and returns ENOTTY.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'ci-fix-alt-arch-segfaults' of https://github.com/mrc0mmand/util-linux
Karel Zak [Tue, 4 Mar 2025 18:25:34 +0000 (19:25 +0100)] 
Merge branch 'ci-fix-alt-arch-segfaults' of https://github.com/mrc0mmand/util-linux

* 'ci-fix-alt-arch-segfaults' of https://github.com/mrc0mmand/util-linux:
  ci: bump uraimo/run-on-arch-action to v3
  Revert "ci: temporarily switch the alt-arch job worker to Ubuntu 22.04"

4 months agotests: check for ns-get*-ok
Karel Zak [Tue, 4 Mar 2025 18:07:43 +0000 (19:07 +0100)] 
tests: check for ns-get*-ok

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoci: bump uraimo/run-on-arch-action to v3
Frantisek Sumsal [Tue, 4 Mar 2025 12:37:11 +0000 (13:37 +0100)] 
ci: bump uraimo/run-on-arch-action to v3

The latest v3 version should address the sporadic segfaults we've been
seeing (mainly on s390x).

4 months agoRevert "ci: temporarily switch the alt-arch job worker to Ubuntu 22.04"
Frantisek Sumsal [Tue, 4 Mar 2025 12:36:53 +0000 (13:36 +0100)] 
Revert "ci: temporarily switch the alt-arch job worker to Ubuntu 22.04"

This reverts commit c389f166e5c35e3a7d91205997b75bec5d4353fb.

4 months agoMerge branch 'github-issue-3432' of https://github.com/masatake/util-linux
Karel Zak [Tue, 4 Mar 2025 12:23:04 +0000 (13:23 +0100)] 
Merge branch 'github-issue-3432' of https://github.com/masatake/util-linux

* 'github-issue-3432' of https://github.com/masatake/util-linux:
  test_mkfds: disable ppoll multiplexer if sigset_t is not defined

4 months agoMerge branch 'PR/pidfd-cleanup' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 4 Mar 2025 11:40:20 +0000 (12:40 +0100)] 
Merge branch 'PR/pidfd-cleanup' of https://github.com/karelzak/util-linux-work

* 'PR/pidfd-cleanup' of https://github.com/karelzak/util-linux-work:
  test_mkfds: remove local pidfd_open() fallback
  include/pidfd-utils: improve robustness

4 months agotest_mkfds: disable ppoll multiplexer if sigset_t is not defined
Masatake YAMATO [Tue, 4 Mar 2025 11:05:29 +0000 (20:05 +0900)] 
test_mkfds: disable ppoll multiplexer if sigset_t is not defined

Fixes #3432

The ppoll multiplexer requires RAW sigset_t type generally defined in
asm/linux.h. However, the parisc arch of the kernel older than
487fa28fa8b60417642ac58e8beda6e2509d18f9 didn't export the type to
the user space.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
4 months agoMerge branch 'PR/irq-misc' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 4 Mar 2025 10:53:07 +0000 (11:53 +0100)] 
Merge branch 'PR/irq-misc' of https://github.com/karelzak/util-linux-work

* 'PR/irq-misc' of https://github.com/karelzak/util-linux-work:
  lsirq: add support for reading data from given file
  irqtop: support json output format
  irqtop: add max iteration support
  irqtop: add batch mode support

4 months agotest_mkfds: remove local pidfd_open() fallback
Karel Zak [Tue, 4 Mar 2025 10:44:16 +0000 (11:44 +0100)] 
test_mkfds: remove local pidfd_open() fallback

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoinclude/pidfd-utils: improve robustness
Karel Zak [Tue, 4 Mar 2025 08:47:11 +0000 (09:47 +0100)] 
include/pidfd-utils: improve robustness

* remove global UL_HAVE_PIDFD, in many cases we need only subset of pidfd
  kernel API, rrather than all the functios

* improve #ifdefs for pidfd_*() direct syscalls

* improve dummy fallback to not redefine system header files

Fixes: https://github.com/util-linux/util-linux/issues/3437
Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'fallocate-options-excl' of https://github.com/aerusso/util-linux
Karel Zak [Tue, 4 Mar 2025 09:55:43 +0000 (10:55 +0100)] 
Merge branch 'fallocate-options-excl' of https://github.com/aerusso/util-linux

* 'fallocate-options-excl' of https://github.com/aerusso/util-linux:
  fallocate: rework incompatible options

4 months agocolumn: replace a mistaken word in an error message
Benno Schulenberg [Mon, 3 Mar 2025 10:21:37 +0000 (11:21 +0100)] 
column: replace a mistaken word in an error message

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agolsirq: add support for reading data from given file
Joe Jin [Fri, 28 Feb 2025 16:13:34 +0000 (08:13 -0800)] 
lsirq: add support for reading data from given file

This is helpful for analyzng data saved from other system.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Zhenwei Pi <pizhenwei@bytedance.com>
Cc: Sami Kerola <kerolasa@iki.fi>
Cc: Karel Zak <kzak@redhat.com>
4 months agoirqtop: support json output format
Joe Jin [Fri, 28 Feb 2025 16:13:33 +0000 (08:13 -0800)] 
irqtop: support json output format

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Zhenwei Pi <pizhenwei@bytedance.com>
Cc: Sami Kerola <kerolasa@iki.fi>
Cc: Karel Zak <kzak@redhat.com>
4 months agoirqtop: add max iteration support
Joe Jin [Fri, 28 Feb 2025 16:13:32 +0000 (08:13 -0800)] 
irqtop: add max iteration support

Add support for setting the number of iterations. This is useful in
non-interactive mode.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Zhenwei Pi <pizhenwei@bytedance.com>
Cc: Sami Kerola <kerolasa@iki.fi>
Cc: Karel Zak <kzak@redhat.com>
4 months agoirqtop: add batch mode support
Joe Jin [Fri, 28 Feb 2025 16:13:31 +0000 (08:13 -0800)] 
irqtop: add batch mode support

Add batch mode support, which could be useful for sending output to
other programs or to a file.

Signed-off-by: Joe Jin <joe.jin@oracle.com>
Cc: Zhenwei Pi <pizhenwei@bytedance.com>
Cc: Sami Kerola <kerolasa@iki.fi>
Cc: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'libblkid/ddf' of https://github.com/t-8ch/util-linux
Karel Zak [Mon, 3 Mar 2025 08:23:24 +0000 (09:23 +0100)] 
Merge branch 'libblkid/ddf' of https://github.com/t-8ch/util-linux

* 'libblkid/ddf' of https://github.com/t-8ch/util-linux:
  libblkid: ddf_read: validate header checksum
  libc/crc32: make fill value of excluded area configurable
  libblkid: ddf_raid: drop little-endian handling
  libblkid: ddf_raid: respect constness of buffer

4 months agoMerge branch 'master' of https://github.com/echoechoin/util-linux
Karel Zak [Mon, 3 Mar 2025 08:23:11 +0000 (09:23 +0100)] 
Merge branch 'master' of https://github.com/echoechoin/util-linux

* 'master' of https://github.com/echoechoin/util-linux:
  misc-utils/lastlog2: Add option -a for listing active users only

4 months agofallocate: rework incompatible options
Antonio Russo [Sun, 2 Mar 2025 19:58:07 +0000 (12:58 -0700)] 
fallocate: rework incompatible options

Follow up to d95f9a6, addressing ordering requirements, natural
incompatibilities between various options, and limitations of
posix_fallocate.

4 months agolibblkid: ddf_read: validate header checksum
Thomas Weißschuh [Thu, 27 Feb 2025 17:16:03 +0000 (18:16 +0100)] 
libblkid: ddf_read: validate header checksum

The DDF header contains a checksum.

Validate it.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
4 months agolibc/crc32: make fill value of excluded area configurable
Thomas Weißschuh [Thu, 27 Feb 2025 17:16:01 +0000 (18:16 +0100)] 
libc/crc32: make fill value of excluded area configurable

A new user of crc32_exclude_offset() is going to be added which requires
a different fill value than the currently hardcoded "0".

Add a parameter where each caller can specify their own value.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
4 months agolibblkid: ddf_raid: drop little-endian handling
Thomas Weißschuh [Thu, 27 Feb 2025 17:15:56 +0000 (18:15 +0100)] 
libblkid: ddf_raid: drop little-endian handling

The DDF specification, both 1.2 and 2.0 require big-endian.
This is also what mdadm expects.

5.2 Byte Ordering

Each section of the DDF MUST be stored in big-endian format
(i.e., the more significant bytes of the section are stored in
lower addresses in relation to bytes of lesser significance).

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
4 months agolibblkid: ddf_raid: respect constness of buffer
Thomas Weißschuh [Thu, 27 Feb 2025 17:15:38 +0000 (18:15 +0100)] 
libblkid: ddf_raid: respect constness of buffer

The buffers returned by blkid_probe_get_buffer() are not allowed to be
modified. Respect this restriction when casting the buffer to other
pointer types.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
4 months agomisc-utils/lastlog2: Add option -a for listing active users only
WanBingjiang [Wed, 26 Feb 2025 07:17:19 +0000 (15:17 +0800)] 
misc-utils/lastlog2: Add option -a for listing active users only

4 months agosys-utils/lscpu: Change object type to SCOLS_JSON_STRING if data == "-"
WanBingjiang [Thu, 27 Feb 2025 07:13:37 +0000 (15:13 +0800)] 
sys-utils/lscpu: Change object type to SCOLS_JSON_STRING if data == "-"

4 months agoinclude/mount-api-utils: improve coding style
Karel Zak [Wed, 26 Feb 2025 10:50:47 +0000 (11:50 +0100)] 
include/mount-api-utils: improve coding style

Improve the alignment of comments and other elements.

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agomount: (man) add info about info messages
Karel Zak [Wed, 26 Feb 2025 10:06:36 +0000 (11:06 +0100)] 
mount: (man) add info about info messages

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoMerge branch 'PR/libmount-statmount-source' of https://github.com/karelzak/util-linux...
Karel Zak [Tue, 25 Feb 2025 11:54:23 +0000 (12:54 +0100)] 
Merge branch 'PR/libmount-statmount-source' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-statmount-source' of https://github.com/karelzak/util-linux-work:
  libmount: add support for STATMOUNT_SB_SOURCE

4 months agolibmount: add support for STATMOUNT_SB_SOURCE
Karel Zak [Tue, 25 Feb 2025 10:48:14 +0000 (11:48 +0100)] 
libmount: add support for STATMOUNT_SB_SOURCE

* read mount source by statmount() 9requires kernel >=6.14
* add new STATMOUNT_* masks

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agofdisk: (man) add note about partition size calculation
Karel Zak [Tue, 25 Feb 2025 10:46:46 +0000 (11:46 +0100)] 
fdisk: (man) add note about partition size calculation

Signed-off-by: Karel Zak <kzak@redhat.com>
4 months agoscriptlive: improve some descriptions, markup, and grammar in the manpage
Benno Schulenberg [Mon, 24 Feb 2025 13:08:40 +0000 (14:08 +0100)] 
scriptlive: improve some descriptions, markup, and grammar in the manpage

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoscriptlive: reduce two usage synopses to one simple one
Benno Schulenberg [Mon, 24 Feb 2025 13:08:39 +0000 (14:08 +0100)] 
scriptlive: reduce two usage synopses to one simple one

No synopsis can show all possible permutattions of arguments and
options, so do not even try and just give the most basic form,
without unneeded -t, -I, or -B.

Also, use angle brackets to show that <timingfile> and <typescript>
are placeholders.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoscriptreplay: mark literal values in the man page in bold, not italic
Benno Schulenberg [Mon, 24 Feb 2025 13:08:38 +0000 (14:08 +0100)] 
scriptreplay: mark literal values in the man page in bold, not italic

Also, mention which keys can be used to speed up, slow down, and pause
the replay.  Shorten the description of '-s' as it is deprecated.  And
improve the description of '-t': it does not override the _timingfile_
positional argument, but takes the place of it, makes it unneeded.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoscriptreplay: reduce two usage synopses to one, and drop the -t from it
Benno Schulenberg [Mon, 24 Feb 2025 13:08:37 +0000 (14:08 +0100)] 
scriptreplay: reduce two usage synopses to one, and drop the -t from it

Those two synopses still did not express several possible forms:

    scriptreplay -m.1 timings
    scriptreplay typescript -t timings -m.1
    ...

So, instead of trying to cover all possibilities, just give the
basic form of the command, which is clearest and most helpful.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoscriptreplay: make Up/Down keys use a percentage instead of fixed amount
Benno Schulenberg [Mon, 24 Feb 2025 13:08:36 +0000 (14:08 +0100)] 
scriptreplay: make Up/Down keys use a percentage instead of fixed amount

Using a fixed 0.1 amount made each subsequent Down-arrow key slow things
down _more_, and each subsequent Up-arrow key speed things up _less_.
It's nicer when each subsequent keystroke has the same relative effect.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoscriptreplay: indicate that <divisor> is conditional on <typescript>
Benno Schulenberg [Mon, 24 Feb 2025 13:08:35 +0000 (14:08 +0100)] 
scriptreplay: indicate that <divisor> is conditional on <typescript>

Also, use angle brackets to show that those words are placeholders,
not literals, and improve the descriptions of the key bindings.

Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
4 months agoMerge branch 'zramctl' of https://github.com/yuwata/util-linux
Karel Zak [Tue, 25 Feb 2025 07:30:11 +0000 (08:30 +0100)] 
Merge branch 'zramctl' of https://github.com/yuwata/util-linux

* 'zramctl' of https://github.com/yuwata/util-linux:
  zramctl: wait for device being initialized and unlocked by udevd

4 months agoMerge branch 'PR/libmount-fix-owner' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 25 Feb 2025 07:29:42 +0000 (08:29 +0100)] 
Merge branch 'PR/libmount-fix-owner' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-fix-owner' of https://github.com/karelzak/util-linux-work:
  Libmount: Fix removal of "owner" option when executed as root