]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
7 months agomeson: checking build_libsmartcols for manadocs.
Alexander Shursha [Thu, 28 Nov 2024 09:03:36 +0000 (12:03 +0300)] 
meson: checking build_libsmartcols for manadocs.

Sponsored by: Future Crew, LLC

7 months agomeson: checking build_libblkid for manadocs
Alexander Shursha [Thu, 28 Nov 2024 09:02:50 +0000 (12:02 +0300)] 
meson: checking build_libblkid for manadocs

Sponsored by: Future Crew, LLC

7 months agomeson: add checking build-cal
Alexander Shursha [Thu, 28 Nov 2024 09:01:12 +0000 (12:01 +0300)] 
meson: add checking build-cal

Sponsored by: Future Crew, LLC

7 months agomeson: fix checking build-sulogin
Alexander Shursha [Thu, 28 Nov 2024 08:59:21 +0000 (11:59 +0300)] 
meson: fix checking build-sulogin

Sponsored by: Future Crew, LLC

7 months agomeson: fix checking build-login
Alexander Shursha [Thu, 28 Nov 2024 08:58:21 +0000 (11:58 +0300)] 
meson: fix checking build-login

Sponsored by: Future Crew, LLC

7 months agomeson: fix checking build-cramfs
Alexander Shursha [Thu, 28 Nov 2024 08:56:51 +0000 (11:56 +0300)] 
meson: fix checking build-cramfs

Sponsored by: Future Crew, LLC

7 months agomeson: Add build-hexdump option
Alexander Shursha [Thu, 28 Nov 2024 08:50:40 +0000 (11:50 +0300)] 
meson: Add build-hexdump option

Sponsored by: Future Crew, LLC

8 months agoMerge branch 'NAS-130825-2-fix-coverity' of https://github.com/ixhamza/util-linux
Karel Zak [Tue, 26 Nov 2024 10:10:01 +0000 (11:10 +0100)] 
Merge branch 'NAS-130825-2-fix-coverity' of https://github.com/ixhamza/util-linux

* 'NAS-130825-2-fix-coverity' of https://github.com/ixhamza/util-linux:
  libblkid: zfs: fix overflow warning [coverity scan]

8 months agoMerge branch 'su-runuser-improvements' of https://github.com/calestyo/util-linux
Karel Zak [Mon, 25 Nov 2024 11:38:00 +0000 (12:38 +0100)] 
Merge branch 'su-runuser-improvements' of https://github.com/calestyo/util-linux

* 'su-runuser-improvements' of https://github.com/calestyo/util-linux:
  man pages: document `--user` option for `runuser`
  man pages: use `user` rather than `username`
  bash-completion: add `--pty` and `--no-pty` options for `su` and `runuser`
  bash-completion: complete `--user` only for `runuser`, not for `su`

8 months agoMerge branch 'PR/econf-readConfig' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 25 Nov 2024 10:41:30 +0000 (11:41 +0100)] 
Merge branch 'PR/econf-readConfig' of https://github.com/karelzak/util-linux-work

* 'PR/econf-readConfig' of https://github.com/karelzak/util-linux-work:
  login,libblkid: use econf_readConfig rather than deprecated econf_readDirs

8 months agoMerge branch 'bitfield-eradication' of https://github.com/keszybz/util-linux
Karel Zak [Mon, 25 Nov 2024 10:30:08 +0000 (11:30 +0100)] 
Merge branch 'bitfield-eradication' of https://github.com/keszybz/util-linux

* 'bitfield-eradication' of https://github.com/keszybz/util-linux:
  Drop pointless bitfields

8 months agoMerge branch 'PR/agetty-issue' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 25 Nov 2024 10:29:44 +0000 (11:29 +0100)] 
Merge branch 'PR/agetty-issue' of https://github.com/karelzak/util-linux-work

* 'PR/agetty-issue' of https://github.com/karelzak/util-linux-work:
  agetty: always read additional issue file locations

8 months agoMerge branch 'PR/libmount-noloopdev' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 25 Nov 2024 10:29:29 +0000 (11:29 +0100)] 
Merge branch 'PR/libmount-noloopdev' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-noloopdev' of https://github.com/karelzak/util-linux-work:
  libmount: support X-mount.noloop

8 months agopo-man: fix typo, update .gitignore
Karel Zak [Mon, 25 Nov 2024 09:51:41 +0000 (10:51 +0100)] 
po-man: fix typo, update .gitignore

* remove "po" from po4a.cfg (it's not lang)
* add ko/, ro/ and sr/ to .gitignore
* add po/ to .gitignore (it's directory with generic po stuff)

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agoman pages: document `--user` option for `runuser`
Christoph Anton Mitterer [Mon, 25 Nov 2024 01:42:27 +0000 (02:42 +0100)] 
man pages: document `--user` option for `runuser`

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
8 months agoman pages: use `user` rather than `username`
Christoph Anton Mitterer [Mon, 25 Nov 2024 01:41:13 +0000 (02:41 +0100)] 
man pages: use `user` rather than `username`

This are also the terms used in the usage outputs of the programs and the rest
of the man pages.

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
8 months agobash-completion: add `--pty` and `--no-pty` options for `su` and `runuser`
Christoph Anton Mitterer [Mon, 25 Nov 2024 01:38:14 +0000 (02:38 +0100)] 
bash-completion: add `--pty` and `--no-pty` options for `su` and `runuser`

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
8 months agobash-completion: complete `--user` only for `runuser`, not for `su`
Christoph Anton Mitterer [Mon, 25 Nov 2024 01:35:34 +0000 (02:35 +0100)] 
bash-completion: complete `--user` only for `runuser`, not for `su`

Signed-off-by: Christoph Anton Mitterer <mail@christoph.anton.mitterer.name>
8 months agolibblkid: zfs: fix overflow warning [coverity scan]
Ameer Hamza [Thu, 21 Nov 2024 12:18:52 +0000 (17:18 +0500)] 
libblkid: zfs: fix overflow warning [coverity scan]

Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
8 months agologin,libblkid: use econf_readConfig rather than deprecated econf_readDirs
Karel Zak [Thu, 21 Nov 2024 09:24:07 +0000 (10:24 +0100)] 
login,libblkid: use econf_readConfig rather than deprecated econf_readDirs

Fixes:

lib/logindefs.c: In function ‘load_defaults’:
lib/logindefs.c:257:9: warning: ‘econf_readDirs’ is deprecated: Use the econf_readConfig/econf_readConfigWithCallback instead [-Wdeprecated-declarations]
  257 |         error = econf_readDirs(&file,
      |         ^~~~~

libblkid/src/config.c: In function 'blkid_read_config':
libblkid/src/config.c:164:17: error: 'econf_readDirs' is deprecated: Use the econf_readConfig/econf_readConfigWithCallback instead [-Werror=deprecated-declarations]
  164 |                 error = econf_readDirs(&file,
      |                 ^~~~~

* check for econf_readConfig() by ./configure and moson

* add UL_VENDORDIR_PATH into pathnames.h to avoid #ifdef in code

* use #ifdef HAVE_ECONF_READCONFIG to switch between econf_readDirs()
  and the econf_readConfig()

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agopo-man: add missing langs to po4a.cfg
Karel Zak [Wed, 20 Nov 2024 22:45:50 +0000 (23:45 +0100)] 
po-man: add missing langs to po4a.cfg

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agoDrop pointless bitfields
Zbigniew Jędrzejewski-Szmek [Wed, 20 Nov 2024 13:14:52 +0000 (14:14 +0100)] 
Drop pointless bitfields

Bitfields have their uses, but the uses here didn't make any sense.
Code generated to read or write bitfields is more complicated (and
slower) because, well, the bits need to be manipulated with special
instructions. So bitfields should be used when we have a structure
that is repeated hundreds or thousands of times in memory and those
saving are higher than the cost of having more complicated code. This
can happen for example in the kernel code. But the code here has
structures that are instantiated once or or at most few times.

In addition, a bitfield often does not save any memory because of
alignment requirements. In the majority of cases modified here, the
bitfield was the last field in a structure, so no memory savings were
made.

$ size build*/{mkswap,more,ul,col,rtcwake,lsmem,lscpu,eject,dmesg,uuidd,taskset,login}
   text    data     bss     dec     hex filename
 132014    1988      88  134090   20bca build/mkswap
 129342    1852      88  131282   200d2 build2/mkswap
  55161    1480     128   56769    ddc1 build/more
  54265    1480     128   55873    da41 build2/more
  14364     868     112   15344    3bf0 build/ul
  14316     868     112   15296    3bc0 build2/ul
  28547    1000     112   29659    73db build/col
  28435    1000     112   29547    736b build2/col
  46914    1960     112   48986    bf5a build/rtcwake
  46834    1960     112   48906    bf0a build2/rtcwake
  63419    1744     176   65339    ff3b build/lsmem
  63403    1744     176   65323    ff2b build2/lsmem
 159885    2864     464  163213   27d8d build/lscpu
 159757    2864     464  163085   27d0d build2/lscpu
  90041    1704      88   91833   166b9 build/eject
  89737    1704      88   91529   16589 build2/eject
  82150    5152    1032   88334   1590e build/dmesg
  81846    5152    1032   88030   157de build2/dmesg
  37601    1368      80   39049    9889 build/uuidd
  37585    1368      80   39033    9879 build2/uuidd
  58906    1336      56   60298    eb8a build/taskset
  58890    1336      56   60282    eb7a build2/taskset
  84761    2128     152   87041   15401 build/login
  84672    2128     152   86952   153a8 build2/login

(To be clear: those small savings are not particularly important. The
motivation for this patch is to eradicate the antipattern of making
things more complicated without any benefit.)

8 months agoagetty: always read additional issue file locations
Karel Zak [Wed, 20 Nov 2024 10:19:02 +0000 (11:19 +0100)] 
agetty: always read additional issue file locations

Currently, additional locations (such as /run or /usr/lib) are only
read if /etc/issue does not exist. This behavior makes it difficult to use
local settings (/etc) together with generated (/run) and distribution-specific
(/usr/lib) files. Let's read all the locations.

If the output of issue files is unwanted, the option --noissue can be
used, or the default locations can be ignored by using --issue-file
<list>.

Fixes: https://github.com/util-linux/util-linux/issues/3279
Addresses: https://github.com/systemd/systemd/issues/35071
Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agobuild(deps): bump redhat-plumbers-in-action/differential-shellcheck
dependabot[bot] [Tue, 4 Jun 2024 07:43:36 +0000 (07:43 +0000)] 
build(deps): bump redhat-plumbers-in-action/differential-shellcheck

Bumps [redhat-plumbers-in-action/differential-shellcheck](https://github.com/redhat-plumbers-in-action/differential-shellcheck) from 4 to 5.
- [Release notes](https://github.com/redhat-plumbers-in-action/differential-shellcheck/releases)
- [Changelog](https://github.com/redhat-plumbers-in-action/differential-shellcheck/blob/main/docs/CHANGELOG.md)
- [Commits](https://github.com/redhat-plumbers-in-action/differential-shellcheck/compare/v4...v5)

8 months agobuild(deps): bump actions/cache from 3 to 4
dependabot[bot] [Tue, 4 Jun 2024 07:43:32 +0000 (07:43 +0000)] 
build(deps): bump actions/cache from 3 to 4

Bumps [actions/cache](https://github.com/actions/cache) from 3 to 4.
- [Release notes](https://github.com/actions/cache/releases)
- [Changelog](https://github.com/actions/cache/blob/main/RELEASES.md)
- [Commits](https://github.com/actions/cache/compare/v3...v4)

8 months agobuild(deps): bump github/codeql-action from 2 to 3
dependabot[bot] [Tue, 4 Jun 2024 07:43:26 +0000 (07:43 +0000)] 
build(deps): bump github/codeql-action from 2 to 3

Bumps [github/codeql-action](https://github.com/github/codeql-action) from 2 to 3.
- [Release notes](https://github.com/github/codeql-action/releases)
- [Changelog](https://github.com/github/codeql-action/blob/main/CHANGELOG.md)
- [Commits](https://github.com/github/codeql-action/compare/v2...v3)

8 months agoMerge branch 'hooksets_const' of https://github.com/MaxKellermann/util-linux
Karel Zak [Wed, 20 Nov 2024 08:56:03 +0000 (09:56 +0100)] 
Merge branch 'hooksets_const' of https://github.com/MaxKellermann/util-linux

* 'hooksets_const' of https://github.com/MaxKellermann/util-linux:
  schedutils: make pointer arrays const
  lsfd-cmd: make pointer arrays const
  libsmartcols: make pointer arrays const
  libfdisk: make pointer arrays const
  login-utils: make pointer arrays const
  libblkid: make pointer arrays const
  lib: make pointer arrays const
  term-utils: make pointer arrays const
  misc-utils: make pointer arrays const
  text-utils: make pointer arrays const
  sys-utils: make pointer arrays const
  disk-utils: make pointer arrays const
  include/c.h: pass const pointer array to print_features()
  libmount/hooks: make `hooksets` array const

8 months agoMerge branch 'meson-rm-lastlog-compat-symlink-option' of https://github.com/jwilliker...
Karel Zak [Wed, 20 Nov 2024 08:49:35 +0000 (09:49 +0100)] 
Merge branch 'meson-rm-lastlog-compat-symlink-option' of https://github.com/jwillikers/util-linux

* 'meson-rm-lastlog-compat-symlink-option' of https://github.com/jwillikers/util-linux:
  meson: remove unused lastlog-compat-symlink option

8 months agoMerge branch 'NAS-130825' of https://github.com/ixhamza/util-linux
Karel Zak [Wed, 20 Nov 2024 08:47:52 +0000 (09:47 +0100)] 
Merge branch 'NAS-130825' of https://github.com/ixhamza/util-linux

* 'NAS-130825' of https://github.com/ixhamza/util-linux:
  libblkid: zfs: Use nvlist for detection instead of Uber blocks

8 months agomeson: remove unused lastlog-compat-symlink option
Jordan Williams [Tue, 19 Nov 2024 14:44:20 +0000 (08:44 -0600)] 
meson: remove unused lastlog-compat-symlink option

This option was not used even when it was originally introduced.

Signed-off-by: Jordan Williams <jordan@jwillikers.com>
8 months agolibmount: support X-mount.noloop
Karel Zak [Tue, 19 Nov 2024 10:54:00 +0000 (11:54 +0100)] 
libmount: support X-mount.noloop

libmount automatically creates a loop device and mounts it if the
source of the mount is a regular file that contains a well-known
filesystem. However, in some cases, this feature may be unwanted. The
new mount option "X-mount.noloop" forces libmount to use the file
directly as the mount source.

Addresses: https://github.com/util-linux/util-linux/pull/3288
Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agoschedutils: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:35:40 +0000 (12:35 +0100)] 
schedutils: make pointer arrays const

8 months agolsfd-cmd: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:35:30 +0000 (12:35 +0100)] 
lsfd-cmd: make pointer arrays const

8 months agolibsmartcols: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:35:21 +0000 (12:35 +0100)] 
libsmartcols: make pointer arrays const

8 months agolibfdisk: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:35:13 +0000 (12:35 +0100)] 
libfdisk: make pointer arrays const

8 months agologin-utils: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:35:02 +0000 (12:35 +0100)] 
login-utils: make pointer arrays const

8 months agolibblkid: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:33:36 +0000 (12:33 +0100)] 
libblkid: make pointer arrays const

8 months agolib: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:33:31 +0000 (12:33 +0100)] 
lib: make pointer arrays const

8 months agoterm-utils: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:33:24 +0000 (12:33 +0100)] 
term-utils: make pointer arrays const

8 months agomisc-utils: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:33:18 +0000 (12:33 +0100)] 
misc-utils: make pointer arrays const

8 months agotext-utils: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:33:12 +0000 (12:33 +0100)] 
text-utils: make pointer arrays const

8 months agosys-utils: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:33:07 +0000 (12:33 +0100)] 
sys-utils: make pointer arrays const

8 months agodisk-utils: make pointer arrays const
Max Kellermann [Mon, 18 Nov 2024 11:33:01 +0000 (12:33 +0100)] 
disk-utils: make pointer arrays const

8 months agoinclude/c.h: pass const pointer array to print_features()
Max Kellermann [Mon, 18 Nov 2024 11:34:49 +0000 (12:34 +0100)] 
include/c.h: pass const pointer array to print_features()

8 months agolibmount/hooks: make `hooksets` array const
Max Kellermann [Mon, 18 Nov 2024 11:18:06 +0000 (12:18 +0100)] 
libmount/hooks: make `hooksets` array const

The pointed-to structures were const, but the pointers were not.

8 months agolsirq,irqtop: cleanup threshold datatype
Karel Zak [Mon, 18 Nov 2024 10:27:26 +0000 (11:27 +0100)] 
lsirq,irqtop: cleanup threshold datatype

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agoMerge branch 'irq-stuff' of https://github.com/rjarry/util-linux
Karel Zak [Mon, 18 Nov 2024 10:22:25 +0000 (11:22 +0100)] 
Merge branch 'irq-stuff' of https://github.com/rjarry/util-linux

* 'irq-stuff' of https://github.com/rjarry/util-linux:
  lsirq: add option to limit cpus
  lsirq,irqtop: add threshold option

8 months agoMerge branch 'PR/libmount-vfs-ro' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 18 Nov 2024 10:18:58 +0000 (11:18 +0100)] 
Merge branch 'PR/libmount-vfs-ro' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-vfs-ro' of https://github.com/karelzak/util-linux-work:
  libmount: implement ro[=vfs,fs]
  libmount: improving readability

8 months agoMerge branch 'PR/nsenter-pidfd-oldkernel' of https://github.com/karelzak/util-linux...
Karel Zak [Mon, 18 Nov 2024 10:16:55 +0000 (11:16 +0100)] 
Merge branch 'PR/nsenter-pidfd-oldkernel' of https://github.com/karelzak/util-linux-work

* 'PR/nsenter-pidfd-oldkernel' of https://github.com/karelzak/util-linux-work:
  nsenter: improve portability to older kernels

8 months agoMerge branch 'PR/tty-group' of https://github.com/karelzak/util-linux-work
Karel Zak [Mon, 18 Nov 2024 10:13:26 +0000 (11:13 +0100)] 
Merge branch 'PR/tty-group' of https://github.com/karelzak/util-linux-work

* 'PR/tty-group' of https://github.com/karelzak/util-linux-work:
  mesg: remove ability to compile with fchmod(S_IWOTH)
  meson: add -D tty-setgid=[false|true]
  autotools: add --disable-makeinstall-tty-setgid

8 months agoMerge branch 'PR/nsenter-empty-environ' of https://github.com/karelzak/util-linux...
Karel Zak [Mon, 18 Nov 2024 10:12:53 +0000 (11:12 +0100)] 
Merge branch 'PR/nsenter-empty-environ' of https://github.com/karelzak/util-linux-work

* 'PR/nsenter-empty-environ' of https://github.com/karelzak/util-linux-work:
  nsenter: support empty environ[]

8 months agoMerge branch 'tmpfstests' of https://github.com/zeha/util-linux
Karel Zak [Mon, 18 Nov 2024 09:26:38 +0000 (10:26 +0100)] 
Merge branch 'tmpfstests' of https://github.com/zeha/util-linux

* 'tmpfstests' of https://github.com/zeha/util-linux:
  Skip tmpfs-sensitive tests if fstype cannot be determined

8 months agoMerge branch 'column-doc' of https://github.com/bertronika/util-linux
Karel Zak [Mon, 18 Nov 2024 09:24:10 +0000 (10:24 +0100)] 
Merge branch 'column-doc' of https://github.com/bertronika/util-linux

* 'column-doc' of https://github.com/bertronika/util-linux:
  column.1.adoc: Fix spelling and improve option descriptions

8 months agoMerge branch 'swapfile-file-selinux' of https://github.com/keszybz/util-linux
Karel Zak [Mon, 18 Nov 2024 09:22:41 +0000 (10:22 +0100)] 
Merge branch 'swapfile-file-selinux' of https://github.com/keszybz/util-linux

* 'swapfile-file-selinux' of https://github.com/keszybz/util-linux:
  mkswap: set selinux label also when creating file

8 months agomkswap: set selinux label also when creating file
Zbigniew Jędrzejewski-Szmek [Sun, 17 Nov 2024 18:04:49 +0000 (19:04 +0100)] 
mkswap: set selinux label also when creating file

With --file, shen the file is created by mkswap, stat() fails with -ENOENT
and the st_mode field is not populated, so the IS_REG() check fails. But if
we created by mkswap, we know it's just a regular file and we should apply
the selinux label.

Reported in https://bugzilla.redhat.com/show_bug.cgi?id=2324811#c56.

8 months agocolumn.1.adoc: Fix spelling and improve option descriptions
Nejc Bertoncelj [Sat, 16 Nov 2024 11:20:49 +0000 (12:20 +0100)] 
column.1.adoc: Fix spelling and improve option descriptions

8 months agoSkip tmpfs-sensitive tests if fstype cannot be determined
Chris Hofstaedtler [Wed, 13 Nov 2024 13:51:37 +0000 (14:51 +0100)] 
Skip tmpfs-sensitive tests if fstype cannot be determined

In certain isolation environments (f.e. Debian's sbuild+unshare),
`/proc/mounts` does not have an entry for the directory we're building in.

Then, findmnt as used in the tests returns nothing. As the build directory
might very well be on tmpfs (and often is, in Debian), disable the two tests
known to fail on tmpfs.

In yet another scenario, if ran in a Docker/podman container, the fstype
will read "overlay", which in the end can also be tmpfs, and we see problems
there, too.

This was noticed because torvalds/linux@e88e0d366f9cfbb810b0c8509dc5d130d5a53e02
changed the behaviour of the underlying syscalls on tmpfs in Linux 6.6.

Closes: #3266
Debian bug #1086706

Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
8 months agomesg: remove ability to compile with fchmod(S_IWOTH)
Karel Zak [Fri, 15 Nov 2024 10:53:37 +0000 (11:53 +0100)] 
mesg: remove ability to compile with fchmod(S_IWOTH)

The default is to use mesg(1) to modify write access for the "tty"
group, but there is an obscure legacy. If mesg(1) is compiled with the
option "--disable-use-tty-group", then it defaults to using
fchmod(S_IWGRP | S_IWOTH). This means that your tty is then writable
for everyone. Let's get rid of this ugly feature.

Reported-by: Chris Hofstaedtler <zeha@debian.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agomeson: add -D tty-setgid=[false|true]
Karel Zak [Fri, 15 Nov 2024 10:32:34 +0000 (11:32 +0100)] 
meson: add -D tty-setgid=[false|true]

If your distribution does not define permissions for installed
binaries and follows the upstream guidelines, disabling the tty
group's setgid could be a beneficial decision in certain situations.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agoautotools: add --disable-makeinstall-tty-setgid
Karel Zak [Fri, 15 Nov 2024 10:30:17 +0000 (11:30 +0100)] 
autotools: add --disable-makeinstall-tty-setgid

If your distribution does not define permissions for installed
binaries and follows the upstream guidelines, disabling the tty
group's setgid could be a beneficial decision in certain situations.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agolsfd: (man) add more filter examples related to unix stream sockets
Masatake YAMATO [Fri, 8 Nov 2024 19:47:51 +0000 (04:47 +0900)] 
lsfd: (man) add more filter examples related to unix stream sockets

Inspired by the blog article:
https://blog.fraggod.net/2024/08/06/list-connected-processes-for-unix-sockets-on-linux.html

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
8 months agolibblkid: zfs: Use nvlist for detection instead of Uber blocks
Ameer Hamza [Fri, 4 Oct 2024 16:57:44 +0000 (21:57 +0500)] 
libblkid: zfs: Use nvlist for detection instead of Uber blocks

Currently, blkid relies on the presence of Uber blocks to detect ZFS
partition types. However, Uber blocks are not consistently dumped for
cache and spare vdevs, particularly in pools created prior to
https://github.com/openzfs/zfs/commit/d9885b3. Additionally, indirect
vdevs are incorrectly detected by blkid due to the presence of Uber
blocks in the label. ZFS itself does not depend on Uber blocks either
when reading ZFS labels; instead, it parses the nvlist.
This commit aligns blkid's approach with ZFS by parsing the nvlist in
the label to detect ZFS partition types, requiring at least one valid
label for successful detection. This change also ensures compatibility
with wipefs, as it now uses nvlist headers for offsets instead of the
Uber Magic offset. Consequently, running wipefs -a will zero out the
nvlist header in each label, fully removing the ZFS partition type and
making the pool unimportable. Previously, wipefs -a  did not clear all
the Uber blocks or delete all nvlist headers, allowing pools to remain
importable even after wiping.

Signed-off-by: Ameer Hamza <ahamza@ixsystems.com>
8 months agonsenter: support empty environ[]
Karel Zak [Thu, 7 Nov 2024 11:26:25 +0000 (12:26 +0100)] 
nsenter: support empty environ[]

There is no error when the /proc/#/environ file does not contain any
NAME=value items.

Fixes: https://github.com/util-linux/util-linux/issues/3270
Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agolsirq: add option to limit cpus
Robin Jarry [Tue, 5 Nov 2024 10:02:38 +0000 (11:02 +0100)] 
lsirq: add option to limit cpus

For consistency with irqtop, add a --cpu-list lsirq option to specify
a list of CPUs for which to display interrupt counters.

get_scols_table() already supports a cpu_set_t argument. Simply parse
the argument and pass it down.

Signed-off-by: Robin Jarry <robin@jarry.cc>
8 months agolsirq,irqtop: add threshold option
Robin Jarry [Tue, 5 Nov 2024 10:22:06 +0000 (11:22 +0100)] 
lsirq,irqtop: add threshold option

Add a new option to filter out IRQs whose counters are below the
specified value. The argument supports plain integers and human readable
values (e.g. 1.2K).

Signed-off-by: Robin Jarry <robin@jarry.cc>
8 months agoMerge branch 'PR/lscpu-hotplug' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 6 Nov 2024 09:50:26 +0000 (10:50 +0100)] 
Merge branch 'PR/lscpu-hotplug' of https://github.com/karelzak/util-linux-work

* 'PR/lscpu-hotplug' of https://github.com/karelzak/util-linux-work:
  lscpu: fix incorrect number of sockets during hotplug

8 months agonsenter: improve portability to older kernels
Karel Zak [Wed, 6 Nov 2024 09:18:17 +0000 (10:18 +0100)] 
nsenter: improve portability to older kernels

The pidfd cannot be used to enter namespaces using setns() before
Linux 5.7. To ensure compatibility with older kernels, we will check
the kernel version before using pidfd_open() and, if necessary, fall
back to using the classic /proc/#/ns/ files.

Reported-by: Alex Xu
Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agoMerge branch 'PR/nsenter-pidfd' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 5 Nov 2024 10:17:10 +0000 (11:17 +0100)] 
Merge branch 'PR/nsenter-pidfd' of https://github.com/karelzak/util-linux-work

* 'PR/nsenter-pidfd' of https://github.com/karelzak/util-linux-work:
  nsenter: Rewrite --user-parent to use pidfd
  include/pidfd-utils: add namespaces ioctls
  nsenter: reuse pidfd for --net-socket
  nsenter: use macros to access the nsfiles array
  nsenter: use pidfd to enter target namespaces
  nsenter: use separate function to enter namespaces
  nsenter: add functions to enable/disable namespaces

9 months agolibsmartcols: make __attributes__ more portable
Karel Zak [Tue, 5 Nov 2024 10:10:31 +0000 (11:10 +0100)] 
libsmartcols: make __attributes__ more portable

Let's use what is already used for libmount. The header file is a public
header and does not require support for the __attribute__() compiler
feature. We need an additional #ifdef to ensure portability.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agoMerge branch 'smartcols-printf' of https://github.com/rjarry/util-linux
Karel Zak [Tue, 5 Nov 2024 10:08:26 +0000 (11:08 +0100)] 
Merge branch 'smartcols-printf' of https://github.com/rjarry/util-linux

* 'smartcols-printf' of https://github.com/rjarry/util-linux:
  treewide: use scols printf api where possible
  libsmartcols: add printf api to fill in column data

9 months agoMerge branch 'mkfds--minor-fixes' of https://github.com/masatake/util-linux
Karel Zak [Tue, 5 Nov 2024 10:00:11 +0000 (11:00 +0100)] 
Merge branch 'mkfds--minor-fixes' of https://github.com/masatake/util-linux

* 'mkfds--minor-fixes' of https://github.com/masatake/util-linux:
  tests: (test_mkfds::make-regular-file) fix the default union member for \"readable\" parameter
  test_mkfds: reserve file descriptors in the early stage of execution

9 months agoMerge branch 'PR/hardlink-nftw-imrovements' of https://github.com/karelzak/util-linux...
Karel Zak [Tue, 5 Nov 2024 09:59:13 +0000 (10:59 +0100)] 
Merge branch 'PR/hardlink-nftw-imrovements' of https://github.com/karelzak/util-linux-work

* 'PR/hardlink-nftw-imrovements' of https://github.com/karelzak/util-linux-work:
  hardlink: implement --mount
  hardlink: add missing verbose messages and unify them
  hardlink: implement --exclude-subtree

9 months agohardlink: add new options to the bash-completion
Karel Zak [Tue, 5 Nov 2024 09:56:14 +0000 (10:56 +0100)] 
hardlink: add new options to the bash-completion

Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agolscpu: fix incorrect number of sockets during hotplug
Anjali K [Mon, 4 Nov 2024 06:32:26 +0000 (12:02 +0530)] 
lscpu: fix incorrect number of sockets during hotplug

lscpu sometimes shows incorrect 'Socket(s)' value if a hotplug operation
is running.
On a 32 CPU 2-socket system, the expected output is as shown below:
Architecture:                  ppc64le
Byte Order:                    Little Endian
CPU(s):                         32
On-line CPU(s) list:          0-31
Model name:                      POWER10 (architected), altivec supported
Model:                         2.0 (pvr 0080 0200)
Thread(s) per core:            8
Core(s) per socket:            2
Socket(s):                     2

On the same system, if hotplug is running along with lscpu, it shows
"Socket(s):" as 3 and 4 incorrectly sometimes.
Architecture:                         ppc64le
Byte Order:                           Little Endian
CPU(s):                               32
On-line CPU(s) list:                  0-11,16-31
Off-line CPU(s) list:                 12-15
Model name:                           POWER10 (architected), altivec supported
Model:                                2.0 (pvr 0080 0200)
Thread(s) per core:                   8
Core(s) per socket:                   1
Socket(s):                            3

The number of sockets is considered as the number of unique core_siblings
CPU groups. The issues causing the number of sockets to sometimes be
higher during hotplug is:
1. The core_siblings of CPUs on the same socket are different because a CPU
on the socket has been onlined/offlined in between. In the below example,
nr sockets was wrongly incremented for CPU 5 though CPU 4 and 5 are on the
same socket because their core_siblings was different as CPU 12 was onlined
in between.
CPU: 4
core_siblings: ff f0 0 0 0 0 0 0
CPU: 5
core_siblings: ff f8 0 0 0 0 0 0

2. The core_siblings file of a CPU is created when a CPU is onlined. It may
have an invalid value for some time until the online operation is fully
complete. In the below example, nr sockets is wrongly incremented because
the core_siblings of CPU 14 was 0 as it had just been onlined.
CPU: 14
core_siblings: 0 0 0 0 0 0 0 0

To fix this, make the below changes:
1. Instead of considering CPUs to be on different sockets if their
core_siblings masks are unequal, consider them to be on different sockets
only if their core_siblings masks don't have even one common CPU. Then CPUs
on the same socket will be correctly identified even if offline/online
operations happen while they are read if at least one CPU in the socket is
online during both reads.
2. Check if a CPU's hotplug operation has been completed before using its
core_siblings file

[kzak@redhat.com: - use xmalloc(),
                  - use ul_strtos32(),
                  - use err() on CPU_ALLOC() error]

Reported-by: Anushree Mathur <anushree.mathur@linux.vnet.ibm.com>
Signed-off-by: Anjali K <anjalik@linux.ibm.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agotreewide: use scols printf api where possible
Robin Jarry [Thu, 31 Oct 2024 22:55:44 +0000 (23:55 +0100)] 
treewide: use scols printf api where possible

Everywhere a string generated with xasprintf() is directly passed to
scols_line_refer_data(), use scols_line_sprintf() to remove the need for
an intermediate buffer.

Replace the (now redundant) private scols_line_asprintf() function.

Signed-off-by: Robin Jarry <robin@jarry.cc>
9 months agolibsmartcols: add printf api to fill in column data
Robin Jarry [Thu, 31 Oct 2024 22:16:56 +0000 (23:16 +0100)] 
libsmartcols: add printf api to fill in column data

Add new API functions using printf(3) compatible format strings to fill
in column data.

These can be used to avoid intermediate buffers in the calling
application code.

Signed-off-by: Robin Jarry <robin@jarry.cc>
9 months agotests: (test_mkfds::make-regular-file) fix the default union member for \"readable...
Masatake YAMATO [Sat, 26 Oct 2024 20:23:03 +0000 (05:23 +0900)] 
tests: (test_mkfds::make-regular-file) fix the default union member for \"readable\" parameter

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 months agotest_mkfds: reserve file descriptors in the early stage of execution
Masatake YAMATO [Sat, 26 Oct 2024 17:05:45 +0000 (02:05 +0900)] 
test_mkfds: reserve file descriptors in the early stage of execution

A factory specified with command line opens some files.  After
opening, the factory remaps the opened file descriptors (ofds) to file
descriptors (rfds) specified with the command line with dup2 system all.

This remapping may fail if there is an overlap between ofds and rfds.
With this change, there cannot be an overlap between ofds and rfds;
test_mkfds reserves rfds in the early stage of execution.

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 months agohardlink: implement --mount
Karel Zak [Thu, 31 Oct 2024 10:21:20 +0000 (11:21 +0100)] 
hardlink: implement --mount

Let's export another feature of nftw() to the hardlink command line.
In this case, we will force the file-tree-walk to stay within the same
filesystem.

Addresses: https://github.com/util-linux/util-linux/discussions/3244
Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agohardlink: add missing verbose messages and unify them
Karel Zak [Thu, 31 Oct 2024 10:00:32 +0000 (11:00 +0100)] 
hardlink: add missing verbose messages and unify them

* use the concept of "Skipped (<reason>) <filename>" for all verbose  messages

* also add "Skipped" messages for the options --exclude and --exclude-subtree

Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agohardlink: implement --exclude-subtree
Karel Zak [Thu, 31 Oct 2024 09:51:11 +0000 (10:51 +0100)] 
hardlink: implement --exclude-subtree

Now, it is possible to exclude files by their names, but it does not
allow for ignoring entire subtrees of the scanned hierarchy. The new
option only applies to directory names and forces the file-tree-walk
to skip the directory and all of its subdirectories.

This is based on FTW_SKIP_SUBTREE, which was originally only available
in glibc (since 2004). Therefore, the code is #ifdef-ed to make it
portable to other libc versions.

Addresses: https://github.com/util-linux/util-linux/discussions/3244
Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agohardlink: re-raise SIGINT instead of exiting
наб [Mon, 28 Oct 2024 18:19:53 +0000 (19:19 +0100)] 
hardlink: re-raise SIGINT instead of exiting

Every TRUE return was either exit(1) or "return error;" anyway,
this is more correct (exit-status-wise) and doesn't hang pipelines weirdly

This also removes a seemingly-extraneous newline written to the standard
output stream in the interrupt handler itself?

9 months agohardlink: fix 0-sized file processing
наб [Mon, 28 Oct 2024 18:19:34 +0000 (19:19 +0100)] 
hardlink: fix 0-sized file processing

The manual says that -s0 will process 0-sized files normally,
but as it stands (a) hardlink considers 0-sized files unlinkable
(so, with -l, unlistable) and (b) fileeq considers reading an empty
prologue to be an error

9 months agohardlink: add --list-duplicates and --zero
наб [Mon, 28 Oct 2024 18:19:30 +0000 (19:19 +0100)] 
hardlink: add --list-duplicates and --zero

--list-duplicates codifies what everyone keeps re-implementing with
find -exec b2sum or src:perforate's finddup or whatever.

hardlink already knows this, so make the data available thusly,
in a format well-suited for pipeline processing
(fixed-width key for uniq/cut/&c.,
 tab delimiter for cut &a.,
 -z for correct filename handling).

9 months agohardlink.1: directory|file is mandatory
наб [Mon, 28 Oct 2024 18:19:14 +0000 (19:19 +0100)] 
hardlink.1: directory|file is mandatory

9 months agoMerge branch 'PR/liblastlog2-stderr' of https://github.com/karelzak/util-linux-work
Karel Zak [Wed, 30 Oct 2024 10:14:46 +0000 (11:14 +0100)] 
Merge branch 'PR/liblastlog2-stderr' of https://github.com/karelzak/util-linux-work

* 'PR/liblastlog2-stderr' of https://github.com/karelzak/util-linux-work:
  tests: (liblastlog2) don't write to stderr and stdout

9 months agoMerge branch 'lsfd--bpf-prog-id-and-tag' of https://github.com/masatake/util-linux
Karel Zak [Wed, 30 Oct 2024 10:14:19 +0000 (11:14 +0100)] 
Merge branch 'lsfd--bpf-prog-id-and-tag' of https://github.com/masatake/util-linux

* 'lsfd--bpf-prog-id-and-tag' of https://github.com/masatake/util-linux:
  tests: (lsfd::mkfds-bpf-prog) verify BPF-PROG.{ID,TAG} column
  tests: (test_mkfds::bpf-prog) report id and tag
  lsfd: add BPF-PROG.TAG column
  lsfd: update bpf related tables
  lsfd: (bugfix) fix wrong type usage in anon_bpf_map_fill_column
  test_mkfds: (bugfix) listing ALL output values for a given factory

9 months agobits: cleanup --help output, add missing _( )
Karel Zak [Wed, 30 Oct 2024 10:10:19 +0000 (11:10 +0100)] 
bits: cleanup --help output, add missing _( )

Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agolibmount: implement ro[=vfs,fs]
Karel Zak [Tue, 29 Oct 2024 14:56:31 +0000 (15:56 +0100)] 
libmount: implement ro[=vfs,fs]

The new mount API allows for specifying whether to use a read-only
setting on the VFS or FS. Let's export this feature to the mount(8)
command line and fstab by adding new optional arguments "fs" and "vfs"
for the readonly mount flags. If nothing is specified, then the
default will be to mount as read-only on both layers for a normal
mount.

 # mount -o ro=vfs /dev/sdc /mnt/test
 ...
 fsopen("ext4", FSOPEN_CLOEXEC)          = 3
 fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sdc", 0) = 0
 fsconfig(3, FSCONFIG_CMD_CREATE, NULL, NULL, 0) = 0
 mount_setattr(4, "", AT_EMPTY_PATH, {attr_set=MOUNT_ATTR_RDONLY, attr_clr=0, propagation=0 /* MS_??? */, userns_fd=0}, 32) = 0
 move_mount(4, "", AT_FDCWD, "/mnt/test", MOVE_MOUNT_F_EMPTY_PATH) = 0

 # mount -o ro=fs /dev/sdc /mnt/test
 ...
 fsopen("ext4", FSOPEN_CLOEXEC)          = 3
 fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sdc", 0) = 0
 fsconfig(3, FSCONFIG_SET_FLAG, "ro", NULL, 0) = 0
 fsconfig(3, FSCONFIG_CMD_CREATE, NULL, NULL, 0) = 0
 move_mount(4, "", AT_FDCWD, "/mnt/test", MOVE_MOUNT_F_EMPTY_PATH) = 0

 # mount -o ro /dev/sdc /mnt/test
 ...
 fsopen("ext4", FSOPEN_CLOEXEC)          = 3
 fsconfig(3, FSCONFIG_SET_STRING, "source", "/dev/sdc", 0) = 0
 fsconfig(3, FSCONFIG_SET_FLAG, "ro", NULL, 0) = 0
 fsconfig(3, FSCONFIG_CMD_CREATE, NULL, NULL, 0) = 0
 mount_setattr(4, "", AT_EMPTY_PATH, {attr_set=MOUNT_ATTR_RDONLY, attr_clr=0, propagation=0 /* MS_??? */, userns_fd=0}, 32) = 0
 move_mount(4, "", AT_FDCWD, "/mnt/test", MOVE_MOUNT_F_EMPTY_PATH) = 0

The patch improves also the mount(8) man page to provide clearer
information about VFS.

Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agolibmount: improving readability
Karel Zak [Tue, 29 Oct 2024 07:58:14 +0000 (08:58 +0100)] 
libmount: improving readability

The function name mnt_optlist_is_recursive() is not accurate. It is
only used for propagation operations based on the MS_REC flag and
should not be confused with any other recursive stuff, such as
ro=recursive.

A more appropriate name for this function would be mnt_optlist_is_rpropagation().

Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agotests: (lsfd::mkfds-bpf-prog) verify BPF-PROG.{ID,TAG} column
Masatake YAMATO [Fri, 25 Oct 2024 20:41:29 +0000 (05:41 +0900)] 
tests: (lsfd::mkfds-bpf-prog) verify BPF-PROG.{ID,TAG} column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 months agotests: (test_mkfds::bpf-prog) report id and tag
Masatake YAMATO [Fri, 25 Oct 2024 20:32:47 +0000 (05:32 +0900)] 
tests: (test_mkfds::bpf-prog) report id and tag

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 months agolsfd: add BPF-PROG.TAG column
Masatake YAMATO [Mon, 14 Oct 2024 07:31:02 +0000 (16:31 +0900)] 
lsfd: add BPF-PROG.TAG column

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 months agolsfd: update bpf related tables
Masatake YAMATO [Mon, 14 Oct 2024 07:51:33 +0000 (16:51 +0900)] 
lsfd: update bpf related tables

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 months agolsfd: (bugfix) fix wrong type usage in anon_bpf_map_fill_column
Masatake YAMATO [Mon, 14 Oct 2024 08:39:15 +0000 (17:39 +0900)] 
lsfd: (bugfix) fix wrong type usage in anon_bpf_map_fill_column

Where we should use anon_bpf_map_data, anon_bpf_prog_data was used.
Fortunately, this has not been a big trouble because anon_bpf_map_data
and anon_bpf_prog_data had no difference in their member layout

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 months agotest_mkfds: (bugfix) listing ALL output values for a given factory
Masatake YAMATO [Fri, 25 Oct 2024 20:14:06 +0000 (05:14 +0900)] 
test_mkfds: (bugfix) listing ALL output values for a given factory

Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 months agotext-utils: add bits command
Robin Jarry [Mon, 6 May 2024 21:45:21 +0000 (23:45 +0200)] 
text-utils: add bits command

Add a new text utility to convert bit masks in various formats.

This can be handy to avoid parsing affinity masks in one's head and/or
to interact with the kernel in a more human friendly way. It is
a rewrite in C of the bits command from my linux-tools python package so
that it can be more widely available.

Here is an example:

 ~# cat /sys/kernel/debug/tracing/tracing_cpumask
 ffffffff,ffffffff,ffffffff,ffffffff
 ~# bits -l ,$(cat /sys/kernel/debug/tracing/tracing_cpumask)
 0-128
 ~# bits -g 58,59,120,123
 9000000,00000000,0c000000,00000000
 ~# bits -g 58,59,120,123 > /sys/kernel/debug/tracing/tracing_cpumask
 ~# echo 1 > /sys/kernel/debug/tracing/tracing_on

Add man page and basic tests.

Link: https://git.sr.ht/~rjarry/linux-tools#bits
Signed-off-by: Robin Jarry <robin@jarry.cc>
9 months agotests: (liblastlog2) don't write to stderr and stdout
Karel Zak [Tue, 22 Oct 2024 09:17:23 +0000 (11:17 +0200)] 
tests: (liblastlog2) don't write to stderr and stdout

Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agohwclock: cleanup save_adjtime()
Karel Zak [Tue, 22 Oct 2024 08:22:08 +0000 (10:22 +0200)] 
hwclock: cleanup save_adjtime()

Signed-off-by: Karel Zak <kzak@redhat.com>
9 months agoMerge branch 'patch-1' of https://github.com/bearhoney/util-linux
Karel Zak [Tue, 22 Oct 2024 08:13:04 +0000 (10:13 +0200)] 
Merge branch 'patch-1' of https://github.com/bearhoney/util-linux

* 'patch-1' of https://github.com/bearhoney/util-linux:
  Update chsh.1.adoc to avoid duplicates in man page