Unfortunately, the behavior is different between DOS (original docs)
and GPT. Due to the need for backward compatibility, it is likely
impossible to change the default setting ...
Addresses: https://github.com/util-linux/util-linux/issues/3097 Signed-off-by: Karel Zak <kzak@redhat.com>
Stanislav Brabec [Wed, 19 Jun 2024 15:31:34 +0000 (17:31 +0200)]
umount, losetup: Document loop destroy behavior
The loop device detach runs asynchronously in the background. It can cause
unexpected errors. Document the possible existence of the loop device after
exit of losetup -d or umount and need of "udevadm settle".
Laurent Vivier [Wed, 19 Jun 2024 08:19:51 +0000 (10:19 +0200)]
unshare: load binfmt_misc interpreter
add -l, --load-interp <file> to load a binfmt_misc interpreter at startup.
The interpreter is loaded from the initial fileystem if the 'F' flags is
provided, otherwise from inside the new namespace
This makes possible to start a chroot of another architecture without
being root.
Thomas Weißschuh [Wed, 12 Jun 2024 21:32:15 +0000 (23:32 +0200)]
lib/sysfs: zero-terminate result of sysfs_blkdev_get_devchain()
sysfs_blkdev_get_devchain() does not zero-terminate its result, but the
caller expects a C-string.
Use ul_buffer_get_string() which includes a trailing zero-byte.
Now it's also valid for sz and bufsz to be equal.
See #3088. Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Thomas Weißschuh [Thu, 13 Jun 2024 09:39:34 +0000 (11:39 +0200)]
lib/buffer: introduce ul_buffer_get_string()
Some users need a zero-byte-terminated string.
As the buffer internally already maintains a zero-termination, add a
helper function that exposes this to users.
wdctl: always query device node when sysfs is unavailable
When there is no sysfs at all for the watchdog, fall back to reading
from the device node.
This is also useful if the legacy compat /dev/watchdog device which
never has a sysfs interface.
Closes: #3073 Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Thomas Weißschuh [Mon, 29 Apr 2024 06:11:57 +0000 (08:11 +0200)]
lsfd: (tests) skip tests using fd flags on qemu-user
The flags value visible in /proc/$PID/fdinfo/ is encoded using the
platform the kernel is running on.
Not all platforms use the same numeric flag value,
making this cross-platform interpretation brittle.
Karel Zak [Mon, 3 Jun 2024 10:33:01 +0000 (12:33 +0200)]
libmount: fix tree FD usage in subdir hook
* Initialize the tree file descriptor in the hook_subdir.c module if
it has not been initialized yet. (hook_mount.c does not open the
tree if the mount.<type> helper will be executed.)
* Move the function to open the tree to context.c to make it more
generic and usable in more places.
Reported-by: Linus Heckemann <git@sphalerite.org> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 3 Jun 2024 12:32:18 +0000 (14:32 +0200)]
wall: always use utmp as fallback
Wall(1) can be compiled with systemd support to read the names of ttys
from the systemd session list. However, this may not work on all systems.
In case of failure, the best option is to use the traditional
utmp method as a fallback.
This commit uses strv (string vector) to collect tty names from both
sources (systemd and utmp) and then sends a message to all ttys.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=2283049 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Thu, 30 May 2024 12:11:38 +0000 (14:11 +0200)]
tests: update lscpu vmware_fpe output
The cpuinfo for vmware_fpe defines two types of CPUs, which differ in
their flags. However, this difference is ignored by lscpu. The latest
version now uses the flags that were defined later.
Karel Zak [Thu, 30 May 2024 11:59:16 +0000 (13:59 +0200)]
lscpu: use CPU types de-duplication
The new CPU type was always allocated when a new relevant value for
the type was found in the cpuinfo file. However, this solution is
fragile because it can result in the parser creating a cputype struct
with incomplete information.
For instance, on ARM systems with multiple CPU types, a new CPU type
would be triggered by a different "CPU part ID". In cases where the
vendor remained the same, a new type would be created later but the
vendor would not be initialized.
The new implementation creates a new CPU type for each CPU (almost)
and then later de-duplicates the array based on vendor, model, etc.
Addresses: https://github.com/util-linux/util-linux/issues/3062 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 28 May 2024 10:32:49 +0000 (12:32 +0200)]
Merge branch 'scriptreplay/add-interactive-playback/2999' of https://github.com/jNullj/util-linux
* 'scriptreplay/add-interactive-playback/2999' of https://github.com/jNullj/util-linux:
format: fix switch case indent
fix clang compile
replace fgetwc with fgetc
format: fix comments and if braces format
format: CamelCase to SnakeCase
Refactor convoluted switch case into if else
fix formatting and add mising break
Add missing author
Add interactive playback docs
Add right arrow key to step forward in playback
Remove uneeded veriable
Add support for adjusting replay speed with arrow keys
Refactor to handle responsive input
Add pause functionality to replay
Refactor delay_for function signature to use const struct timeval
Set stdin to nonblock
Karel Zak [Mon, 27 May 2024 09:51:46 +0000 (11:51 +0200)]
Merge branch 'fix-unnecessary-remake' of https://github.com/ChenQi1989/util-linux
* 'fix-unnecessary-remake' of https://github.com/ChenQi1989/util-linux:
libsmartcols/src/Makemodule.am: ensure filter-scanner/paser.c file is newer than the .h file
Karel Zak [Mon, 27 May 2024 09:48:49 +0000 (11:48 +0200)]
Merge branch 'PR/cal-fix-weeknumber-colors' of github.com:karelzak/util-linux-work
* 'PR/cal-fix-weeknumber-colors' of github.com:karelzak/util-linux-work:
tests: add color schema to cal(1) tests
cal: colorize --vertical output.
cal: properly colorize the week number in vertical output.
cal: fix --week use and colors
Karel Zak [Mon, 27 May 2024 09:48:13 +0000 (11:48 +0200)]
Merge branch 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work
* 'PR/libmount-errmsg' of github.com:karelzak/util-linux-work:
libmount: (loop) detect and report lost loop nodes
libmount: add mnt_context_sprintf_errmsg()
libmount: add functions to use error buffer
libmount: use regular function to save/reset syscalls status
Chen Qi [Sat, 25 May 2024 03:41:35 +0000 (11:41 +0800)]
libsmartcols/src/Makemodule.am: ensure filter-scanner/paser.c file is newer than the .h file
In released tarball, for filter-scanner/parser, the .h and the .c
file has the same mtime. The 'make' tool thinks .h is newer than
the .c file, thus deciding to remake it. This will not only cause
unnecessary rebuild, but also parallel make error. For example,
after 'make', when running 'make install', the libmount.la and findmnt
are both rebuilt and findmnt building will somethings error out complaining
'libmount.so: no such file or directory' or 'libmount.so: file format
not recognized'.
Touch the generated .c file to ensure it's newer than the .h file.
In this way, in new released tarballs in the future, there will
be no unnecessary remake.
jNullj [Fri, 24 May 2024 19:23:48 +0000 (22:23 +0300)]
replace fgetwc with fgetc
there is no real reason to use fgetwc here as arrow key press is not read as a multi-byte by fgetwc and the logic implemented here also reads the keypress byte by bytes.
Karel Zak [Wed, 22 May 2024 10:14:43 +0000 (12:14 +0200)]
Merge branch 'libuuid/coverity' of https://github.com/t-8ch/util-linux
* 'libuuid/coverity' of https://github.com/t-8ch/util-linux:
libuuid: construct UUIDv7 without "struct uuid"
libuuid: construct UUIDv6 without "struct uuid"
libuuid: add helper to set version and variant in uuid_t
Karel Zak [Wed, 22 May 2024 10:12:34 +0000 (12:12 +0200)]
Merge branch 'libuuid/fork' of https://github.com/t-8ch/util-linux
* 'libuuid/fork' of https://github.com/t-8ch/util-linux:
libuuid: clear uuidd cache on fork()
libuuid: split uuidd cache into dedicated struct
libuuid: drop check for HAVE_TLS
Karel Zak [Wed, 22 May 2024 08:52:04 +0000 (10:52 +0200)]
libmount: add functions to use error buffer
* Add mnt_context_set_errmsg() and mnt_context_append_errmsg() functions.
* Replace custom code with mnt_context_syscall_save_status() function.
* Optionally use syscall name when generating error message.
Karel Zak [Mon, 20 May 2024 13:07:24 +0000 (15:07 +0200)]
cal: fix --week use and colors
* don't overwrite --week=<number> by the current date, default only
to the current year, if the year is not specified
* introduce "weeks" color sequence to colorize all week numbers.
Note that the man page suggests using "weeknumber" to colorize all
week numbers, but the code only uses this sequence for the week
requested by the --week option. This commit maintains backward
compatibility, although it would be better to use "weeknumber" for all
week numbers and "weekwanted" for the desired week.
Nicholas Vinson [Wed, 15 May 2024 15:14:54 +0000 (11:14 -0400)]
Conditionally add uuid_time64 to sym. version map
The symbol uuid_time64 is conditionally defined. It only exists on
32-bit platforms that use the glibc library and enable support for
the 64-bit time_t type.
For all other platforms, the symbol is undefined. As a result, when
ld.lld version 17 or newer is used with default flags, ld.lld will
reject the symbol map with the error:
version script assignment of 'UUID_2.40' to symbol 'uuid_time64'
failed: symbol not defined
To fix this issue, the reference to uuid_time64 is changed to
uuid_time64*. The change to a glob pattern satisifies ld.lld and allows
the library to link.
sys-utils/setarch.c:106:7: error: 'PER_LINUX32_3GB' undeclared here (not in a function); did you mean 'PER_LINUX32'?
106 | X(PER_LINUX32_3GB) \
| ^~~~~~~~~~~~~~~