]> git.ipfire.org Git - thirdparty/util-linux.git/log
thirdparty/util-linux.git
7 months agofstrim: fix SYNOPSIS/usage (mandatory fstrim -A|-a|mountpoint)
наб [Mon, 23 Dec 2024 04:54:03 +0000 (05:54 +0100)] 
fstrim: fix SYNOPSIS/usage (mandatory fstrim -A|-a|mountpoint)

7 months agoMerge branch 'gitignore-tests-failures' of https://github.com/LiviaMedeiros/util...
Karel Zak [Mon, 16 Dec 2024 10:44:21 +0000 (11:44 +0100)] 
Merge branch 'gitignore-tests-failures' of https://github.com/LiviaMedeiros/util-linux

* 'gitignore-tests-failures' of https://github.com/LiviaMedeiros/util-linux:
  gitignore: ignore `test/failures`

7 months agotests: add skips when IPv6 is not supported
LiviaMedeiros [Mon, 16 Dec 2024 10:40:37 +0000 (11:40 +0100)] 
tests: add skips when IPv6 is not supported

Before this change on systems with disabled IPv6 (e.g. `CONFIG_IPV6 is
not set` in kernel config), `lsfd/mkfds-tcp6` and `lsfd/mkfds-udp6` were
failing, and `lsfd/option-inet` was hanging forever, making it
impossible to complete the tests.

Signed-off-by: LiviaMedeiros <livia@cirno.name>
Reviewed-by: Masatake YAMATO <yamato@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
7 months agogitignore: ignore `test/failures`
LiviaMedeiros [Fri, 13 Dec 2024 07:36:41 +0000 (15:36 +0800)] 
gitignore: ignore `test/failures`

7 months agoMerge branch 'do-caps-memory-leak' of https://github.com/maks-mishin/util-linux
Karel Zak [Wed, 11 Dec 2024 18:12:33 +0000 (19:12 +0100)] 
Merge branch 'do-caps-memory-leak' of https://github.com/maks-mishin/util-linux

* 'do-caps-memory-leak' of https://github.com/maks-mishin/util-linux:
  sys-utils: (setpriv): fix potential memory leak

7 months agoMerge branch 'PR/libmount-erofs-regfile' of https://github.com/karelzak/util-linux...
Karel Zak [Wed, 11 Dec 2024 18:11:35 +0000 (19:11 +0100)] 
Merge branch 'PR/libmount-erofs-regfile' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-erofs-regfile' of https://github.com/karelzak/util-linux-work:
  libmount: create EROFS loopdev only after ENOTBLK

7 months agoMerge branch 'PR/libsmartcols-hyperlinks' of https://github.com/karelzak/util-linux...
Karel Zak [Wed, 11 Dec 2024 17:54:04 +0000 (18:54 +0100)] 
Merge branch 'PR/libsmartcols-hyperlinks' of https://github.com/karelzak/util-linux-work

* 'PR/libsmartcols-hyperlinks' of https://github.com/karelzak/util-linux-work:
  lsblk: add --hyperlink command line option
  findmnt: add --hyperlink command line option
  include: add functions to implement --hyperlink
  libsmartcols: add support for terminal hyperlinks
  include/ttyutils: add terminal hyperlink ESC sequences

7 months agozramctl: add algorithm-params to bash-completion
Karel Zak [Tue, 10 Dec 2024 11:26:22 +0000 (12:26 +0100)] 
zramctl: add algorithm-params to bash-completion

Signed-off-by: Karel Zak <kzak@redhat.com>
7 months agoMerge branch 'ft-algorithm-params' of https://github.com/LiviaMedeiros/util-linux
Karel Zak [Tue, 10 Dec 2024 11:24:59 +0000 (12:24 +0100)] 
Merge branch 'ft-algorithm-params' of https://github.com/LiviaMedeiros/util-linux

* 'ft-algorithm-params' of https://github.com/LiviaMedeiros/util-linux:
  zramctl: rename `--params` into `--algorithm-params`
  zramctl: add support for `algorithm_params`

7 months agoMerge branch 'PR/lscpu-raw' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 10 Dec 2024 11:21:25 +0000 (12:21 +0100)] 
Merge branch 'PR/lscpu-raw' of https://github.com/karelzak/util-linux-work

* 'PR/lscpu-raw' of https://github.com/karelzak/util-linux-work:
  lscpu: use bool type in control structs
  lscpu: add --raw command line option

7 months agosys-utils: (setpriv): fix potential memory leak
Maks Mishin [Tue, 10 Dec 2024 09:26:32 +0000 (12:26 +0300)] 
sys-utils: (setpriv): fix potential memory leak

Dynamic memory, referenced by 'my_caps' is allocated by calling function 'xstrdup'
add then changed by calling of strsep function.
The free(my_caps) call is incorrect if my_caps != NULL, and points to some
place inside or outside the source string.

Signed-off-by: Maks Mishin <maks.mishinFZ@gmail.com>
7 months agohwclock: Support GNU Hurd
Zhaoming Luo [Mon, 9 Dec 2024 11:16:11 +0000 (19:16 +0800)] 
hwclock: Support GNU Hurd

* configure.ac: add HURD so it can be used in conditional in am files
* sys-utils/Makemodule.am: compile hwclock for GNU Hurd
* sys-utils/hwclock-rtc.c: compile for GNU Hurd
* sys-utils/hwclock.c: compile for GNU Hurd
* sys-utils/hwclock.h: compile for GNU Hurd

Signed-off-by: Zhaoming Luo <zhmingluo@163.com>
7 months agolscpu: use bool type in control structs
Karel Zak [Mon, 9 Dec 2024 11:24:23 +0000 (12:24 +0100)] 
lscpu: use bool type in control structs

References: 63d7937180fcce4ea7fc1d2855872e464f06e779
Signed-off-by: Karel Zak <kzak@redhat.com>
7 months agolscpu: add --raw command line option
Karel Zak [Mon, 9 Dec 2024 11:20:55 +0000 (12:20 +0100)] 
lscpu: add --raw command line option

In certain situations, data alignment is not desired.

Addresses: https://github.com/util-linux/util-linux/pull/3255
Signed-off-by: Karel Zak <kzak@redhat.com>
7 months agohwclock: Remove ioperm declare as it causes nested extern declare warning
Zhaoming Luo [Mon, 9 Dec 2024 02:11:54 +0000 (10:11 +0800)] 
hwclock: Remove ioperm declare as it causes nested extern declare warning

The extern declaration causes the following warning:

```
  CC       sys-utils/hwclock-hwclock-cmos.o
sys-utils/hwclock-cmos.c: In function 'i386_iopl':
sys-utils/hwclock-cmos.c:356:20: warning: nested extern declaration of 'ioperm' [-Wnested-externs]
  356 |         extern int ioperm(unsigned long from, unsigned long num, int turn_on);
      |                    ^~~~~~
sys-utils/hwclock-cmos.c:356:20: warning: redundant redeclaration of 'ioperm' [-Wredundant-decls]
In file included from sys-utils/hwclock-cmos.c:68:
/usr/include/i386-gnu/sys/io.h:29:12: note: previous declaration of 'ioperm' with type 'int(long unsigned int,  long unsigned int,  int)'
   29 | extern int ioperm (unsigned long int __from, unsigned long int __num,
      |            ^~~~~~
  CCLD     hwclock
```

7 months agosetterm: improve "bright %s" error message
Karel Zak [Mon, 9 Dec 2024 09:35:18 +0000 (10:35 +0100)] 
setterm: improve "bright %s" error message

Addresses: https://github.com/util-linux/util-linux/pull/3312
Signed-off-by: Karel Zak <kzak@redhat.com>
7 months agolsblk: add --hyperlink command line option
Karel Zak [Mon, 2 Dec 2024 11:02:38 +0000 (12:02 +0100)] 
lsblk: add --hyperlink command line option

Signed-off-by: Karel Zak <kzak@redhat.com>
7 months agofindmnt: add --hyperlink command line option
Karel Zak [Thu, 28 Nov 2024 12:49:51 +0000 (13:49 +0100)] 
findmnt: add --hyperlink command line option

Signed-off-by: Karel Zak <kzak@redhat.com>
7 months agozramctl: rename `--params` into `--algorithm-params`
LiviaMedeiros [Mon, 9 Dec 2024 09:16:30 +0000 (17:16 +0800)] 
zramctl: rename `--params` into `--algorithm-params`

7 months agolibmount: create EROFS loopdev only after ENOTBLK
Karel Zak [Fri, 6 Dec 2024 11:41:09 +0000 (12:41 +0100)] 
libmount: create EROFS loopdev only after ENOTBLK

The EROFS can mount regular files with a filesystem image without the
need for a loop device.

For backward compatibility with previous versions of EROFS, a loop
device will only be created if the first attempt to mount results
ENOTBLK error.

Addresses: https://github.com/util-linux/util-linux/pull/3288
Signed-off-by: Karel Zak <kzak@redhat.com>
7 months agolibblkid: (gpt) use blkid_probe_verify_csum() for partition array checksum
Thomas Weißschuh [Sun, 8 Dec 2024 08:55:27 +0000 (09:55 +0100)] 
libblkid: (gpt) use blkid_probe_verify_csum() for partition array checksum

All checksums should be tests with this function to keep checksum
validation configurable.

Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
7 months agozramctl: add support for `algorithm_params`
LiviaMedeiros [Sat, 7 Dec 2024 09:00:39 +0000 (17:00 +0800)] 
zramctl: add support for `algorithm_params`

7 months agozramctl: fix typo and memory leak
Karel Zak [Fri, 6 Dec 2024 09:52:00 +0000 (10:52 +0100)] 
zramctl: fix typo and memory leak

Signed-off-by: Karel Zak <kzak@redhat.com>
7 months agoMerge branch 'posix-argument-order' of https://github.com/nilfsuser5678/util-linux
Karel Zak [Fri, 6 Dec 2024 09:05:25 +0000 (10:05 +0100)] 
Merge branch 'posix-argument-order' of https://github.com/nilfsuser5678/util-linux

* 'posix-argument-order' of https://github.com/nilfsuser5678/util-linux:
  libmount: exec mount helpers with posixly correct argument order
  libmount/context_mount: fix argument number comments

7 months agoMerge branch 'PR/libmount-quotes' of https://github.com/karelzak/util-linux-work
Karel Zak [Fri, 6 Dec 2024 09:03:59 +0000 (10:03 +0100)] 
Merge branch 'PR/libmount-quotes' of https://github.com/karelzak/util-linux-work

* 'PR/libmount-quotes' of https://github.com/karelzak/util-linux-work:
  mount: use ul_optstr_is_valid()
  include/optstr: improve optstr parsing

7 months agoMerge branch 'options' of https://github.com/kekek2/util-linux
Karel Zak [Fri, 6 Dec 2024 09:03:41 +0000 (10:03 +0100)] 
Merge branch 'options' of https://github.com/kekek2/util-linux

* 'options' of https://github.com/kekek2/util-linux:
  meson: checking build_libsmartcols for manadocs.
  meson: checking build_libblkid for manadocs
  meson: add checking build-cal
  meson: fix checking build-sulogin
  meson: fix checking build-login
  meson: fix checking build-cramfs
  meson: Add build-hexdump option

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

7 months agoMerge branch 'PR/libblkid-extN-direct' of https://github.com/karelzak/util-linux...
Karel Zak [Tue, 3 Dec 2024 12:20:21 +0000 (13:20 +0100)] 
Merge branch 'PR/libblkid-extN-direct' of https://github.com/karelzak/util-linux-work

* 'PR/libblkid-extN-direct' of https://github.com/karelzak/util-linux-work:
  libblkid: fix spurious ext superblock checksum mismatches

7 months agoMerge branch 'PR/zram-add-COMP-RATIO' of https://github.com/karelzak/util-linux-work
Karel Zak [Tue, 3 Dec 2024 12:19:57 +0000 (13:19 +0100)] 
Merge branch 'PR/zram-add-COMP-RATIO' of https://github.com/karelzak/util-linux-work

* 'PR/zram-add-COMP-RATIO' of https://github.com/karelzak/util-linux-work:
  zramctl: support -o+list notation
  zramctl: add COMP-RATIO column

7 months agolibmount: exec mount helpers with posixly correct argument order
nilfsuser5678 [Fri, 29 Nov 2024 17:27:12 +0000 (17:27 +0000)] 
libmount: exec mount helpers with posixly correct argument order

This improves compatibility with non-gnu userspaces.

On systems where the libc provides posix getopt instead of gnu getopt,
mount helpers which use getopt to parse arguments will not parse
options which appear after non-option arguments. This patch ensures
mount/unmount work as expected in this situation.

mount: fix expected argument order for mount helpers in tests

8 months agolibmount/context_mount: fix argument number comments
nilfsuser5678 [Fri, 29 Nov 2024 17:22:57 +0000 (17:22 +0000)] 
libmount/context_mount: fix argument number comments

8 months agoinclude: add functions to implement --hyperlink
Karel Zak [Thu, 28 Nov 2024 12:39:10 +0000 (13:39 +0100)] 
include: add functions to implement --hyperlink

* add xgethosturi() to allocate file://hostname
* add hyperlinkwanted_or_err() to parse --hyperlink={never,always,auto}

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agolibsmartcols: add support for terminal hyperlinks
Karel Zak [Thu, 28 Nov 2024 11:35:37 +0000 (12:35 +0100)] 
libsmartcols: add support for terminal hyperlinks

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agoinclude/ttyutils: add terminal hyperlink ESC sequences
Karel Zak [Thu, 28 Nov 2024 11:18:22 +0000 (12:18 +0100)] 
include/ttyutils: add terminal hyperlink ESC sequences

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agomount: use ul_optstr_is_valid()
Karel Zak [Wed, 27 Nov 2024 13:10:36 +0000 (14:10 +0100)] 
mount: use ul_optstr_is_valid()

Remove verification in mount(8) and instead use validation based on
parser.

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agoinclude/optstr: improve optstr parsing
Karel Zak [Wed, 27 Nov 2024 13:02:25 +0000 (14:02 +0100)] 
include/optstr: improve optstr parsing

* make sure option cannot start with '='
* add ul_optstr_is_valid()
* add regression test

Signed-off-by: Karel Zak <kzak@redhat.com>
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 agolibblkid: fix spurious ext superblock checksum mismatches
Krister Johansen [Mon, 18 Nov 2024 20:35:22 +0000 (12:35 -0800)] 
libblkid: fix spurious ext superblock checksum mismatches

Reads of ext superblocks can race with updates.  If libblkid observes a
checksum mismatch, re-read the superblock with O_DIRECT in order to get
a consistent view of its contents.  Only if the O_DIRECT read fails the
checksum should it be reported to have failed.

This fixes a problem where devices that were named by filesystem label
failed to be found when systemd attempted to mount them on boot.  The
problem was caused by systemd-udevd using libblkid. If a read of a
superblock resulted in a checksum mismatch, udev will remove the
by-label links which result in the mount call failing to find the
device.  The checksum mismatch that was triggering the problem was
spurious, and when we use O_DIRECT, or even perform a subsequent retry,
the superblock is correctly read.  This resulted in a failure to mount
/boot in one out of every 2,000 or so attempts in our environment.

e2fsprogs fixed[1] an identical version of this bug that afflicted
resize2fs during online grow operations when run from cloud-init.  The
fix there was also to use O_DIRECT in order to read the superblock.
This patch uses a similar approach: read the superblock with O_DIRECT in
the case where a bad checksum is detected.

[1] https://lore.kernel.org/linux-ext4/20230609042239.GA1436857@mit.edu/

Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
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 agozramctl: support -o+list notation
Karel Zak [Mon, 25 Nov 2024 11:25:53 +0000 (12:25 +0100)] 
zramctl: support -o+list notation

* use size_t for ncolumns
* use string_add_to_idarray()

Signed-off-by: Karel Zak <kzak@redhat.com>
8 months agozramctl: add COMP-RATIO column
Karel Zak [Mon, 25 Nov 2024 11:10:37 +0000 (12:10 +0100)] 
zramctl: add COMP-RATIO column

* Improve get_mm_stat() to return both numbers and strings.
* Add get_mm_stat_number() and get_mm_stat_string() functions.
* Add a new COL_COMPRATIO column.

Based on https://github.com/util-linux/util-linux/pull/3293

Co-Author: davidemanini
Signed-off-by: Karel Zak <kzak@redhat.com>
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>