aboutsummaryrefslogtreecommitdiffstats
AgeCommit message (Collapse)AuthorFilesLines
18 hoursMerge remote-tracking branch ↵HEADmasterKarel Zak4-10/+10
'github/dependabot/github_actions/actions/checkout-6'
18 hoursMerge remote-tracking branch ↵Karel Zak1-1/+1
'github/dependabot/github_actions/actions/upload-artifact-5'
18 hoursMerge remote-tracking branch ↵Karel Zak1-3/+3
'github/dependabot/github_actions/github/codeql-action-4'
18 hoursMerge branch 'feat/check_bash_comp_integrity' of ↵Karel Zak3-2/+147
https://github.com/cgoesche/util-linux-fork * 'feat/check_bash_comp_integrity' of https://github.com/cgoesche/util-linux-fork: bash-completion: (lslogins) fix typo in long option tools: (checkcompletion.sh) test the integrity of long options completion tools: new helper for extraction of program long options from source files
38 hourscal: add note about today highlight on -wKarel Zak1-0/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2 daysbuild(deps): bump actions/checkout from 1 to 6dependabot[bot]4-10/+10
Bumps [actions/checkout](https://github.com/actions/checkout) from 1 to 6. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v1...v6) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
3 daysMerge branch 'lsfd--fix-error-file-memleak' of ↵Karel Zak1-0/+6
https://github.com/masatake/util-linux * 'lsfd--fix-error-file-memleak' of https://github.com/masatake/util-linux: lsfd: fix memory leak related to stat_error_class
3 daysMerge branch 'master' of https://github.com/jthackray/util-linuxKarel Zak1-0/+5
* 'master' of https://github.com/jthackray/util-linux: lscpu: Add a few missing Arm CPU identifiers
4 dayslsfd: fix memory leak related to stat_error_classMasatake YAMATO1-0/+6
Memory objects pointed by the name member of a file object allocate as an instance of stat_error_class are leaked. I intrdouced this bug in a125e2eea7cea4d0bac1404c2e1b1d65d11cc10c. In the commit, I arranged the class hierarchy. Signed-off-by: Masatake YAMATO <yamato@redhat.com>
6 dayslscpu: Add a few missing Arm CPU identifiersJonathan Thackray1-0/+5
6 dayslslogins: remove duplicate errno initializationChristian Goeschel Ndjomouo1-2/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 daysbash-completion: (lslogins) fix typo in long optionChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 daystools: (checkcompletion.sh) test the integrity of long options completionChristian Goeschel Ndjomouo1-22/+36
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
6 daystools: new helper for extraction of program long options from source filescgoesche2-0/+131
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
7 dayseject: fix const qualifier warning in read_speedKarel Zak1-1/+1
Fix const qualifier discarded warning in read_speed(). This warning is reported by gcc 15 which defaults to the C23 standard. The strrchr() function returns a pointer into a const string, so the receiving variable must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 dayspartx: fix const qualifier warning in get_max_partnoKarel Zak1-1/+2
Fix const qualifier discarded warning in get_max_partno(). This warning is reported by gcc 15 which defaults to the C23 standard. The strrchr() function returns a pointer into a const string, so the receiving variable must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 daysenosys: fix const qualifier warning in parse_blockKarel Zak1-1/+1
Fix const qualifier discarded warning in parse_block(). This warning is reported by gcc 15 which defaults to the C23 standard. The strchr() function returns a pointer into a const string, so the receiving variable must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 dayswhereis: fix const qualifier warnings for C23Karel Zak1-3/+4
Fix const qualifier discarded warnings in dirlist_add_subdir() and lookup() functions. These warnings are reported by gcc 15 which defaults to the C23 standard. The strchr() and strrchr() functions return pointers into const strings, so the receiving variables must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 daysnamei: fix const qualifier warning in readlink_to_nameiKarel Zak1-1/+1
Fix const qualifier discarded warning in readlink_to_namei(). This warning is reported by gcc 15 which defaults to the C23 standard. The strrchr() function returns a pointer into a const string, so the receiving variable must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 dayslogger: fix const qualifier warnings for C23Karel Zak1-7/+7
Fix const qualifier discarded warnings in valid_structured_data_param() and valid_structured_data_id() functions. These warnings are reported by gcc 15 which defaults to the C23 standard. The strchr() and strstr() functions return pointers into const strings, so the receiving variables must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 dayslsfd: fix const qualifier warning in strnrstrKarel Zak1-1/+1
Fix const qualifier discarded warning in strnrstr(). This warning is reported by gcc 15 which defaults to the C23 standard. The function returns a non-const pointer into the haystack parameter, and callers modify the string through that pointer. Therefore, the haystack parameter should be char * rather than const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 dayslsfd: fix const qualifier warning in new_counter_specKarel Zak1-1/+1
Fix const qualifier discarded warning in new_counter_spec(). This warning is reported by gcc 15 which defaults to the C23 standard. The function modifies the input string by inserting a null terminator to split it into name and expression parts, so the parameter should be char * rather than const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 daysdmesg: fix const qualifier warnings in parse_calleridKarel Zak1-2/+1
Fix const qualifier discarded warnings in parse_callerid(). These warnings are reported by gcc 15 which defaults to the C23 standard. The strchr() and strstr() functions return pointers into const strings, so the receiving variables must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 dayslibblkid: fix const qualifier warning in blkid_parse_tag_stringKarel Zak1-4/+6
Fix const qualifier discarded warning in blkid_parse_tag_string(). This warning is reported by gcc 15 which defaults to the C23 standard. The strchr() function returns a pointer into a const string, so introduce a separate 'eq' variable to hold this const pointer for finding the '=' separator. Also move the 'cp' variable declaration into the block where it's actually used for quote handling. Signed-off-by: Karel Zak <kzak@redhat.com>
7 dayslibmount: fix const qualifier warning in mnt_parse_mountinfo_lineKarel Zak1-5/+6
Fix const qualifier discarded warning in mnt_parse_mountinfo_line(). This warning is reported by gcc 15 which defaults to the C23 standard. The strstr() function returns a pointer into a const string, so introduce a separate 'sep' variable to hold this const pointer, keeping 'p' for non-const unmangle() results that need to be freed. Signed-off-by: Karel Zak <kzak@redhat.com>
7 dayslibmount: fix const qualifier warnings for C23Karel Zak2-5/+4
Fix const qualifier discarded warnings in optlist_add_flags(), mnt_opt_value_with(), and mnt_optstr_apply_flags() functions. These warnings are reported by gcc 15 which defaults to the C23 standard. The strchr() and strstr() functions return pointers into const strings, so the receiving variables must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 dayslsns: fix const qualifier warnings for C23Karel Zak1-3/+3
Fix const qualifier discarded warnings in read_persistent_namespaces() and is_path_included() functions. These warnings are reported by gcc 15 which defaults to the C23 standard. The strchr() and strstr() functions return pointers into const strings, so the receiving variables must be declared as const char *. Signed-off-by: Karel Zak <kzak@redhat.com>
7 daysMerge branch 'PR/build-bsearch-const' of ↵Karel Zak2-2/+4
https://github.com/karelzak/util-linux-work * 'PR/build-bsearch-const' of https://github.com/karelzak/util-linux-work: lib, lscpu: fix const qualifier discarded warnings in bsearch
7 daysMerge branch 'lsfd--tun-netns' of https://github.com/masatake/util-linuxKarel Zak9-35/+196
* 'lsfd--tun-netns' of https://github.com/masatake/util-linux: lsfd: add TUN.DEVNETNS column tests: (lsfd::mkfds-cdev-tun,refactor) make the case extensible lsfd: (doc) fix English in SOCK.NETNS description lsfd: (cleanup) add missing "break" in a case statement lsfd: (cleanup) return 0 instead of false lsfd: (refactor) introduce tundata struct
7 daysMerge branch 'drop-const' of https://github.com/DaanDeMeyer/util-linuxKarel Zak2-2/+2
* 'drop-const' of https://github.com/DaanDeMeyer/util-linux: blkid: Drop const from blkid_partitions_get_name()
7 dayslib, lscpu: fix const qualifier discarded warnings in bsearchKarel Zak2-2/+4
Fix compilation warnings from newer compilers with stricter const-correctness checks. When bsearch() searches in const arrays, the result pointer must also be const to avoid discarding the const qualifier. Fixed in: - lib/color-names.c: searching in static const basic_schemes[] - sys-utils/lscpu-cputype.c: searching in const pattern arrays The warnings were: lib/color-names.c:62:13: error: assignment discards 'const' qualifier from pointer target type [-Werror=discarded-qualifiers] Signed-off-by: Karel Zak <kzak@redhat.com>
7 daysMerge branch 'docs--how-contribute' of https://github.com/masatake/util-linuxKarel Zak1-0/+3
* 'docs--how-contribute' of https://github.com/masatake/util-linux: docs: write about EditorConfig
8 daysblkid: Drop const from blkid_partitions_get_name()Daan De Meyer2-2/+2
const for idx is useless as the value is copied anyway, so drop the const. AFAIK this doesn't change ABI.
8 daysMerge branch 'fix/inconsistent_bash_completions' of ↵Karel Zak15-11/+20
https://github.com/cgoesche/util-linux-fork * 'fix/inconsistent_bash_completions' of https://github.com/cgoesche/util-linux-fork: bash-completion: (unshare) add missing --map-subids option tunelp: remove extraneous -T option partx: mark the --list option as deprecated namei: reestablish --nosymlinks option's functionality bash-completion: (mountpoint) add missing --show option bash-completion: (mount) add missing --ro option mount: document --ro option on the man page mount: add missing --ro option info in usage message bash-completion: (lslogins) add missing long options lslogins: fix incomplete option info in usage message lsclocks: add missing --no-discover-rtc option info in usage message bash-completion: (lsclocks) add missing --no-discover-rtc option bash-completion: (hwclock) add missing --ul-debug option bash-completion: (flock) add missing long options flock: fix incomplete -n option info in usage message
8 daysMerge branch 'array_size_countof' of https://github.com/crrodriguez/util-linuxKarel Zak1-0/+13
* 'array_size_countof' of https://github.com/crrodriguez/util-linux: include: implement ARRAY_SIZE with compiler _Countof if supported
8 daysdocs: write about EditorConfigMasatake YAMATO1-0/+3
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
9 daysinclude: implement ARRAY_SIZE with compiler _Countof if supportedCristian Rodríguez1-0/+13
C2Y has _Countof operator for this. GCC has an stdcountof.h hedaer and a countof definition Clang implements _Countof and needs __has_extension check
10 daysbash-completion: (unshare) add missing --map-subids optionChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daystunelp: remove extraneous -T optionChristian Goeschel Ndjomouo1-1/+0
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 dayspartx: mark the --list option as deprecatedChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysnamei: reestablish --nosymlinks option's functionalityChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysbash-completion: (mountpoint) add missing --show optionChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysbash-completion: (mount) add missing --ro optionChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysmount: document --ro option on the man pageChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysmount: add missing --ro option info in usage messageChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysbash-completion: (lslogins) add missing long optionsChristian Goeschel Ndjomouo1-1/+2
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 dayslslogins: fix incomplete option info in usage messageChristian Goeschel Ndjomouo1-2/+4
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 dayslsclocks: add missing --no-discover-rtc option info in usage messageChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysbash-completion: (lsclocks) add missing --no-discover-rtc optionChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysbash-completion: (hwclock) add missing --ul-debug optionChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysbash-completion: (flock) add missing long optionsChristian Goeschel Ndjomouo1-1/+3
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 daysflock: fix incomplete -n option info in usage messageChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
10 dayslsfd: add TUN.DEVNETNS columnMasatake YAMATO9-6/+138
lsfd can show the name of the network device behind a file descriptor pointing to a tun/tap device. # lsfd -Q 'SOURCE == "misc:tun"' COMMAND PID USER ASSOC XMODE TYPE SOURCE MNTID INODE NAME qemu-system-x86 846384 qemu 35 rw---- CHR misc:tun 36 1145 iface=vnet21 pasta.avx2 1837933 yamato 8 rw---m CHR misc:tun 2143 1145 iface=ens8191 ... This feature helps users inspect target processes, containers, and/or VMs with tools such as tcpdump, wireshark, or ip-link. However, I found a case where the device name was not sufficient. pasta (https://passt.top/) provides networking for rootless containers. It creates a tap device whose name matches the name of a network device on the host: $ ip link show ens8191 5: ens8191: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 ... $ ethtool -i ens8191 | head -1 driver: atlantic $ podman exec 9fbbed215871 ip link show ens8191 2: ens8191: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 65520 ... $ podman exec 9fbbed215871 ethtool -i ens8191 | head -1 driver: tun A name alone is not enough to identify a network device on the system. With this change, lsfd reports the network namespace to which the tun/tap device belongs: # lsfd -Q 'SOURCE == "misc:tun"' -oCOMMAND,PID,SOURCE,TUN.DEVNETNS,NAME COMMAND PID SOURCE TUN.DEVNETNS NAME qemu-system-x86 846384 misc:tun 4026531840 iface=vnet21 devnetns=4026531840 pasta.avx2 1837933 misc:tun 4026536354 iface=ens8191 devnetns=4026536354 ... This change relies on the TUNGETDEVNETNS ioctl added in: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=0c3e0e3bb623c3735b8c9ab8aa8332f944f83a9f Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 dayslsfd: fix bsearch macro usage with glibc C23Cristian Rodríguez1-1/+1
C23 requires bsearch to be a const preserving macro, build now fails with ../lsfd-cmd/lsfd.c:1879:75: error: macro ‘bsearch’ passed 6 arguments, but takes just 5 1879 | nfds, sizeof(struct pollfd), pollfdcmp)) | ^ In file included from ../include/c.h:17, from ../lsfd-cmd/lsfd.c:48: /usr/include/stdlib.h:987:10: note: macro ‘bsearch’ defined here 987 | # define bsearch(KEY, BASE, NMEMB, SIZE, COMPAR) \ add parenthesis around expression to fix it.
11 daystests: (lsfd::mkfds-cdev-tun,refactor) make the case extensibleMasatake YAMATO1-21/+34
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 dayslsfd: (doc) fix English in SOCK.NETNS descriptionMasatake YAMATO2-2/+2
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 dayslsfd: (cleanup) add missing "break" in a case statementMasatake YAMATO1-0/+1
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 dayslsfd: (cleanup) return 0 instead of falseMasatake YAMATO1-1/+1
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
11 dayslsfd: (refactor) introduce tundata structMasatake YAMATO1-9/+24
Signed-off-by: Masatake YAMATO <yamato@redhat.com>
14 daysMerge branch 'PR/mountpoint-statmount' of ↵Karel Zak2-23/+141
https://github.com/karelzak/util-linux-work * 'PR/mountpoint-statmount' of https://github.com/karelzak/util-linux-work: mountpoint: use single libmount cache for all path resolutions mountpoint: add --show option to print mountpoint path mountpoint: use statmount() syscall on modern kernels
14 daysMerge branch 'master-branch-4' of https://github.com/Leefancy/util-linuxKarel Zak1-0/+3
* 'master-branch-4' of https://github.com/Leefancy/util-linux: kill: the situation where fd is opened but not closed
14 daysmountpoint: use single libmount cache for all path resolutionsKarel Zak1-14/+22
Move libmount cache initialization to main() and pass it through the control structure. This allows the cache to be reused across all mnt_resolve_path() calls, reducing allocations. Also add cleanup section in main() with goto labels for proper resource deallocation in a single location. Signed-off-by: Karel Zak <kzak@redhat.com>
14 daysmountpoint: add --show option to print mountpoint pathKarel Zak2-3/+27
Add a new --show option that prints the actual mountpoint path for a given directory or file. This is useful for: - Resolving any path to its containing mountpoint - Finding the canonical mountpoint path when symlinks are involved - Determining the mountpoint from paths within filesystems The option requires kernel support for statmount(2) (Linux 6.8+). On older kernels without statmount support, the option fails with an error message, as the /proc/self/mountinfo fallback cannot resolve arbitrary paths to their containing mountpoint. Example usage: $ mountpoint --show / / $ mountpoint --show /home/user/file.txt /home The --show option always returns EXIT_SUCCESS (0) when it successfully finds the mountpoint, regardless of whether the given path itself is a mountpoint or not. Addresses: https://github.com/util-linux/util-linux/issues/3806 Signed-off-by: Karel Zak <kzak@redhat.com>
14 daysmountpoint: use statmount() syscall on modern kernelsKarel Zak2-12/+98
Improve mountpoint(1) to use the modern statmount() system call (available since Linux 6.8) instead of parsing /proc/self/mountinfo. - Works without /proc mounted on modern kernels - More efficient than parsing /proc/self/mountinfo - Better detection of bind mounts via statmount() - Graceful fallback maintains compatibility Addresses: https://github.com/util-linux/util-linux/issues/3806 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-19kill: the situation where fd is opened but not closedfortunate-lee1-0/+3
Signed-off-by: fortunate-lee <lijian01@kylinos.cn>
2025-11-18Merge branch 'set_up' of https://github.com/sbraz/util-linuxKarel Zak7-8/+8
* 'set_up' of https://github.com/sbraz/util-linux: Fix typos when "set up" is used as a verb
2025-11-18fincore: The previous exit did not call munmap, resulting in a memory ↵fortunate-lee1-1/+1
mapping leak. Signed-off-by: fortunate-lee <lijian01@kylinos.cn>
2025-11-17Fix typos when "set up" is used as a verbLouis Sautier7-8/+8
The noun is "setup" while the verb is "set up".
2025-11-14Merge branch 'fix/su_lsb5_compliance' of ↵Karel Zak9-2/+121
https://github.com/cgoesche/util-linux-fork * 'fix/su_lsb5_compliance' of https://github.com/cgoesche/util-linux-fork: tests: (su) add more options tests su: pass arguments after <user> to shell
2025-11-14Merge branch 'close-fts-handle' of https://github.com/syokensyo/util-linuxKarel Zak1-0/+1
* 'close-fts-handle' of https://github.com/syokensyo/util-linux: fincore: close the ftsp to prevent fd leak
2025-11-12chmem: improve messagesKarel Zak1-4/+4
Suggested-by: Sumanth Korikkar <sumanthk@linux.ibm.com> Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-12Merge branch 'fincore/eperm' of https://github.com/t-8ch/util-linuxKarel Zak1-1/+1
* 'fincore/eperm' of https://github.com/t-8ch/util-linux: fincore: do not fall back to mincore if cachestat fails with EPERM
2025-11-12Merge branch 'PR/cal-header-colors' of ↵Karel Zak15-29/+44
https://github.com/karelzak/util-linux-work * 'PR/cal-header-colors' of https://github.com/karelzak/util-linux-work: tests: update cal color outputs cal: improve header color printing
2025-11-12Merge branch 'PR/chmem-dynamic-configuration' of ↵Karel Zak8-50/+567
https://github.com/karelzak/util-linux-work * 'PR/chmem-dynamic-configuration' of https://github.com/karelzak/util-linux-work: tests: update lsmem outputs lsmem: use xstrncpy() lsmem,chmem: add configure/deconfigure bash completion options lsmem: add doc for dynamic (de)configuration and memmap-on-memory support chmem: add chmem documentation for dynamic (de)configuration of memory chmem: add support for dynamic (de)configuration of hotplug memory lsmem: add support to display dynamic (de)configuration of memory lsmem: display global memmap on memory parameter
2025-11-12fincore: close the ftsp to prevent fd leaksyokensyo1-0/+1
2025-11-10Merge branch 'lsfd--netlink-lport-data-size' of ↵Karel Zak1-2/+2
https://github.com/masatake/util-linux * 'lsfd--netlink-lport-data-size' of https://github.com/masatake/util-linux: lsfd: (bugfix) use PRIu32 for prining lport of netlink socket
2025-11-10Merge branch 'hwclock-rtc-fix-typo' of https://github.com/jgilles/util-linuxKarel Zak1-1/+1
* 'hwclock-rtc-fix-typo' of https://github.com/jgilles/util-linux: hwclock-rtc: fix verbose output when --param-set value is unchanged
2025-11-10Merge branch 'fallocate' of https://github.com/t-8ch/util-linuxKarel Zak4-125/+15
* 'fallocate' of https://github.com/t-8ch/util-linux: tests: (swaplabel) don't create test image with truncate(1) fallocate: require posix_fallocate() from libc fallocate: drop syscall() fallback for fallocate() build: simplify checks for fallocate() and posix_fallocate()
2025-11-10Fix the issue of fd resource leakageLeefancy1-0/+2
Signed-off-by: Leefancy <lijian01@kylinos.cn>
2025-11-08tests: (swaplabel) don't create test image with truncate(1)Thomas Weißschuh1-10/+3
truncate(1) can create holes in the file. These will trigger a warning in mkswap(1), failing the testsuite. Given that fallocate(1) now alway supports posix_fallocate() which works on all filesystems, truncate(1) is unnecessary anyways. Reported-by: Christian Hesse <mail@eworm.de> Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2025-11-08fallocate: require posix_fallocate() from libcThomas Weißschuh3-13/+3
Recent libcs implement posix_fallocate() properly. The fallback logic should never be used. Furthermore unconditional support for posix_fallocate() will enable some further cleanup and fixes. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2025-11-08fallocate: drop syscall() fallback for fallocate()Thomas Weißschuh3-11/+7
The ABI of the fallocate() syscall is complicated and not properly handled by the open-coded fallback logic. As all recent libcs implement fallocate() properly, drop the open-coded systemcall fallback and depend on the libc implementation. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2025-11-08build: simplify checks for fallocate() and posix_fallocate()Thomas Weißschuh2-93/+4
The bespoke test logic for those two functions was only necessary for old glibc versions which have long gone out of support. Align the checks with all other ones. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2025-11-08lsfd: (bugfix) use PRIu32 for prining lport of netlink socketMasatake YAMATO1-2/+2
Fixes #3849 Signed-off-by: Masatake YAMATO <yamato@redhat.com>
2025-11-07hwclock-rtc: fix verbose output when --param-set value is unchangedJesse Gilles1-1/+1
RTC_PARAM_SET operation is skipped rather than GET
2025-11-07Merge branch 'fix/missing_long_opts_completions' of ↵Karel Zak41-15/+135
https://github.com/cgoesche/util-linux-fork * 'fix/missing_long_opts_completions' of https://github.com/cgoesche/util-linux-fork: (41 commits) bash-completion: (nsenter) add missing --follow-context bash-completion: (namei) add missing --context bash-completion: (setpriv) add missing long options bash-completion: (pg) add missing long options bash-completion: (lastlog2) add missing --active bash-completion: (whereis) add missing long options bash-completion: (wdctl) add missing long options bash-completion: (uuidd) add missing --cont-clock bash-completion: (unshare) add missing long options bash-completion: (swapon) add missing --options bash-completion: (sfdisk) add missing long options bash-completion: (setsid) add missing --fork bash-completion: (scriptlive) add missing --echo bash-completion: (renice) add missing --relative bash-completion: (more) add missing --exit-on-eof bash-completion: (mkswap) add missing long options bash-completion: (mkfs.minix) add missing --lock bash-completion: (mkfs.cramfs) add missing long options bash-completion: (mkfs.bfs) add missing --lock bash-completion: (lsmem) add missing --split ...
2025-11-07Merge branch 'PR/benno-losetup' of https://github.com/karelzak/util-linux-workKarel Zak2-23/+12
* 'PR/benno-losetup' of https://github.com/karelzak/util-linux-work: losetup: (man) put the synopses in a better order, the name-giver first losetup: remove the --verbose flag, as it doesn't actually do anything losetup: sort 'O' correctly for the mutual-exclusive check to work
2025-11-07Merge branch 'PR/include-optutils-err' of ↵Karel Zak1-18/+27
https://github.com/karelzak/util-linux-work * 'PR/include-optutils-err' of https://github.com/karelzak/util-linux-work: include/optutils: improve err_exclusive_options() output
2025-11-07tests: update cal color outputsKarel Zak14-26/+26
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-07login: add line break after timeout messageKarel Zak1-1/+1
Just to make login(1) more user-friendly for those who do crazy things. Based on https://github.com/util-linux/util-linux/pull/3842 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-07tests: update lsmem outputsKarel Zak2-0/+12
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-07cal: improve header color printingKarel Zak1-3/+18
It's more robust to avoid using line breaks within the colored area. Fixes: https://github.com/util-linux/util-linux/issues/3844 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-07include/optutils: improve err_exclusive_options() outputKarel Zak1-18/+27
OLD: $ losetup --remove --detach loop0 losetup: mutually exclusive arguments: --detach-all --all --set-capacity --detach --find --associated --remove NEW: $ losetup --remove --detach loop0 losetup: options --detach and --remove cannot be combined. Suggested-by: Benno Schulenberg <bensberg@telfort.nl> Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-07lsmem: use xstrncpy()Karel Zak1-3/+3
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-11-07lsmem,chmem: add configure/deconfigure bash completion optionsSumanth Korikkar2-1/+4
Add bash completion for configure/deconfigure options in chmem and lsmem. Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-07lsmem: add doc for dynamic (de)configuration and memmap-on-memory supportSumanth Korikkar1-3/+41
lsmem --output-all now displays two new columns: CONFIGURED : yes/no indicating if a memory block has been explicitly configured. MEMMAP-ON-MEMORY : yes/no indicating whether the block uses memmap-on-memory. lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0xffffffff 2G offline 16-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes Add documentation for new fields. Reviewed-by: Maria Eisenhaendler <maria1@de.ibm.com> Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-07chmem: add chmem documentation for dynamic (de)configuration of memorySumanth Korikkar1-5/+42
Describe chmem configure, deconfigure and memmap-on-memory options: ff18dcb19aab ("s390/sclp: Add support for dynamic (de)configuration of memory") s390 kernel no longer pre-adds all standby memory at boot. Instead, users must explicitly configure a block before it can be used for online/offline actions. At configuration time, users can dynamically decide whether to use optional memmap-on-memory for each memory block, where value of 1 allocates metadata (such as struct pages array) from the hotplug memory itself, enabling hot-add operations even under memory pressure. A value of 0 stores metadata in regular system memory, which may require additional free memory, but enables continuous physical memory across memory blocks. Add documentation to reflect the following options: * chmem --configure 128M --memmap-on-memory 1 * chmem --deconfigure 128M * chmem --enable 128M # implicitly configure memory if supported by architecture and online it * chmem --disable 128M # offline memory and implicitly deconfigure if supported by the architecture. Just like online and offline actions, memory configuration and deconfiguration can be controlled through similar options. Also, memmap-on-memory setting can be changed, only when the memory block is in deconfigured state. This means, it is usable only via --configure option. Reviewed-by: Maria Eisenhaendler <maria1@de.ibm.com> Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-07chmem: add support for dynamic (de)configuration of hotplug memorySumanth Korikkar1-29/+342
Extend chmem to use the new s390 kernel interface for configuring and deconfiguring hotpluggable memory blocks, with memmap-on-memory support. Background: On s390, memmap-on-memory was introduced to ensure that the struct page array (metadata) for hotpluggable standby memory is allocated from the memory block itself. This allowed hot-add operations even under memory pressure, particularly in cases with a strong imbalance between boot-time online memory and standby memory. The original design, however, had few limitations: * All hotpluggable standby memory was added at boot. * The use of memmap-on-memory was global and static, decided at boot time. Either all standby blocks used it, or none of them did. * memmap-on-memory choice could not be changed at runtime, limiting flexibility. For example, when continuous physical memory was required later across memory blocks. The s390 kernel ff18dcb19aab ("s390/sclp: Add support for dynamic (de)configuration of memory") no longer pre-adds all standby memory at boot. Instead, users must explicitly configure a block before it can be used for online/offline actions. At configuration time, users can dynamically decide whether to use optional memmap-on-memory for each memory block, where value of 1 allocates metadata (such as struct pages array) from the hotplug memory itself, enabling hot-add operations even under memory pressure. A value of 0 stores metadata in regular system memory and enables continuous physical memory across memory blocks. s390 kernel sysfs interface to configure/deconfigure memory with memmap-on-memory support looks as shown below: 1. Configure memory echo 1 > /sys/firmware/memory/memoryX/config   2. Deconfigure memory echo 0 > /sys/firmware/memory/memoryX/config 3. Enable memmap-on-memory echo 1 > /sys/firmware/memory/memoryX/memmap_on_memory 4. Disable memmap-on-memory echo 0 > /sys/firmware/memory/memoryX/memmap_on_memory * Initial memory layout: lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0xffffffff 2G offline 16-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes * Configure memory with memmap-on-memory. chmem -c 128M -m 1 lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0x87ffffff 128M offline 16 yes yes 0x88000000-0xffffffff 1.9G offline 17-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes * Deconfigure memory chmem -g 128M lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0xffffffff 2G offline 16-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes * Online memory. If the memory is in deconfigured state, configure and online it. chmem -e 128M -v Memory Block 16 (0x0000000080000000-0x0000000087ffffff) configured Memory Block 16 (0x0000000080000000-0x0000000087ffffff) enabled lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0x87ffffff 128M online 16 yes yes 0x88000000-0xffffffff 1.9G offline 17-31 no yes Memory block size: 128M Total online memory: 2.1G Total offline memory: 1.9G Memmap on memory parameter: yes * Offline memory If the memory is in online state, then offline it and deconfigure it. chmem -d 128M -v Memory Block 16 (0x0000000080000000-0x0000000087ffffff) disabled Memory Block 16 (0x0000000080000000-0x0000000087ffffff) deconfigured lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0xffffffff 2G offline 16-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes Just like online and offline actions, memory configuration and deconfiguration can be controlled through similar options. Also, memmap-on-memory setting can be changed, only when the memory block is in deconfigured state. This means, it is usable only via --configure option. Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-07lsmem: add support to display dynamic (de)configuration of memorySumanth Korikkar1-12/+95
Extend lsmem to display (de)configured blocks and memmap_on_memory state. With the new s390 kernel interface (linux-next) ff18dcb19aab ("s390/sclp: Add support for dynamic (de)configuration of memory"), standby memory blocks are no longer pre-added at boot, but must be explicitly configured before being eligible for online/offline operations. At configuration time, users can also decide whether to use memmap-on-memory per block. Add CONFIGURED column : indicate if a memory block has been explicitly configured. Add MEMMAP-ON-MEMORY column : indicate if a memory block uses memmap-on-memory. memmap-on-memory reference: https://docs.kernel.org/admin-guide/mm/memory-hotplug.html Users can now inspect memory configuration state and retrieve memmap-on-memory state per block. lsmem -o RANGE,SIZE,STATE,BLOCK,CONFIGURED,MEMMAP-ON-MEMORY RANGE SIZE STATE BLOCK CONFIGURED MEMMAP-ON-MEMORY 0x00000000-0x7fffffff 2G online 0-15 yes no 0x80000000-0xffffffff 2G offline 16-31 no yes Memory block size: 128M Total online memory: 2G Total offline memory: 2G Memmap on memory parameter: yes Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-07lsmem: display global memmap on memory parameterSumanth Korikkar2-0/+31
Display the output of global memmap-on-memory parameter for memory hotplug. Retrieve the details via /sys/module/memory_hotplug/parameters/memmap_on_memory. lsmem RANGE SIZE STATE REMOVABLE BLOCK 0x0000000000000000-0x00000001ffffffff 8G online yes 0-63 Memory block size: 128M Total online memory: 8G Total offline memory: 0B Memmap on memory parameter: yes Signed-off-by: Sumanth Korikkar <sumanthk@linux.ibm.com>
2025-11-03tests: (su) add more options testscgoesche8-0/+119
Signed-off-by: cgoesche <cgoesc2@wgu.edu>
2025-11-03su: pass arguments after <user> to shellcgoesche1-2/+2
The su(1) manpage describes how the arguments after <user> are passed to the invoked shell. However this is empirically wrong, as option flags after <user> are interpreted by su(1) and will eventually never be passed or yield an error that terminates the program due to an unrecognized option flag. To fix this we can change getopt(3)'s scanning mode with a '+' prefixed to 'optstring', this will make it so that getopt(3) stops processing argv elements on the first occurrence of a non-option argument, e.g. '-' or '<user>'. Additionally, if the argument that directly follows '-' is an option flag, su(1) will assume that this argument and the ones that follow, are to be passed to a shell invoked by the root user. Addresses: https://github.com/util-linux/util-linux/pull/1809 Signed-off-by: cgoesche <cgoesc2@wgu.edu>
2025-11-03losetup: (man) put the synopses in a better order, the name-giver firstBenno Schulenberg1-15/+11
Also, condense the synopsis for setting up a loop device to just the essentials -- it had become so long that it was incomprehensible. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-11-03losetup: remove the --verbose flag, as it doesn't actually do anythingBenno Schulenberg2-7/+0
Fourteen years ago, commit c7e0925def rewrote the `losetup` tool, removing all references to the 'verbose' variable. Three years later, commit 60cb2c3720 removed the line 'verbose = 1' because the compiler complained that the variable was set but never used. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-11-03losetup: sort 'O' correctly for the mutual-exclusive check to workBenno Schulenberg1-1/+1
The options need to be in strict ascending order. Signed-off-by: Benno Schulenberg <bensberg@telfort.nl>
2025-11-03wdctl: remove -d option leftoverMunehisa Kamata1-1/+1
-d option was removed in commit f56338b43973 ("wdctl: allow to specify more than one device"), but the optstring wasn't updated at that time and wdctl can still accept the option halfway as below: $ wdctl -d wdctl: option requires an argument -- 'd' whereas it should say: wdctl: invalid option -- 'd' So update the optstring. Fixes: f56338b43973 ("wdctl: allow to specify more than one device") Signed-off-by: Munehisa Kamata <kamatam@amazon.com>
2025-11-03Merge branch 'fix/login_manpage_grammar' of ↵Karel Zak1-1/+1
https://github.com/cgoesche/util-linux-fork * 'fix/login_manpage_grammar' of https://github.com/cgoesche/util-linux-fork: login: fix minor grammar mistake in the manpage
2025-11-03Merge branch 'meson' of https://github.com/neheb/util-linuxKarel Zak2-5/+3
* 'meson' of https://github.com/neheb/util-linux: meson: fix non threaded toolchains
2025-11-03Merge branch 'bst/hwclock-cmp-set' of ↵Karel Zak1-1/+14
https://github.com/Bastian-Krause/util-linux * 'bst/hwclock-cmp-set' of https://github.com/Bastian-Krause/util-linux: hwclock: skip RTC_PARAM_SET for --param-set with unchanged value
2025-11-02login: fix minor grammar mistake in the manpagecgoesche1-1/+1
Signed-off-by: cgoesche <cgoesc2@wgu.edu>
2025-11-02meson: fix non threaded toolchainsRosen Penev2-5/+3
threads needs to be set as not required. Cleaned up meson build slightly to use one dependency call. Signed-off-by: Rosen Penev <rosenp@gmail.com>
2025-11-02bash-completion: (nsenter) add missing --follow-contextcgoesche1-0/+1
Signed-off-by: cgoesche <cgoesc2@wgu.edu>
2025-11-02bash-completion: (namei) add missing --contextcgoesche1-1/+9
Signed-off-by: cgoesche <cgoesc2@wgu.edu>
2025-11-02bash-completion: (setpriv) add missing long optionscgoesche1-0/+3
Signed-off-by: cgoesche <cgoesc2@wgu.edu>
2025-11-02bash-completion: (pg) add missing long optionscgoesche1-1/+1
Signed-off-by: cgoesche <cgoesc2@wgu.edu>
2025-11-02bash-completion: (lastlog2) add missing --activecgoesche1-1/+1
Signed-off-by: cgoesche <cgoesc2@wgu.edu>
2025-11-01fincore: do not fall back to mincore if cachestat fails with EPERMThomas Weißschuh1-1/+1
cachestat() and mincore() both require that the tested file is (potentially) writable by the current user. If this permission check fails, cachestat() will return EPERM while mincore() will simply mark all pages as resident in core, as a proper EPERM would violate its API contract. But when cachestat() fails with EPERM we know that mincore() will not return real data, so instead show an error message. Reported-by: Christian Hesse <mail@eworm.de> Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
2025-11-01build(deps): bump actions/upload-artifact from 4 to 5dependabot[bot]1-1/+1
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4 to 5. - [Release notes](https://github.com/actions/upload-artifact/releases) - [Commits](https://github.com/actions/upload-artifact/compare/v4...v5) --- updated-dependencies: - dependency-name: actions/upload-artifact dependency-version: '5' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
2025-11-01build(deps): bump github/codeql-action from 3 to 4dependabot[bot]1-3/+3
Bumps [github/codeql-action](https://github.com/github/codeql-action) from 3 to 4. - [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/v3...v4) --- updated-dependencies: - dependency-name: github/codeql-action dependency-version: '4' dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] <support@github.com>
2025-10-31bash-completion: (whereis) add missing long optionsChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (wdctl) add missing long optionsChristian Goeschel Ndjomouo1-0/+2
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (uuidd) add missing --cont-clockChristian Goeschel Ndjomouo1-1/+15
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (unshare) add missing long optionsChristian Goeschel Ndjomouo1-0/+7
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (swapon) add missing --optionsChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (sfdisk) add missing long optionsChristian Goeschel Ndjomouo1-0/+5
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (setsid) add missing --forkChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (scriptlive) add missing --echoChristian Goeschel Ndjomouo1-1/+7
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (renice) add missing --relativeChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (more) add missing --exit-on-eofChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (mkswap) add missing long optionsChristian Goeschel Ndjomouo1-1/+15
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (mkfs.minix) add missing --lockChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (mkfs.cramfs) add missing long optionsChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (mkfs.bfs) add missing --lockChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (lsmem) add missing --splitChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (lslogins) add missing --shellChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (lscpu) add missing --hierarchicChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (lsclocks) add missing --no-discover-dynamicChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (lsblk) add missing long optionsChristian Goeschel Ndjomouo1-0/+5
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (losetup) add missing long optionsChristian Goeschel Ndjomouo1-0/+3
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (hwclock) add missing long optionsChristian Goeschel Ndjomouo1-0/+2
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (hardlink) add missing long optionsChristian Goeschel Ndjomouo1-0/+9
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (getopt) add missing --unknownChristian Goeschel Ndjomouo1-1/+12
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (fsck) add missing long optionsChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (flock) add missing --verboseChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (findmnt) add missing long optionsChristian Goeschel Ndjomouo1-0/+9
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (fincore) add missing --totalChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (fallocate) add missing --write-zeroesChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (fadvise) add missing --fdChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31fadvise: add --fd to the help outputChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (column) add missing long optionsChristian Goeschel Ndjomouo1-0/+2
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (cfdisk) add missing --sector-sizeChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (cal) add missing long optionsChristian Goeschel Ndjomouo1-0/+3
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (blockdev) add missing long optionsChristian Goeschel Ndjomouo1-1/+3
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (blkid) add missing --hintChristian Goeschel Ndjomouo1-0/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-31bash-completion: (bits) add missing --binaryChristian Goeschel Ndjomouo1-1/+1
Signed-off-by: Christian Goeschel Ndjomouo <cgoesc2@wgu.edu>
2025-10-30libfdisk: (dos) fix off-by-one in maximum last sector calculationKarel Zak1-2/+2
The get_disk_ranges() function incorrectly capped the last usable sector at UINT_MAX, which could cause an overflow when calculating partition size for MBR partition tables. MBR stores partition size as a 32-bit value with maximum UINT_MAX. The partition size is calculated as: size = stop - start + 1 For a partition starting at sector 0: - If stop = UINT_MAX: size = UINT_MAX + 1 (overflow!) - If stop = UINT_MAX - 1: size = UINT_MAX (correct maximum) This fixes the inconsistency where dos_init() correctly warns about disks larger than UINT_MAX sectors (2TiB - 512 bytes for 512-byte sectors), but get_disk_ranges() allowed creating partitions that would overflow the 32-bit size field. Addresses: https://issues.redhat.com/browse/RHEL-122367 Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-30hwclock: skip RTC_PARAM_SET for --param-set with unchanged valueBastian Krause1-1/+14
Parameters set with `hwclock --param-set` tend to be persisted in the RTC's EEPROM. Writing the same value over and over again can wear out the EEPROM (e.g. on each boot). So read the current value first. Only if the parameter is changed, actually write the new value. This allows for easier integrations, especially since there is no machine-readable way of retrieving the current value via hwclock. Signed-off-by: Bastian Krause <bst@pengutronix.de>
2025-10-29Merge branch 'issuerunfix' of https://github.com/Vogtinator/util-linuxKarel Zak1-1/+1
* 'issuerunfix' of https://github.com/Vogtinator/util-linux: agetty: Fix reading /run/issue.d/ again
2025-10-29Merge branch 'my-master-2' of https://github.com/Leefancy/util-linuxKarel Zak1-0/+1
* 'my-master-2' of https://github.com/Leefancy/util-linux: Fix memory leak issue in read_Subid_range()
2025-10-29Merge branch 'swapon-fstab-defaults' of https://github.com/zeha/util-linuxKarel Zak1-1/+1
* 'swapon-fstab-defaults' of https://github.com/zeha/util-linux: swapon: (man page) use "defaults" (plural)
2025-10-28agetty: Fix reading /run/issue.d/ againFabian Vogt1-1/+1
Commit 63f7dcb5b072 ("lib/config: Make /run path configurable") added a second _PATH_SYSCONFDIR instead of _PATH_RUNSTATEDIR. Fix that.
2025-10-23lib/loopdev: avoid null pointer dereferences [coverity]Karel Zak1-1/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-23Fix memory leak issue in read_Subid_range()fortunate-lee1-0/+1
2025-10-22swapon: (man page) use "defaults" (plural)Chris Hofstaedtler1-1/+1
A lot of documentation on the Internet seems to assume "defaults" is the /correct/ default value when no other options are intended. Documentation/example.files/fstab does not have an entry for swap, but it shows "defaults" for other file systems. It seems prudent to align on a single variant, at least in the documentation, even if both are accepted by swapon. Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
2025-10-22Merge branch 'optstr-test' of https://github.com/crobinso/util-linuxKarel Zak1-1/+1
* 'optstr-test' of https://github.com/crobinso/util-linux: tests: optstr: test redundant commas
2025-10-22Merge branch 'PR/losetup-remove' of https://github.com/karelzak/util-linux-workKarel Zak4-54/+96
* 'PR/losetup-remove' of https://github.com/karelzak/util-linux-work: losetup: improve command line option processing lostup: report EACCES on loop-control losetup: improve --remove documentation losetup: make --remove a long-only option with mutual exclusivity lib/loopdev: introduce loopcxt_get_device_nr() helper losetup: add error feedback for --remove command
2025-10-22mount: add note about systemd and --all historical contextKarel Zak1-1/+3
Add information that mount -a was originally designed for init scripts but many modern systemd-based distributions use systemd units instead for mounting filesystems on boot in a more sophisticated way. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-22mount: improve --all documentation regarding swap areasKarel Zak1-0/+2
The --all option description did not mention that swap entries in fstab are silently ignored. Add a note clarifying this behavior and pointing users to swapon --all for enabling swap devices and files. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-21losetup: improve command line option processingKarel Zak1-23/+22
The options --detach, --remove, and --set-capacity are mutually exclusive. We can assume the device name follows the options, which is better than assuming the device name is specified as an option's argument. This also allows the use of the existing mutually-exclusive check. # losetup --remove --detach loop0 losetup: /dev/--detach: remove failed: Success losetup: /dev/loop0: remove failed: Device or resource busy is ugly. Reported-by: Benno Schulenberg <bensberg@telfort.nl> Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-21lostup: report EACCES on loop-controlKarel Zak1-1/+1
Don't start scanning /dev/loop* after a failed access to /dev/loop-control. It's a waste of time, and the user does not receive a relevant error message. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-21losetup: improve --remove documentationKarel Zak1-4/+14
Rewrite the --remove option description to clearly explain the difference between --detach and --remove. Add a new LOOP DEVICE LIFECYCLE section that describes the three stages: creation, detachment, and removal, with corresponding ioctl names. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-21losetup: make --remove a long-only option with mutual exclusivityKarel Zak3-11/+13
Change --remove from '-R, --remove' to a long-only option '--remove'. This makes it consistent with other administrative options and adds mutual exclusivity with other major actions like -d, -D, -a, -c, -f, -j, -l, and -O. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-21lib/loopdev: introduce loopcxt_get_device_nr() helperKarel Zak1-14/+43
Add a new static helper function loopcxt_get_device_nr() to extract the loop device number from the device path. This eliminates code duplication in loopcxt_remove_device() and loopcxt_add_device(). The helper function supports both /dev/loop<N> and /dev/loop/<N> formats and provides consistent error handling with debug logging. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-21losetup: add error feedback for --remove commandKarel Zak1-3/+5
The remove_loop() function was silently failing without providing any feedback to the user. This also fixes incorrect indentation (spaces instead of tabs). Signed-off-by: Karel Zak <kzak@redhat.com> Reported-by: Benno Schulenberg <bensberg@telfort.nl>
2025-10-17tests: optstr: test redundant commasCole Robinson1-1/+1
optstr, used for parsing mount option lists, eats leading, trailing, and duplicated commas, but I can't find any test coverage for that behavior. Amend the existing optstr test to hit all the cases I can think of Signed-off-by: Cole Robinson <crobinso@redhat.com>
2025-10-15treewide: use is_dotdir_dirent() helperKarel Zak6-10/+12
This simplifies the code by using the is_dotdir_dirent() helper function instead of manual strcmp() checks for "." and ".." directory entries across multiple utilities. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15tests: (configs) add sorting and masking testKarel Zak2-0/+32
Add a new test that verifies: - Main config file appears first - Drop-in files are sorted alphabetically - Files from /etc mask same-named files from /usr - Priority ordering is correct (etc > usr) The test creates mmm.conf in both /etc and /usr to verify that the /etc version takes precedence and /usr version is masked (not included in output). Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15lib/configs: simplify merge error checkingKarel Zak1-10/+3
Combine the three config_merge_list() calls into a single conditional statement to reduce repetitive error checking. The calls are short-circuited on first failure. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15lib/configs: eliminate counter variableKarel Zak1-4/+1
Remove the counter variable and return list_count_entries() directly. This simplifies the code by calculating the count only when needed (on success path) rather than tracking it throughout the function. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15lib/configs: add head parameter to configs_refer_filename()Karel Zak1-11/+7
Allow configs_refer_filename() to add entries at either the head or tail of the list by adding a 'head' parameter. This simplifies the code for adding the main config file, eliminating the need to add to the tail and then move to the head. When head=1, use list_add() to prepend to the list. When head=0, use list_add_tail() to append to the list. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15lib/configs: simplify variable namesKarel Zak2-47/+47
Shorten variable and parameter names for better readability: Parameters: - etc_subdir -> etcdir - run_subdir -> rundir - usr_subdir -> usrdir - config_name -> confname - config_suffix -> suffix Local variables: - etc_file_list -> etc_list - run_file_list -> run_list - usr_file_list -> usr_list Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15lib/configs: merge new_list_entry() and configs_add_filename()Karel Zak1-30/+12
Introduce configs_refer_filename() which merges the functionality of new_list_entry() and configs_add_filename() while avoiding unnecessary string duplication. The new function takes ownership of the filename pointer directly instead of using strdup(), which eliminates one allocation per config file entry. Callers no longer need to free the filename after adding it to the list, as ownership is transferred to the list element. This improves both performance and code clarity by making the ownership semantics explicit. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15lib/configs: refactor directory list mergingKarel Zak1-138/+101
The original implementation used complex nested loops to merge configuration file lists from different directories. This commit simplifies the code by introducing a new config_merge_list() function that handles the merging logic. Changes: - Add config_merge_list() to merge lists with duplicate detection - Add config_cmp() comparison function using strcoll() (consistent with alphasort() behavior from scandirat()) - Add configs_add_filename() helper to reduce code duplication - Simplify ul_configs_file_list() by replacing ~120 lines of merging logic with 3 calls to config_merge_list() - Remove intermediate etc_run_file_list, merge directly to output - Update read_dir() to return 0/-ENOMEM instead of entry count - Use list_count_entries() to get final count The new config_merge_list() moves entries directly from source lists to the destination list without extra allocations, making it more efficient than the previous approach. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15update .gitignoreKarel Zak1-0/+1
Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15tests: (configs) check for scandirat()Karel Zak2-0/+15
The function may be unsupported on musl libc. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15lib/configs: simplify suffix verificationKarel Zak1-8/+8
Use ul_endswith() to simplify the code. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-15lib/fileutils: add is_dotdir_dirent()Karel Zak1-0/+8
This code pattern is repeated on many places, let's move it to simple inline function. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-14tests: (configs) add file listings to expected outputKarel Zak8-0/+20
Add sorted file listings to the configs test output to help debug platform-specific test failures. Each subtest now outputs the actual files created in the test directory before running the config helper, making it easier to identify issues with filesystem ordering or file creation problems. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-14lib/config: fix file counterKarel Zak4-6/+3
We need to count only files in the final list, not in the temporary lists. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-14lib/configs: introduce config_mk_path() helperKarel Zak1-50/+46
Refactor main_configs() and read_dir() to use a new helper function that combines path construction with existence and type checking. This reduces code duplication and simplifies the logic. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-14tests: add regression tests for ul_configs_file_list()Karel Zak9-0/+129
Add comprehensive test script for configuration file list functionality with the following test cases: - main-etc: Main config file in /etc - main-usr: Main config file fallback to /usr - dropin-etc: Drop-in files from /etc - dropin-usr: Drop-in files from /usr - combined: Main config + drop-ins from multiple directories - masking: Same basename in multiple directories (masking behavior) - no-project: Configuration without project subdirectory The tests verify proper file discovery, priority ordering across /etc, /run, and /usr directories, and file masking behavior according to the Configuration Files Specification. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-14lib/configs: add test program for ul_configs_file_list()Karel Zak3-0/+99
Add a test program with command line options to test the configuration file list functionality. The test program allows specifying custom paths for /etc, /run, and /usr directories, project name, config name, and suffix. This enables testing the priority ordering and file discovery logic of ul_configs_file_list() from the command line. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-14lib/config: Make /run path configurableKarel Zak3-3/+7
Avoid hardcoded paths when writing regression tests. Signed-off-by: Karel Zak <kzak@redhat.com>
2025-10-14Merge branch 'fix/umount_no_verbose_for_non_root' of ↵Karel Zak2-2/+3
https://github.com/cgoesche/util-linux-fork * 'fix/umount_no_verbose_for_non_root' of https://github.com/cgoesche/util-linux-fork: umount: consider helper return status for success message
2025-10-14Merge branch 'test--lsfd-revise-rpi5' of https://github.com/masatake/util-linuxKarel Zak3-9/+31
* 'test--lsfd-revise-rpi5' of https://github.com/masatake/util-linux: tests: (lsfd/mkfds-unix-dgram) skip if the unix diag netlink interface is not available tests: (lsfd-functions.sh) make lsfd_check_sockdiag usable in subtests tests: (lsfd/mkfds-unix-stream-requiring-sockdiag) revise the test description
2025-10-14Merge branch 'fix/test_libmount_explicit_rw' of ↵Karel Zak2-2/+2
https://github.com/cgoesche/util-linux-fork * 'fix/test_libmount_explicit_rw' of https://github.com/cgoesche/util-linux-fork: tests: (libmount) improve explicit loop read-write mount check
2025-10-14Merge branch 'fix/mount_bash_comp' of ↵Karel Zak1-0/+5
https://github.com/cgoesche/util-linux-fork * 'fix/mount_bash_comp' of https://github.com/cgoesche/util-linux-fork: bash-completion: (mount) add missing options
2025-10-14Merge branch 'feat/add_json_opt_lslogins' of ↵Karel Zak5-42/+152
https://github.com/cgoesche/util-linux-fork * 'feat/add_json_opt_lslogins' of https://github.com/cgoesche/util-linux-fork: bash-completion: (lslogins) add --list-columns option lslogins: (man) add --list-columns description lslogins: add -H and --list-columns option; declutter --help output lslogins: (man) add --json information bash-completion: (lslogins) add --json completion tests: (lslogins) test --json output mode lslogins: add JSON output format mode
2025-10-14Merge branch 'feat/add_usage_list_cols_option_macro' of ↵Karel Zak7-8/+13
https://github.com/cgoesche/util-linux-fork * 'feat/add_usage_list_cols_option_macro' of https://github.com/cgoesche/util-linux-fork: treewide: consolidate --list-columns option in usage() to USAGE_LIST_COLUMNS_OPTION() include/c.h: add USAGE_LIST_COLUMNS_OPTION() macro
2025-10-14Merge branch 'tests--kill-make-test-bits' of ↵Karel Zak2-13/+81
https://github.com/masatake/util-linux * 'tests--kill-make-test-bits' of https://github.com/masatake/util-linux: ts/kill/decode: compare decoded output in an architecture-independent way ts/kill/decode: check the availability of "sed" ts/kill/decode: consider arch dependent signum/name association