Skip to content

upstream merge#2

Open
ahmed-masud wants to merge 3805 commits intosafai-labs:masterfrom
util-linux:master
Open

upstream merge#2
ahmed-masud wants to merge 3805 commits intosafai-labs:masterfrom
util-linux:master

Conversation

@ahmed-masud
Copy link
Copy Markdown

No description provided.

karelzak and others added 30 commits March 23, 2026 12:23
The caught_signal variable could be modified while the original signal
handler is restored. If this happens, su does not kill itself with the
signal but just triggers another installed signal handler, ultimately
exiting with return value 1 instead.

Prevent this race by storing the value on stack and then proceed with
this definitely fixed value.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Close the session first, then remove the credentials. This keeps the
proper order since credentials are set up first, then the session is
opened.

Also, this brings login's cleanup into the same order as su.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Use 'found() ? 1 : false' instead of bare 'found()' to generate
'#define HAVE_xxx 1' rather than '#define HAVE_xxx', consistent
with autotools.

Signed-off-by: Karel Zak <kzak@redhat.com>
The source code (agetty.c, sulogin.c) checks for USE_PLYMOUTH_SUPPORT,
but meson defined ENABLE_PLYMOUTH_SUPPORT, silently disabling plymouth
support in meson builds.

Rename to USE_PLYMOUTH_SUPPORT to match autotools and source code.

Signed-off-by: Karel Zak <kzak@redhat.com>
No source code uses HAVE_NCURSES (without _W or _H suffix).
In autotools it only exists as an AM_CONDITIONAL for Makefile logic,
not as a config.h define.

Signed-off-by: Karel Zak <kzak@redhat.com>
The mount command uses HAVE_SECURITY_GET_INITIAL_CONTEXT to enable
SELinux context warnings. This check was missing in meson, leaving
that code path dead in meson builds.

Autotools checks for this function in configure.ac since it may be
missing in old libselinux 1.xx versions.

Signed-off-by: Karel Zak <kzak@redhat.com>
Add the missing login-stat-mail option (default: false) to match
autotools --enable-login-stat-mail. When enabled, login will stat()
the mailbox to check for new mail.

Signed-off-by: Karel Zak <kzak@redhat.com>
Add the missing hwclock-gplv3 option (default: true) to match
autotools --disable-hwclock-gplv3. Without the USE_HWCLOCK_GPLv3_DATETIME
define, meson builds used the minimalistic GPLv2 date parser even though
the GPLv3 parse-date.y was always compiled and linked.

Signed-off-by: Karel Zak <kzak@redhat.com>
…versions

Add LIBBLKID_VERSION, LIBBLKID_MAJOR_VERSION, LIBBLKID_MINOR_VERSION,
and LIBBLKID_PATCH_VERSION to blkid.h.in to follow the same pattern as
libmount, libfdisk, and libsmartcols. Keep BLKID_VERSION and BLKID_DATE
as backward-compatible aliases.

Remove redundant AC_DEFINE for library version strings from configure.ac
(LIBMOUNT_VERSION, LIBSMARTCOLS_VERSION, LIBFDISK_VERSION,
LIBLASTLOG2_VERSION). These were duplicated in config.h when the library
public headers already define them via .h.in templates.

Remove LIBBLKID_VERSION and LIBBLKID_DATE from meson config.h for the
same reason.

Signed-off-by: Karel Zak <kzak@redhat.com>
Convert lastlog2.h to lastlog2.h.in and add LIBLASTLOG2_VERSION,
LIBLASTLOG2_MAJOR_VERSION, LIBLASTLOG2_MINOR_VERSION, and
LIBLASTLOG2_PATCH_VERSION defines to follow the same pattern as
libmount, libfdisk, libsmartcols, and libblkid.

Update both autotools (configure.ac, Makemodule.am) and meson
(liblastlog2/meson.build) to generate the header.

Signed-off-by: Karel Zak <kzak@redhat.com>
These config.h defines are never used in source code or anywhere
else in the project.

Signed-off-by: Karel Zak <kzak@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
…k/util-linux-work

* 'PR/unshare-uid-parse-fix' of https://github.com/karelzak/util-linux-work:
  pwdutils: extend ul_getuserpw_str() and ul_getgrp_str() to return ID
Fix UL_LAST_FINAL_RELEASE to not match -devel tags by using a
positive match for final release formats (vX.Y or vX.Y.Z) instead
of only excluding -rc suffixes.

Rename variables to use consistent UL_RELEASE_ prefix:
 - UL_LAST_RELEASE       -> UL_RELEASE_LAST
 - UL_LAST_FINAL_RELEASE -> UL_RELEASE_LAST_STABLE
 - UL_LAST_XY_RELEASE    -> UL_RELEASE_LAST_XY
 - UL_NEXT_RELEASE       -> UL_RELEASE_NEXT
 - UL_NEXT_FINAL_RELEASE -> UL_RELEASE_NEXT_STABLE

Add UL_RELEASE_NEXT_XY (vX.Y of the next release) for use in
download URLs and announcements.
The #ifndef was inverted, causing sys/auxv.h to be included when it
is NOT available. Fix to #ifdef.

Addresses: #4144
Clarify when mount IDs are available depending on how the mount table
was populated (mountinfo parsing vs listmount/statmount).  Document
that mnt_fs_get_uniq_id() returns 0 for mountinfo-parsed tables and
point users to mnt_id_from_path() as the statx-based alternative.

Addresses: #3948
Use mnt_fs_match_source() instead of mnt_fs_streq_srcpath() in
__mnt_table_is_fs_mounted() to compare source paths against mountinfo
entries.

The streq_srcpath() does a simple string comparison that fails when
the device name in mountinfo differs from the resolved fstab source
(e.g., /dev/dm-N vs /dev/mapper/name, or different btrfs RAID member
devices). The match_source() handles device name canonicalization and
tag-based matching through the cache.

Addresses: #3778
Signed-off-by: Karel Zak <kzak@redhat.com>
This makes it easier to review that force_pty is only used (or actually
useable) if USE_PTY is defined.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Extend get_btrfs_fs_root() to return the matching mountinfo entry via
a new rootfs parameter. This allows mnt_table_get_fs_root() to
propagate the actual mounted device as src_fs, so
__mnt_table_is_fs_mounted() uses the device path from mountinfo rather
than the fstab-resolved one.

This fixes btrfs RAID detection where the fstab source (e.g.,
/dev/sdc2) may differ from the device the kernel used in mountinfo
(e.g., /dev/sdc1), causing mount -a to not recognize already-mounted
subvolumes.

Also add a new branch for fstab entries with subvol= (without
subvolid=) to search mountinfo for the matching entry.

The test_is_mounted now accepts an optional mountinfo file argument
to allow testing without a live mount setup.

Addresses: #3778
Signed-off-by: Karel Zak <kzak@redhat.com>
Add a test that verifies mnt_table_is_fs_mounted() correctly detects
already-mounted btrfs subvolumes when the fstab source device differs
from the one in mountinfo (simulating btrfs RAID).

The test uses synthetic mountinfo and fstab files with /dev/sdc1 in
mountinfo and /dev/sdc2 in fstab, covering both subvol= and
subvolid= variants.

Addresses: #3778
Signed-off-by: Karel Zak <kzak@redhat.com>
The variable "name" within manadocs loop is unused. Remove it.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
In some cases it is desirable to have a clean environment for
an unshared process and conveniently prevent any information
leakage into the new namespace.

This is what the --clear-env option can be used for; it makes
it so that unshare(1) clears the environment variable array,
obtained from the calling process, right before executing the
target program.

Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Replace misleading "Delete statement failed" with "Failed to write
entry" since write_entry uses REPLACE INTO for both insert and update.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
The assoc-pidfs use the getino command. Set "TS_KNOWN_FAIL" if
the condition are not met.

Signed-off-by: WanBingjiang <wanbingjiang@webray.com.cn>
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
stoeckmann and others added 30 commits April 15, 2026 12:06
srand and rand are no longer used in the tree. In fact, all randomness
used in tree goes through ul_random_get_bytes.

Reduce macro and function visibility to randutils.c where they are still
used.

While at it, update comment.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
The mcookie utility wants to report the source of randomness, but even
prints getrandom if it failed to retrieve data through it.

Fix this modifying the return data type of ul_random_get_bytes. Instead
of returning a boolean, the actual source is returned. This avoids any
potential TOCTOU or erroneous output.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
The comment is only valid if compiled with getrandom support.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
…/util-linux-fork

* 'fix_tests_run_sh_script' of https://github.com/cgoesche/util-linux-fork:
  tests: (run.sh) remove unused variable
  tests: (run.sh) fix coding style
  tests: (run.sh) remove extraneous case pattern
* 'meson/statx' of https://github.com/t-8ch/util-linux:
  meson: test for statx::stx_mnt_id in sys/stat.h
* 'ci/meson' of https://github.com/t-8ch/util-linux:
  ci: drop dependency from meson to autotools jobs
  ci: run CHECK phase for meson
  ci: run 'make checkusage' only for autotools build
  meson: build test_scols_termreduce
* 'optarg' of https://github.com/stoeckmann/util-linux:
  lsirq: Skip optarg duplication
  chmem: Skip optarg duplication
  getopt: Skip optarg duplication
  copyfilerange: Skip optarg duplication
  blkid: Fix memory leaks
  login: Skip optarg duplication
  lib/cpuset: Skip optarg duplication
  last: Skip optarg duplication
* 'getline_eof' of https://github.com/stoeckmann/util-linux:
  irqtop/lsirq: Handle EOF in get_irqinfo
  newgrp: Correctly handle getline error
…sche/util-linux-fork

* 'kill_decode_test_known_fail' of https://github.com/cgoesche/util-linux-fork:
  tests: (kill/decode) mark test as known-fail for inconsistent s390x/QEMU instances
* 'printf-integers' of https://github.com/t-8ch/util-linux:
  fdisk: use the correct format specifiers for integer types
  lib/procfs: return uint64_t from procfs_process_get_stat_nth()
  chrt: pass correct integer types to printf
  hardlink: avoid format string error for dev_t
  strutils: fix printf formats
Cast to intmax_t/uintmax_t and use their specifiers in translated
message to keep message IDs stable as pointed out by Thomas Weißschuh.

Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'randutils' of https://github.com/stoeckmann/util-linux:
  randutils: Move comment to correct place
  randutils: Keep track of randomness source
  randutils: Reduce function and macro visibility
  randutils: Remove unused rand_get_number
Link setpriv with libeconf if used due to its usage in lib/logindefs.c.

Closes: #4217
Signed-off-by: Tobias Stoeckmann <tobias@stoeckmann.org>
…lzak/util-linux-work

* 'PR/lsblk-multidevice-mounts' of https://github.com/karelzak/util-linux-work:
  lsblk: show mountpoints for all multi-device filesystem members
…ux-work

* 'PR/lib-nls-fix' of https://github.com/karelzak/util-linux-work:
  lib/pidutils, lib/pidfd-utils: use _() instead of N_() in err() calls
…m/cgoesche/util-linux-fork

* 'strutils_strtobool_missing_values' of https://github.com/cgoesche/util-linux-fork:
  lib: (strutils.c) add missing string values for boolean <false>
…ak/util-linux-work

* 'PR/irqtop-slang-vw_printw' of https://github.com/karelzak/util-linux-work:
  irqtop: use irqtop_puts() for pre-formatted table data
  irqtop: add vw_printw() fallback for slang builds
Closes: #4212
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
Commit 6651ae5 added /etc/passwd to the list of shells
to choose from before falling back to _PATH_BSHELL.
This introduced a regression as some tools dont expect
this behavior and assume that unsetting SHELLS is enough.

To re-establish the old behavior we can pass the UL_SHELL_NOPWD
flag to the ul_default_shell() helper to ignore shells in
/etc/passwd.

Addresses: #4242
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
…e/util-linux-fork

* 'blkid_usages_option_test' of https://github.com/cgoesche/util-linux-fork:
  tests: fix grammar in functions.sh
  tests: (blkid) add test for --usages
…goesche/util-linux-fork

* 'copyfilerange_syscall_fallback' of https://github.com/cgoesche/util-linux-fork:
  build: (copyfilerange) include syscall header check for fallback
  style: (misc-utils/copyfilerange.c) fix indentation
  include: (fileutils.h) add fallback for the copy_file_range syscall
Signed-off-by: Karel Zak <kzak@redhat.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.