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.
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)
Karel Zak [Wed, 6 Jan 2021 14:17:19 +0000 (15:17 +0100)]
docs: update TODO (add item about mnt_context_get_excode() )
- add item about https://github.com/karelzak/util-linux/issues/1208
- remove old CAP_SYS_ADMIN note (in last versions mount(8) drops suid if
necessary).
Addresses: https://github.com/karelzak/util-linux/issues/1208 Signed-off-by: Karel Zak <kzak@redhat.com>
getopt: explicitly ask for POSIX mode on POSIXLY_CORRECT
GNU libc's getopt_long(3) have the tradition of not shuffling arguments
to find options when either POSIXLY_CORRECT is defined in environment
variables or '+' prepended in short options. Hence, the current code
base is fine as is fine as is for util-linux built with GNU libc.
However, musl libc only honour POSIX convention when short options
prepended with '+'. musl libc doesn't care about POSIXLY_CORRECT.
Thus, the behaviour of util-linux's getopt(1) that linked with musl-libc
doesn't match with its own documentation.
Let's make sure a '+' is always prepended to short options if
POSIXLY_CORRECT is defined.
Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>
Karel Zak [Tue, 5 Jan 2021 14:20:50 +0000 (15:20 +0100)]
Merge branch '2020wk47' of https://github.com/kerolasa/util-linux
* '2020wk47' of https://github.com/kerolasa/util-linux:
build-sys: sort various lists in configure.ac
mkswap: tell how to fix insecure permissions and owner in warning
lsipc: make default output byte sizes to be in human units
man: add missing backslash to caret printing macro
lscpu: fix variable shadowing
uuidgen: give hint in usage() what uuid namepaces can be used
uuidgen: use errx() rather than fprintf() when priting errors
libuuid: simplify uuid_is_null() check
uuidparse: use uuid type definitions from libuuid header
uuidparse: use libuuid function to test nil uuid
Sami Kerola [Sat, 28 Nov 2020 16:29:09 +0000 (16:29 +0000)]
lsipc: make default output byte sizes to be in human units
Recent request to make ipcs(1) list sizes in human format caused the
observation lsipc(1) is not doing that either. This commit changes sizes to
human format, assuming --bytes option is not used.
Reference: https://github.com/karelzak/util-linux/issues/1199 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
Sami Kerola [Thu, 26 Nov 2020 16:54:50 +0000 (16:54 +0000)]
lscpu: fix variable shadowing
sys-utils/lscpu-virt.c: In function ‘lscpu_read_virtualization’:
sys-utils/lscpu-virt.c:574:9: warning: declaration of ‘buf’ shadows a previous local [-Wshadow]
574 | char buf[256];
| ^~~
sys-utils/lscpu-virt.c:506:7: note: shadowed declaration is here
506 | char buf[BUFSIZ];
| ^~~
A 33553920 byte optimal I/O size arises from badly-implemented USB SATA
adapters reporting 0xffff 512 byte sectors (32 MiB - 512). Commit acb7651f8897ae73d0f45dd75bc87630001c61b9 indirectly addresses this by
ignoring the optimal I/O size if it's not a multiple of the physical
sector size. That works if the physical sector size is 4096, but 33553920 optimal is allowed for 512 physical.
This commit explicitly ignores 33553920, as there is no legitimate
situation where this number would be the real optimal I/O size.
Signed-off-by: Ryan Finnie <ryan@finnie.org> Closes: https://github.com/karelzak/util-linux/issues/1221
term-utils/scriptlive.c: In function 'process_next_step':
term-utils/scriptlive.c:125:4: warning: 'now.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/scriptlive.c:122:19: note: 'now.tv_usec' was declared here
term-utils/scriptlive.c:125:4: warning: 'now.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/scriptlive.c:122:19: note: 'now.tv_sec' was declared here
term-utils/script.c: In function 'log_close.part.0.isra':
term-utils/script.c:306:3: warning: 'now.tv_usec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/script.c:303:18: note: 'now.tv_usec' was declared here
term-utils/script.c:306:3: warning: 'now.tv_sec' may be used uninitialized in this function [-Wmaybe-uninitialized]
term-utils/script.c:303:18: note: 'now.tv_sec' was declared here