Karel Zak
8678085900
fstrim: clean return code on --quiet-unsupported
...
This feature is already supported for -a and -A. Let's support it also
when FS specified on command line.
Addresses: https://github.com/systemd/mkosi/pull/721
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-01 17:23:43 +02:00
Karel Zak
effda97409
Merge branch 'tests' of https://github.com/rossburton/util-linux
2021-06-30 12:39:13 +02:00
Karel Zak
16a1c8dcdf
lsblk: normalize space in SERIAL and MODEL
...
These strings come from HW and udev does not modify it. It seems good
idea to clean up it before we print it.
Fixes: https://github.com/karelzak/util-linux/issues/1368
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-30 12:25:18 +02:00
Ross Burton
b1c71f19ea
tests: mark ul/ul as a known failure
...
As with ul/basic, this test produces different output when ran under
different terminals, which isn't very useful.
Set TS_KNOWN_FAIL so that these problems don't cause the test to fail.
Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-06-30 11:25:11 +01:00
Karel Zak
9c092ff340
Merge branch 'kill' of https://github.com/rossburton/util-linux
...
* 'kill' of https://github.com/rossburton/util-linux :
tests: check correct log file for errors in blkdiscard test
tests: don't hardcode /bin/kill in the kill tests
2021-06-30 12:07:50 +02:00
Karel Zak
0c409b7b54
libblkid: remove EVMS support
...
"When you discover you're riding a dead horse, the best strategy is to dismount."
EVMS is dead since 2006, LVM is the winner.
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-30 11:35:45 +02:00
Huang Shijie
81d6de9166
lscpu: remove the old code
...
The file "/sys/firmware/dmi/tables/DMI" always exists.
The dmi_decode_cputype() can provide more information then arm_smbios_decode().
So remove it to tidy the code.
Before this patch, we can get the output from Centos 7.9 who has
"/sys/firmware/dmi/entries/4-0/raw" and "/sys/firmware/dmi/tables/DMI":
----------------------------------------------------
BIOS Vendor ID: Ampere(TM)
Model name: Neoverse-N1
BIOS Model name: Ampere(TM) Altra(TM) Processor
----------------------------------------------------
After this patch which uses "/sys/firmware/dmi/tables/DMI", in Centos 7.9, we get:
----------------------------------------------------
BIOS Vendor ID: Ampere(TM)
Model name: Neoverse-N1
BIOS Model name: Ampere(TM) Altra(TM) Processor Q00-00 CPU @ 2.8GHz
BIOS CPU family: 257
----------------------------------------------------
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
2021-06-30 11:27:26 +02:00
Ross Burton
55c58c6fd3
tests: check correct log file for errors in blkdiscard test
...
When checking if the discard ioctl is supported, look in stderr not stdout as
that is where the error appears.
Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-06-29 21:19:04 +01:00
Ross Burton
93ed220b13
tests: don't hardcode /bin/kill in the kill tests
...
If the 'kill' test is executed with --use-system-commands, it calls
/bin/kill to avoid the shell's own kill command being invoked.
However, this doesn't work if the kill we want to test isn't in fact in
/bin. Instead, use $(which kill) to find a kill on the PATH and call
that directly.
Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-06-29 17:21:53 +01:00
Karel Zak
5efc31f9d8
cfdisk: optimize mountpoint detection for PARTUUID
...
Don't check fstab (and udev symplinks) for new UUIDs.
Fixes: https://github.com/karelzak/util-linux/issues/1331
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-25 12:58:51 +02:00
Karel Zak
35a9b0d577
Merge branch 'fix_mount_fscontext' of https://github.com/tweksteen/util-linux
...
* 'fix_mount_fscontext' of https://github.com/tweksteen/util-linux :
mount.8.adoc: Remove context options exclusion
2021-06-25 11:47:06 +02:00
Karel Zak
ccedcc55e1
hexdump: do not use atoi()
...
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-25 11:05:21 +02:00
Karel Zak
0461279ab3
pg: do not use atoi()
...
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-25 10:24:35 +02:00
Karel Zak
1d5c14ae1a
misc: improve string to number conversions
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-24 16:42:53 +02:00
Karel Zak
9fc0f69c25
include/strutils: consolidate string to number conversion
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-24 16:36:58 +02:00
Karel Zak
86f05d3946
more: fix null-pointer dereference
...
The command allows executing arbitrary shell commands while viewing a file by
entering '!' followed by the command. Entering a command that contains a '%',
'!', or '\' causes a segmentation violation.
The same more(1) function has a problem when not file is specified (cat
/etc/passwd | more) on command line.
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1975153
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-23 11:37:31 +02:00
Karel Zak
b4533177ae
agetty: do not use atol()
...
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 17:26:20 +02:00
Karel Zak
24c17c6294
lscpu: do not use atoi()
...
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 17:20:49 +02:00
Karel Zak
55cbb788f8
utmpdump: do not use atoi()
...
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 17:04:24 +02:00
Karel Zak
cfc0d463b4
swapon: do not use atoi()
...
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 17:04:24 +02:00
Karel Zak
70bce9b32f
ipcs: do not use atoi()
...
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 17:04:24 +02:00
Karel Zak
a1b3e2ec9d
eject: do not use atoi()
...
* remove unnecessary strtok() use
* remove atoi use()
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 17:04:24 +02:00
Karel Zak
2ce856993b
fsck: do not use atoi()
...
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 14:49:35 +02:00
Karel Zak
84825b161b
include/strutils: cleanup strto..() functions
...
* add ul_strtos64() and ul_strtou64()
* add simple test
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 14:42:15 +02:00
Karel Zak
4077526856
blockdev: improve arguments parsing (remove atoi)
...
old version:
# blockdev --setfra 4x096 /dev/sdc
new version:
# blockdev --setfra 4x096 /dev/sdc
blockdev: failed to parse command argument: '4x096'
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 12:32:58 +02:00
Karel Zak
94a5b2e84f
cfdisk: do not use atoi()
...
It's unnecessary to use atoi in this case.
Addresses: https://github.com/karelzak/util-linux/issues/1358
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-22 11:50:06 +02:00
Karel Zak
3e5e56eb0a
readprofile: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:37:48 +02:00
Karel Zak
95bfc92361
wipefs: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:34:06 +02:00
Karel Zak
93d01a6233
lslocks: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:33:36 +02:00
Karel Zak
f1de6d6526
kill: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:32:51 +02:00
Karel Zak
2fc2bb7ebd
lslogins: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:31:43 +02:00
Karel Zak
d8a42b67c8
fsck: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:29:43 +02:00
Karel Zak
fe4e122ab3
lsmem: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:29:33 +02:00
Karel Zak
35d458708e
lscpu: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:22:04 +02:00
Karel Zak
9bf8088f25
hwclock: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:21:11 +02:00
Karel Zak
c9eea1b354
ipcs: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:20:20 +02:00
Karel Zak
b0cfd4ba3a
libuuid: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:06:40 +02:00
Karel Zak
5aa726461a
libmount: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:03:01 +02:00
Karel Zak
0395e8f7d7
libblkid: check errno after strto..()
...
Addresses: https://github.com/karelzak/util-linux/issues/1356
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 15:00:40 +02:00
Thiébaud Weksteen
da277d4eff
mount.8.adoc: Remove context options exclusion
...
The exclusivity between the {fscontext, defcontext} and context options
was removed in kernel 2.6.25[1]. No specific verification on these
options is done in mount(8)[2].
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=c9180a57a9ab2d5525faf8815a332364ee9e89b7
[2] https://github.com/karelzak/util-linux/blob/master/libmount/src/context_mount.c#L202
2021-06-21 14:16:39 +02:00
Karel Zak
1293b0f65d
misc: consolidate stat() error message
...
Let's use the same error message everywhere to reduce number of
strings for translators.
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 12:40:41 +02:00
Karel Zak
c6f3632905
fsck.cramfs: use open+fstat rather than stat+open
...
Fixes: https://github.com/karelzak/util-linux/issues/1353
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 12:39:33 +02:00
Karel Zak
17fc8693cd
include/c: add drop_permissions(), consolidate UID/GID reset
...
Fixes: https://github.com/karelzak/util-linux/issues/1354
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-21 12:25:31 +02:00
Karel Zak
0272f2ef98
dmesg: remove condition [lgtm scan]
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 17:57:13 +02:00
Huang Shijie
b366e69b82
lscpu: add more sanity checks for dmi_decode_cputype()
...
After tested on different platforms, we found dmi_string() may return NULL
in some case.
So add more sanity checks for dmi_decode_cputype().
Signed-off-by: Huang Shijie <shijie@os.amperecomputing.com>
2021-06-18 17:51:11 +02:00
Karel Zak
6eb184299e
tools: report and use LDFLAGS in tools/config-gen
...
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 17:37:38 +02:00
Karel Zak
75cba8d5cd
build-sys: use $LIBS rather than LDFLAGS
...
Fixes: https://github.com/karelzak/util-linux/pull/1349
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 17:21:13 +02:00
Karel Zak
5a8261020b
lib/path: (test) fix ul_new_path() use
2021-06-18 17:02:38 +02:00
Karel Zak
2f38ae595b
more: add __format__ attribute
...
Reported-by: Jan Pazdziora <jpazdziora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 16:58:38 +02:00
Karel Zak
0c753d8d6b
wall: add __format__ attribute
...
Reported-by: Jan Pazdziora <jpazdziora@redhat.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-06-18 16:56:52 +02:00