Karel Zak [Thu, 4 Feb 2021 09:42:53 +0000 (10:42 +0100)]
hardlink: replace with code from Debian
The current version used in util-linux is based on original code from
Jakub Jelinek.
The new version is based on Debian implementation from
https://salsa.debian.org/jak/hardlink. This new version uses nftw()
to walk on directories tree and organize internal data binary tree
(tsearch() and twalk()). This new version provides more features like
--ignore-{mode,owner,time}, --respect-xattrs, --respect-name,
--include, --keep-oldest, --minimize, --maximize, etc.
Note that the new version uses -f for --respect-name, the old version
uses -f to hardlinking across filesystems (very probably rarely unused
feature).
Addresses: https://github.com/karelzak/util-linux/issues/808 Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Loone [Tue, 9 Feb 2021 09:46:36 +0000 (10:46 +0100)]
agetty: tty eol defaults to REPRINT
Adapting tty eol settings from defaults misbehaves as CTRL('r') aka
REPRINT is confused with CR. Consequently --skip-login does not set
tty CR<->NL translations and thus acts against advertised CR as eol
default.
[kzak@redhat.com:
It seems this issue has been introduced by commit f566447 where we
merged sulogin and agetty terminal initialization together to the file
include/ttyutils.h.
The original agetty has really used .eol=13 (aka CR) for the default.
The problem is invisible for sulogin(1) because it always asks for a
password and .eol= is set to NL/CR, the same agetty when it asks for
username.]
Addresses: https://github.com/karelzak/util-linux/pull/1247 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Fri, 5 Feb 2021 09:29:26 +0000 (10:29 +0100)]
Merge branch 'gh-actions-bionic' of https://github.com/mrc0mmand/util-linux
* 'gh-actions-bionic' of https://github.com/mrc0mmand/util-linux:
ci: run the build test for each pull request
ci: build both w/ and w/o sanitizers on GH Actions
ci: code cleanup
ci: deal with uninstrumented binaries using instrumented libs
text-utils: correctly detect ASan under clang
ci: use the correct compiler version
ci: 'downgrade' Ubuntu version to Bionic
Karel Zak [Wed, 3 Feb 2021 13:45:15 +0000 (14:45 +0100)]
login: use full tty path for PAM_TTY
pam_set_item() man page:
PAM_TTY
The terminal name: prefixed by /dev/ if it is a device file;
for graphical, X-based, applications the value for this item
should be the $DISPLAY variable.
It seems for example pam_timestamp module is not robust enough to
differentiate between /dev/ and pty/0 and it assumes that '/' in the
path always means '/dev/' prefix ...
Fixes: https://github.com/karelzak/util-linux/issues/1242 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 3 Feb 2021 13:45:15 +0000 (14:45 +0100)]
su: use full tty path for PAM_TTY
pam_set_item() man page:
PAM_TTY
The terminal name: prefixed by /dev/ if it is a device file;
for graphical, X-based, applications the value for this item
should be the $DISPLAY variable.
It seems for example pam_timestamp module is not robust enough to
differentiate between /dev/ and pty/0 and it assumes that '/' in the
path always means '/dev/' prefix ...
Fixes: https://github.com/karelzak/util-linux/issues/1242 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 2 Feb 2021 15:32:51 +0000 (16:32 +0100)]
build-sys: cleanup uclampset dependencies
chrt requires sched_setattr() or sched_setscheduler(), the both is
covered by have_schedsetter variable in ./configure.ac. This variable
is useless for uclampset, because it requires sched_setattr(). Let's
make it more explicit for uclampset.
Karel Zak [Tue, 2 Feb 2021 15:53:50 +0000 (16:53 +0100)]
Merge branch 'uclampset-v3' of https://github.com/qais-yousef/util-linux
* 'uclampset-v3' of https://github.com/qais-yousef/util-linux:
uclampset: Plumb in bash-completion
uclampset: Plump into the build system
uclampset: Add man page
Add uclampset schedutil
Move sched_attr struct and syscall definitions into header file
Qais Yousef [Tue, 13 Oct 2020 15:03:44 +0000 (16:03 +0100)]
Add uclampset schedutil
Utilization clamping is a new kernel feature that got merged in 5.3. It
allows controlling the performance of a process by manipulating the
utilization such that the task appears bigger or smaller than what it
really is.
There's a system-wide control to to restrict what maximum values the
process are allowed to use.
Man page added in a later patch attempts to explain the usage in more
detail.
Frantisek Sumsal [Fri, 29 Jan 2021 21:01:02 +0000 (22:01 +0100)]
ci: deal with uninstrumented binaries using instrumented libs
All `eject` tests were failing under ASan, since they call /bin/mount,
which is uninstrumented, but it picks up the instrumented `libblkid`
library, causing ASan to complain:
gcc:
ASan runtime does not come first in initial library list; you should either link runtime to your application or manually preload it with LD_PRELOAD.
eject: unmount of `/home/runner/work/util-linux/util-linux/tests/output/eject/umount-by-disk-mounted-mnt' failed
clang:
/bin/umount: symbol lookup error: /home/runner/work/util-linux/util-linux/.libs/libblkid.so.1: undefined symbol: __sancov_lowest_stack
eject: unmount of `/home/runner/work/util-linux/util-linux/tests/output/eject/umount-by-disk-mounted-mnt' failed
Subsequently, all tests which require the `scsi_debug` module get skipped,
since it's still in use due to the failed umount:
In case of gcc this can be easily resolved by setting $LD_PRELOAD to the
respective ASan library. clang makes this a bit more difficult, since it
compiles the ASan library statically, so firstly we need to force dynamic
linking (via -shared-asan), and then add the runtime DSO path to the
linker cache, since it's in a non-standard path.
Frantisek Sumsal [Fri, 29 Jan 2021 17:13:13 +0000 (18:13 +0100)]
ci: 'downgrade' Ubuntu version to Bionic
Since the current Ubuntu Focal image in GH Actions is missing the
`kernel-modules-extra` package with the `scsi_debug` module[0], let's
change the distro flag from `ubuntu-20.04` (Focal) to `ubuntu-latest`
(currently Bionic, as Focal is still in the beta phase).
ToddRK [Thu, 28 Jan 2021 11:44:41 +0000 (12:44 +0100)]
fsck.cramfs: fix fsck.cramfs crashes on blocksizes > 4K
fsck.cramfs crashes when extracting a cramfs image with a 16KB blocksize.
The read_buffer is hardcoded for a 4KB blocksize. When using a blocksize
larger than 4KB, the program's code uses indexes that go past the end of the
allocated space for the read_buffer and this causes the crash.
The following changes fix the problem for me in the latest 2.36.1 release of
fsck.cramfs.c. However there are hardcoded values of 4096 in the code that
might cause problems under other circumstances and I have not attempted to
fix those.
[kzak@redhat.com: - some coding style changes to code]
Fixes: https://github.com/karelzak/util-linux/issues/1232 Signed-off-by: ToddRK <ToddRK@example.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Mon, 25 Jan 2021 10:11:05 +0000 (11:11 +0100)]
libmount: allow --read-only for not-root users
The command "mount -r" was supported for non-root users in very old
mount(8) versions. Unfortunately, in this case libmount replaces all
mount options from command line by options from fstab. We need
exception for MS_RDONLY.
Fixes: https://github.com/karelzak/util-linux/issues/1235 Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Wed, 20 Jan 2021 08:20:54 +0000 (09:20 +0100)]
wipefs: fix compiler warning
misc-utils/wipefs.c: In function ‘main’:
misc-utils/wipefs.c:838:3: error: ‘for’ loop initial declarations are only allowed in C99 mode
misc-utils/wipefs.c:838:3: note: use option -std=c99 or -std=gnu99 to compile your code
Karel Zak [Tue, 19 Jan 2021 15:25:33 +0000 (16:25 +0100)]
tests: improve u64 use in ipcs test
UINT64_MAX is 18446744073709551615, but 2^64 is 18446744073709551616.
We also need to use kbytes in all calculation in the test than bytes
as ipcs by default do not use bytes anymore.
Karel Zak [Mon, 18 Jan 2021 15:04:18 +0000 (16:04 +0100)]
ipcs: fallback for overflow
The previous commit 7a08784ab053d6aa30db990cbec1fd35b34ed00a reduced
number of situation when we need fallback when kbytes calculated for
shmall pages, but there is still possible to see overflows.
v1->v2:
Print the non-overflow KB value only for IPC_UNIT_KB and
IPC_UNIT_DEFAULT.
This way --bytes and --human options will still get an expected
output
(but not avoiding the overflow).
Signed-off-by: Vasilis Liaskovitis <vliaskovitis@suse.com> Signed-off-by: Karel Zak <kzak@redhat.com>
Karel Zak [Tue, 12 Jan 2021 10:43:31 +0000 (11:43 +0100)]
lib/loopdev: make is_loopdev() more robust
It seems the current kernel can create a loop devices with a different
major number. For example
# losetup /dev/loop12345678 file.img
# lsblk /dev/loop12345678
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
loop12345678 15:811342 0 5M 0 loop
We need a way how to verify the device is loopdev also when the device is
not associated with any backing file -- in this case there is no "loop"
directory in /sys/dev/block/<maj:min>/, but we can cannonicalize this sysfs
symlink as it points to /sys/devices/virtual/block/loop<n> (see "loop" in
the path).
Note that without this change losetup is not able to list and delete
the loop device.
Addresses: https://github.com/karelzak/util-linux/issues/1202 Signed-off-by: Karel Zak <kzak@redhat.com>
Sami Kerola [Thu, 24 Dec 2020 20:22:59 +0000 (20:22 +0000)]
build-sys: silence non-POSIX variable name warning
Easiest way to get rid of the following warning is to ignore the warning.
This might cause people who use non-GNU make to have hard time, but are
there such people compiling this project?
sys-utils/Makemodule.am:226: warning: addprefix sys-utils/,$(SETARCH_LINKS: non-POSIX variable name
sys-utils/Makemodule.am:226: (probably a GNU make extension)