| Commit message (Collapse) | Author | Age | Files | Lines |
|\
| |
| |
| |
| |
| | |
* 'nsenter-keep-caps' of https://github.com/dgibson/util-linux:
Add --keep-caps option to nsenter, similar to the one in unshare
unshare: Move implementation of --keep-caps option to library function
|
| |
| |
| |
| |
| |
| |
| |
| | |
unshare.c open codes some logic to copy the permitted capability set to the
ambient set in order to implement the --keep-caps option. Move this logic
to lib/caputils.c so that we can reuse it in nsenter.
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Commit 518a0ad dropped fflush(stdout) and fflush(stderr) from
wait_for_pager() before STDOUT_FILENO and STDERR_FILENO are closed
because it is called from a signal handler and they are async-unsafe.
However, failure to flush output leads to unwanted truncation when
stdout is fully buffered, which it is by default when we are linked
against musl.
Ensure stdout and stderr are line-buffered before redirecting them to
the pager subprocess to avoid this.
Addresses: https://github.com/util-linux/util-linux/issues/2218
Signed-off-by: Chris Webb <chris@arachsys.com>
|
| |
| |
| |
| |
| | |
Addresses: https://github.com/util-linux/util-linux/pull/2165
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|/
|
|
|
|
|
|
|
|
| |
XFS, and possibly other filesystems expect that the CRC field
is excluded (or rather RAZ) during the CRC operation. Lets
create a generic helper that is similar to the CRC32 version
ul_crc32_exclude_offset() which computes the CRC while replacing
exclude_len bytes of exclude_off with zeros.
Signed-off-by: Jeremy Linton <jeremy.linton@arm.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This commit adds support for the -e or --env option in nsenter, allowing a new process to inherit the environment va
If the option is not given, the environment variables will stay the same as in the current namespace.
Example:
Setup the namespace:
$ docker run -d -e PROJECT='util linux' --rm alpine sleep 10000
cb0b69aa7aec
$ docker inspect --format '{{ .State.Pid }}' cb0b69aa7aec
470012
Enter the namespace:
$ nsenter --all -t 470012 --env env
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
HOSTNAME=cb0b69aa7aec
PROJECT=util linux
HOME=/root
Reviewed-by: Thomas Weißschuh <thomas@t-8ch.de>
Reviewed-by: Karel Zak <kzak@redhat.com>
Signed-off-by: u2386 <hugo.cavan2386@gmail.com>
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* let's make simplified sequences (e.g. "35;4") used without
lib/colors.c (without color schemes)
* add function to detect already usable esc sequence
* support this new feature in "test_colors --color <name|seq|...>"
./test_colors --color "red"
./test_colors --color "35;5"
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
| |
The return value from colors_readdir(homedir) is used to determine if
the system directory should be searched.
Previously the mere existence of `~/.config/terminal-colors.d/` would
inhibit all lookups in `/etc/terminal-colors.d`.
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
|
|
|
|
|
|
|
|
|
| |
We already pass O_CLOEXEC flag to open(), no need to modify
the file descriptor with FD_CLOEXEC afterwards.
This was a left over from commit b1fa3e2234fa ('lib: use O_CLOEXEC in
libcommon').
Signed-off-by: Thomas Haller <thaller@redhat.com>
|
|
|
|
| |
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
|\
| |
| |
| |
| |
| |
| |
| |
| | |
* 'dmesg-subsecond' of https://github.com/t-8ch/util-linux:
dmesg: use subsecond granularity in iso format
dmesg: add subsecond granularity for --since and --until
lib/monotonic: get_suspended_time: use usec_t
timeutils: add utilities for usec_t conversions
dmesg: add test for --since and --until
|
| |
| |
| |
| | |
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
| |
| |
| |
| |
| |
| | |
This is now decoubled from the kernels notion of a removable *block*
device and instead uses removable kobjects.
This is the correct semantic for hotpluggable devices.
|
| |
| |
| |
| |
| | |
The usage of the "removable" attribute by the USB subsystem is
incorrect.
|
| |
| |
| |
| |
| |
| |
| | |
This exactly represents the kernels notion of a "removable" blockdevice.
That is, the device itself is persistent but can contain some sort of
medium that can be changed at runtime.
Specifically it is *not* hotpluggable.
|
| |
| |
| |
| |
| | |
Addresses: https://github.com/util-linux/util-linux/pull/2019
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|\ \
| |/
|/|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 'signal_safety' of https://github.com/crrodriguez/util-linux:
sulogin: only assign to variables written by signal handlers
hardlink: calling putchar is off-limits on a signal handler
hardlink: last_signal should be a volatile sig_atomic_t
pg: calling exit on signal handler is not allowed
lib:pager: fix signal safety issues
write: signal_received should be volatile qualified
flock: timeout_expired must be volatile qualified
last: should not use errx/warnx on signal handlers
su-common: bool is a distinct type in c2x
fsck: only assign to cancel_requested
fsck: use sig_atomic_t type fot signal handler global vars
|
| |
| |
| |
| |
| |
| | |
- Cannot use stdio in signal handlers, so you cannot safely call
fflush.
- cannot call exit() but only _exit()
|
| |
| |
| |
| |
| |
| |
| |
| | |
It seems better to explicitly set timezone rather than assume some
default libc behavior and system setting.
Addresses: https://github.com/util-linux/util-linux/pull/2025
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
| |
| |
| | |
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
| |
| |
| |
| | |
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
| |
| |
| |
| | |
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
| |
| |
| |
| | |
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
|
| | |
|
| |
| |
| |
| |
| |
| |
| | |
The off_t datatype is signed. Use it for high and low boundaries as
well to support also very large block devices close to its limits.
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Applications evaluate errno in case of a -1 return value. Examples
within util-linux are fsck.cramfs and mkfs.minix. Set errno more often
to offer reasonable error codes to the application and user.
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
|
|/
|
|
|
|
|
|
| |
The read call may fail if it is interrupted by a signal. Do not assume
that we have reached the end of the underlying block device because of
this. Use read_all which retries in these cases.
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
|
|
|
|
|
|
|
|
|
|
| |
The header files are usually based on code from lib/. This commit
copies relevant license headers from lib/ to include/ to keep
things consistent. The very generic things (e.g. MBR definitions)
are always public domain.
Fixes: https://github.com/util-linux/util-linux/issues/2010
Signed-off-by: Karel Zak <kzak@redhat.com>
|
| |
|
|\
| |
| |
| |
| |
| | |
* 'waitpid' of https://github.com/t-8ch/util-linux:
waitpid: add timeout support
strutils: add function strtotimespec_or_err
|
| | |
|
|/
|
|
|
|
|
| |
It seems more readable (for humans and static analyzers) and safe
to use temporary buffer than use memmove to create absolute path.
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
|
|
|
|
| |
In file included from /usr/include/stdio.h:894,
from lib/strutils.c:8:
In function ‘printf’,
inlined from ‘test_strutils_cstrcasecmp’ at lib/strutils.c:1324:2,
inlined from ‘main’ at lib/strutils.c:1348:10:
/usr/include/x86_64-linux-gnu/bits/stdio2.h:112:10: error: ‘%s’ directive argument is null [-Werror=format-overflow=]
112 | return __printf_chk (__USE_FORTIFY_LEVEL - 1, __fmt, __va_arg_pack ());
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1: all warnings being treated as errors
|
|
|
|
| |
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
| |
Fix: https://github.com/util-linux/util-linux/issues/1991
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|
|
|
|
|
|
|
| |
Sometimes, we need to compare ASCII-only strings independently on the
current locales. Let's follow our cctype.h to implement such functions.
Addresses: https://github.com/util-linux/util-linux/issues/1991
Signed-off-by: Karel Zak <kzak@redhat.com>
|
|\
| |
| |
| |
| |
| |
| |
| |
| |
| | |
* 'libblkid/topology-diskseq' of https://github.com/t-8ch/util-linux:
libblkid: topology: probe diskseq
libblkid: topology: allow setting of 64bit values
lib/sysfs: allow parent redirect even for non-queue files
blockdev: add support for ioctl BLKGETDISKSEQ
libblkid: topology: add test
tests: functions: allow partitions on loopdevs
|
| |
| |
| |
| | |
We will also need this redirect for other sysfs files.
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* 'cleanups' of https://github.com/t-8ch/util-linux:
fadvise: fix parsing of option -V
libblkid: zfs: remove unnecessary newline from debug messages
libblkid: topology: constify some structures
lib: sysfs: fix typo
|
| |/ |
|
|\ \
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
* 'stat-parsing' of https://github.com/t-8ch/util-linux:
procfs: get_stat_nth: handle braces in process name
lib: procfs: add parsing cmd containing newline
lib: procfs: add unittests
lib: procfs: prefix support for tests
lib: procfs: fix error message during test
lib: procfs: fix typo in argument specification
lib: procfs: clarify name of procfs_process_get_data_for()
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In procfs_process_get_stat_nth() we skip to the end of the process name
by looking for the ')' after it.
However if the process name itself contains a ')' then find that instead
of the correct one.
By searching the ')' from the end of the file we can make sure to always
find the correct one.
Link: https://www.openwall.com/lists/oss-security/2022/12/21/6
|
| | |
| | |
| | |
| | | |
This will be used in the unitttests.
|
| | |
| | |
| | |
| | | |
procfs_process_get_stat_nth() returns the error and does not set errno.
|
| | | |
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The previous name "procfs_process_get_line_for()" indicates that only a
single line would be read from the file.
In fact the function always returns the full file contents.
This behavior is necessary are various procfs files can contain
legitimate newlines.
Rename the function to match its behavior.
|
|\ \
| | |
| | |
| | |
| | |
| | | |
* 'address_bits' of https://github.com/t-8ch/util-linux:
setarch: use kernel address size if possible
sysfs: add helper for /sys/kernel/address_bits
|
| |/ |
|