It's seems detection by BLKRRPART is broken in recent kernels
(probably regression), and it's also overkill to force kernel re-read
all and generate all the events. It seems more elegant to use O_EXCL.
Signed-off-by: Karel Zak <kzak@redhat.com>
The current libblkid ignores FAT when created on the same whole-disk
device as valid MBR. This restriction is not compatible with many
devices (like USB flash disk) created by Windows or the latest
dosfstools where the first partition is used for entire device and
where is also valid FAT. The filesystem is accessible from partition
as well as from whole-disk device.
The conclusion (between util-linux, dosfstools and udisks) is that
libblkid has to provide all details, not hide anything and the proper
policy (hide/show) has to be implemented by udisks (or so).
CC: Tomáš Bžatek <tbzatek@redhat.com>
CC: Pali Rohár <pali.rohar@gmail.com>
Signed-off-by: Karel Zak <kzak@redhat.com>
The disk layout as created by scsi_debug depends on kernel version.
Let's make the partition sizes hardcoded in our tests than rely on
kernel.
Signed-off-by: Karel Zak <kzak@redhat.com>
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:
fdisk: align 512/4K ... SKIPPED (cannot remove scsi_debug module (rmmod))
fdisk: align 512/4K +alignment_offset ... SKIPPED (cannot remove scsi_debug module (rmmod))
fdisk: align 512/4K +MD ... SKIPPED (cannot remove scsi_debug module (rmmod))
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.
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.
Signed-off-by: Karel Zak <kzak@redhat.com>
Linux kernel since 6730e6580177d13f4612767873cb5a533ad63c61 checks for
limits and kernel ipc/utils.h defines
#define IPCMNI_SHIFT 15
#define IPCMNI (1 << IPCMNI_SHIFT)
it means 32768 (aka shortint max). Let's use it in our tests too to
avoid "Invalid argument" when write to /proc/sys/kernel/shmmni.
Signed-off-by: Karel Zak <kzak@redhat.com>
Image iso-different-iso-joliet-label contains different identifiers in ISO
and Joliet locations. Identifiers are prefixed with "ISO" or "Joliet"
string to verify that UNICODE Joliet has preference over ASCII ISO.
Image iso-unicode-long-label contains very long identifiers in ISO location
which do not fit into the Joliet location. In ISO location is UNICODE
character 'ï' replaced by '_' and unrepresentable spaces also by '_'.
This test verifies that libblkid can use first half of identifiers from
Joliet (which contains UNICODE) and second half from ISO which is just
uppercase and only small subset of ASCII. This image was generated by Nero
Linux software and basically this truncate and '_' replacement is done by
default for any long or UNICODE label.
Signed-off-by: Pali Rohár <pali.rohar@gmail.com>
The getwchar(3) will choke and exit if invalid character is encountered.
This change will make col(1) to print broken multibyte characters as
\x{hex} string.
Reported-by: Vitaly Lipatov <lav@etersoft.ru>
Addresses: https://github.com/karelzak/util-linux/issues/1198
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
This commit adds support for multisession filesystem images to
standard low-probe blkid tests. The expected image name is
<name>-multi-<offset>[-<offset> ...][-<something>].img
For example:
iso-multi-0-174-348-genisoimage.img.xz
triggers three sub-tests:
: iso-multi-genisoimage-0 ... OK
: iso-multi-genisoimage-174 ... OK
: iso-multi-genisoimage-348 ... OK
Addresses: https://github.com/karelzak/util-linux/issues/1161
Signed-off-by: Karel Zak <kzak@redhat.com>
* 'whereis' of https://github.com/ferivoz/util-linux:
whereis: extend test case
whereis: filter bin, man and src differently
whereis: do not strip suffixes
whereis: do not ignore trailing numbers
whereis: add --disable-whereis to configure
whereis: add lib32 directories
whereis: support zst compressed man pages
whereis: fix out of boundary read
The old images of the atari label are truncated and in-table stored
sizes do not match with real images sizes -- libblkid checks it now.
I have no idea how to generate ICD format, let's ignore it in tests
for now.
Signed-off-by: Karel Zak <kzak@redhat.com>
Commit 7b54f05d6b added iflag=fullblock
option, it works fine with coreutils's dd but macOS's dd doesn't support
iflag option then test failed on macOS[1].
This commit added prepared test data for test to not use dd command to
avoid dd command difference.
tested on raspberry pi3
$ sudo sh -c 'for i in $(seq 1 500); do taskset -c 0 ./ts/cramfs/mkfs-endianness ; done' | grep FAILED | wc -l
0
tested on macOS
$ sudo sh -c 'for i in $(seq 1 500); do ./ts/cramfs/mkfs-endianness ; done' | grep FAILED | wc -l
0
[1]https://travis-ci.org/github/karelzak/util-linux/jobs/723642222#L3907
Signed-off-by: Masami Ichikawa <masami256@gmail.com>
When run mkfs-endianness test on lowend machine, sometimes dd didn't
fill block with string then test failed.
So, it's nice to add iflag=fullblock option to fill a block with
string read from stdin.
Tested on Raspberry Pi 3 B+(using 1core to simulate lowend environment)
with iflag=fullblock option didn't get test failure.
Without iflag=fullblock option.
$ sudo sh -c 'for i in $(seq 1 500); do taskset -c 0 ./ts/cramfs/mkfs-endianness ; done' | grep FAILED | wc -l
49
With iflag=fullblock option.
$ sudo sh -c 'for i in $(seq 1 500); do taskset -c 0 ./ts/cramfs/mkfs-endianness ; done' | grep FAILED | wc -l
0
Signed-off-by: Masami Ichikawa <masami256@gmail.com>
to make it easier to catch regressions going forward.
It's a follow-up to 678d03cc8a, 9f03ad60e5
and 4bdb681571
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
* 'fuzz' of https://github.com/evverx/util-linux:
tests: pack testcases into zip archives
tests: integrate test_last_fuzz into the testsuite
tests: add a fuzzer for process_wtmp_file
docs: mention OSS-Fuzz and CIFuzz and how to build fuzz targets locally
tools: make it possible to set all the fuzzing flags with config-gen
build-system: make "make distcheck" work
travis: set CXX correctly
travis: turn on --enable-fuzzing-engine
build-sys: add support for --enable-fuzzing-engine
tests: integrate test_mount_fuzz into the testsuite
tests: take exit codes into account
tests: add a fuzzer for mnt_table_parse_stream
Add a few checks to the symlink test, including for the fix
in commit 477239ce0d ("rename: fix regression for symlink
with non-existing target").
Tested with './tests/run.sh rename/symlink' before/after that
commit with FAILED/OK results (and '--show-diff') as expected:
After:
rename: symlink check ... OK
Before:
rename: symlink check ... FAILED (rename/symlink)
With --show-diff:
diff-{{{
--- /home/mfo/git/util-linux/tests/expected/rename/symlink 2020-07-14 15:21:06.412792160 -0300
+++ /home/mfo/git/util-linux/tests/output/rename/symlink 2020-07-14 15:45:10.980927233 -0300
@@ -3,5 +3,3 @@
rename_slink.3: `old' -> `new'
`rename_slink.1' -> `rename_symlink.1'
target
-`rename_slink.2' -> `rename_symlink.2'
-target
}}}-diff
diff-{{{
--- /home/mfo/git/util-linux/tests/expected/rename/symlink.err 2020-07-14 15:37:42.466207786 -0300
+++ /home/mfo/git/util-linux/tests/output/rename/symlink.err 2020-07-14 15:45:10.984927251 -0300
@@ -1 +1,2 @@
+rename: rename_slink.2: not accessible: No such file or directory
rename: rename_slink.3: No such file or directory
}}}-diff
Signed-off-by: Mauricio Faria de Oliveira <mfo@canonical.com>
ts_init_py meddles with LD_LIBRARY_PATH causing those tests to fail with
```
+Traceback (most recent call last):
+ File "/home/travis/build/karelzak/util-linux/libmount/python/test_mount_tab.py", line 8, in <module>
+ import pylibmount as mnt
+ImportError: /home/travis/build/karelzak/util-linux/.libs/libblkid.so.1: undefined symbol: __ubsan_handle_negate_overflow
}}}-diff
```
The test assumed that / was a mountpoint. This is not always the case, for
example in pbuilder/cowbuilder chroots. So use / if findmnt verifies it is a
mountpoint, otherwise use the first mountpoint found. Skip the test if no
mountpoints are found.
Signed-off-by: Mark Hindley <mark@hindley.org.uk>
Commit I made while back and has been part of util-linux v2.30 to v2.35 made
col(1) not to output anything when first line did not have newline character.
printf "gone from output" | col
This commit fixes the issue. Admittedly the col source code is unnecessarily
hard to work with. It could be a good idea to refactor the col(1) as low
priority task, Assuming refactoring is done the first commit to get that done
should add tests that exhaust all possible input handling including all command
line option directives.
Addresses: https://github.com/karelzak/util-linux/issues/422
Fixes: b6b5272b03
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
metadata v0.90 is deprecated thing and unsupported to create by some new
mdadm versions. It's possible to assemble this array (with
default_layout=1 on modprobe raid0), but impossible to create a new
one.
References: 4ae96cf77b
Addresses: https://bugzilla.redhat.com/show_bug.cgi?id=1826251
Signed-off-by: Karel Zak <kzak@redhat.com>