Commit Graph

15606 Commits

Author SHA1 Message Date
Karel Zak 50a3c3bd28 tests: update sfdisk reorder test
References: commit f05a5bb2c2
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-14 16:23:00 +02:00
Karel Zak a0b07d9f2e tests: skip if scsi_debug model file is not accessible
* do not print grep(1) info message

* use ts_skip rather than ts_die when scsi_debug is useless

Fixes: https://github.com/karelzak/util-linux/issues/1376
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-14 16:22:47 +02:00
Karel Zak 90a1baf9a7 tools/git-version-gen: use NEWS as a fallback
* define ".tarball-version" as the default if not specified by $1

* try read the version string from NEWS file as a fallback if the
  git-repository or .tarball-version is not available

Fixes: https://github.com/karelzak/util-linux/issues/1381
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-14 15:57:00 +02:00
Karel Zak cd313d3095 Merge branch 'fat' of https://github.com/pali/util-linux
* 'fat' of https://github.com/pali/util-linux:
  libblkid: vfat: Fix reading FAT32 boot label
  libblkid: vfat: Fix reading FAT16 boot label and serial id
2021-07-14 12:23:52 +02:00
Karel Zak 902ecb708e Merge branch 'reorder' of https://github.com/pali/util-linux
* 'reorder' of https://github.com/pali/util-linux:
  fdisk: move reorder diag messages to fdisk_reorder_partitions()
  fdisk: do not print error message when partition reordering is not needed
2021-07-14 12:21:54 +02:00
Karel Zak a8c4f2f9a9 Merge branch 'verity_sig_extension' of https://github.com/bluca/util-linux
* 'verity_sig_extension' of https://github.com/bluca/util-linux:
  mount: fix roothash signature extension in manpage
2021-07-14 12:20:30 +02:00
Karel Zak d6abaa0271 Merge branch 'meson_verity' of https://github.com/bluca/util-linux
* 'meson_verity' of https://github.com/bluca/util-linux:
  meson: fix dlopen support for cryptsetup
  meson: fix crypt_activate_by_signed_key detection
2021-07-14 12:19:49 +02:00
Karel Zak 4f16e3bc81 Merge branch 'verity_corruption' of https://github.com/bluca/util-linux
* 'verity_corruption' of https://github.com/bluca/util-linux:
  verity: fix verity.roothashsig only working as last parameter
  verity: add support for corruption action flag
  build-sys: display cryptsetup status after ./configure
2021-07-14 12:18:08 +02:00
Karel Zak 4ca2ee33b4 tests/eject: check for root perms at beginning
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-14 10:25:33 +02:00
Karel Zak a3c2f259e0 Merge branch 'test' of https://github.com/rossburton/util-linux
* 'test' of https://github.com/rossburton/util-linux:
  test/eject: guard asan LD_PRELOAD with use-system-commands check
2021-07-14 10:21:20 +02:00
Pali Rohár f05a5bb2c2 fdisk: move reorder diag messages to fdisk_reorder_partitions()
The function fdisk_reorder_partitions() is also used in sfdisk and cfdisk
and these commands assume info/warn messages from the library. So move all
messages from fdisk to fdisk_reorder_partitions().

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-13 00:40:00 +02:00
Luca Boccassi 5c49a482a9 verity: fix verity.roothashsig only working as last parameter
Parsing of verity.roothashsig did not take into consideration that other options
might follow, and used the whole string as a file path. But mnt_optstr_get_option
just returns a pointer in the mount option string, it doesn't extract it, so it
would have other subsequent options too. The length parameter has to be used.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2021-07-11 18:14:40 +01:00
Luca Boccassi ce02babfa6 verity: add support for corruption action flag
Add verity.oncorruption= to let users override the default kernel
behaviour, using libcrypsetup's relevant flags.

Signed-off-by: Luca Boccassi <luca.boccassi@microsoft.com>
2021-07-11 18:12:06 +01:00
Pali Rohár b948bbf991 fdisk: do not print error message when partition reordering is not needed
Option 'f' currently prints following RED error message:

    Nothing to do. Ordering is correct already.
    Failed to fix partitions order.

This change removes RED error message when ordering is already correct.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-06 15:35:25 +02:00
Pali Rohár c3f10636ef libblkid: vfat: Fix reading FAT32 boot label
FAT32 can be formatted with boot sign 0x28 to indicate that only serial id
is present or with boot sign 0x29 which indicates that both boot label and
serial id is present.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-05 15:10:51 +02:00
Pali Rohár 575b559254 libblkid: vfat: Fix reading FAT16 boot label and serial id
Older FAT16 variants do not have to contain boot label or serial id. Boot
sign 0x28 indicates that only serial id is present and boot sign 0x29
indicates that both boot label and serial id is present. Other boot sign
values (e.g. zero) indicates older FAT16 variant without boot label and
boot sign.

Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
2021-07-05 15:09:12 +02:00
Luca Boccassi c9c5933a38 mount: fix roothash signature extension in manpage
The PKCS7 RFC recommends to use .p7s for detached signatures file extensions,
so use that in the example.

https://datatracker.ietf.org/doc/html/rfc5751#section-3.2.1
2021-07-03 12:16:34 +01:00
Luca Boccassi e6a4b4a163 meson: fix dlopen support for cryptsetup
dlopen is treated as a dependency, but that's not quite right, it
should be an alternative way to link to libcryptsetup.
Search for it only if cryptsetup is not disabled, and if the cryptsetup-dlopen
is explicitly set to enabled. If it is, do not link to libcryptsetup.

Add cryptsetup support status to the meson summary.
2021-07-02 19:45:28 +01:00
Luca Boccassi 5a6e9adfdc meson: fix crypt_activate_by_signed_key detection
It should set HAVE_CRYPT_ACTIVATE_BY_SIGNED_KEY, rather than HAVE_CRYPTSETUP
which enables the verity features, as it needs to detect the availability of
the crypt_activate_by_signed_key API
2021-07-02 19:45:28 +01:00
Luca Boccassi 034ca748a1 build-sys: display cryptsetup status after ./configure
Signed-off-by: Luca Boccassi <bluca@debian.org>
2021-07-02 18:09:03 +01:00
Karel Zak c2ca2837a2 lscpu: don't use DMI if executed with --sysroot
Signed-off-by: Karel Zak <kzak@redhat.com>
2021-07-02 13:13:01 +02:00
Ross Burton dd956268ba test/eject: guard asan LD_PRELOAD with use-system-commands check
This test tries to add asan to LD_PRELOAD because the just-built eject
will call the host /bin/umount, and apparently asan doesn't like this.

However, if ldd isn't present, this fails as the path to asan is the
error message saying that ldd isn't present.

As the asan workaround is only needed when executing the binaries that
have just been built and not the system binaries, only use it if the
test is on the built binaries.

Closes #1373.

Signed-off-by: Ross Burton <ross.burton@arm.com>
2021-07-01 20:46:55 +01:00
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