Commit Graph

1422 Commits

Author SHA1 Message Date
Karel Zak de9cbcdcef Merge branch 'whereis' of https://github.com/ferivoz/util-linux
* '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
2020-11-06 09:44:52 +01:00
Samanta Navarro 062e6a3945 whereis: extend test case
Previous commits are covered with these test cases.

Removed dependency on system layout.

Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
2020-11-04 11:43:09 +00:00
Samanta Navarro cb77628876 misc: fix typos [codespell]
Signed-off-by: Samanta Navarro <ferivoz@riseup.net>
2020-11-04 11:42:25 +00:00
Karel Zak 1ab5f9b705 docs: rename to getopt-example
Addresses: 27114b2974 (commitcomment-43591002)
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-11-03 15:23:03 +01:00
Sami Kerola aa439c6035
ul: add basic tests
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-10-20 20:29:20 +01:00
Karel Zak 2ceccca901 tests: update sfdisk wipe tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-16 10:59:17 +02:00
Karel Zak 017c0308c7 tests: update atari partx tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-10-13 18:34:39 +02:00
Karel Zak 0d061b6e68 tests: update atari blkid tests
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>
2020-10-13 16:29:19 +02:00
Karel Zak 18b96d7102 Merge branch 'col-refactor' of https://github.com/kerolasa/util-linux
* 'col-refactor' of https://github.com/kerolasa/util-linux:
  col: replace LINE and CHAR typedefs with structs
  col: free memory before exit [LeakSanitizer]
  col: tidy up sources a little bit
  col: add defaults to switch case clauses
  col: flip all comparisions to numerical order
  col: use size_t when dealing with numbers that buffer sizes
  col: add structure to hold line variables
  col: add update_cur_line() function
  col: add handle_not_graphic() function
  col: initialize variables when they are declared
  col: move option handling to separate function
  col: move global variables to a control structure
  col: use inline function rather than function like define
  col: use typedef and enum to clarify struct
  col: remove function prototypes
  col: add more tests
2020-09-29 13:41:00 +02:00
Karel Zak c8baef03c6 tests: update script(1) return code
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-09-21 13:34:06 +02:00
Sami Kerola b97981a707
col: add more tests
With these tests coverage is about 89%.

The ts_run is added to ensure ASAN_OPTIONS and UBSAN_OPTIONS are set
correctly when the tests run.

Reference: https://github.com/karelzak/util-linux/pull/1115#issuecomment-670140224
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-09-11 20:55:01 +01:00
Masami Ichikawa 9c84873186 tests: mkfs-endianness test uses prepared test data
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>
2020-09-09 09:10:58 +09:00
Masami Ichikawa 7b54f05d6b tests: mkfs-endianness test use iflag=fullblock to fill block completely with string
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>
2020-09-03 10:41:18 +09:00
Evgeny Vereshchagin 519ad7a136 tests: add testcases that triggered various crashes
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>
2020-08-12 00:21:45 +00:00
Evgeny Vereshchagin b62ec52e8f tests: add a fuzz target calling fdisk_script_read_file
It has already found a couple of issues mentioned in
https://github.com/karelzak/util-linux/issues/1023#issuecomment-671910621
2020-08-10 23:30:50 +00:00
Karel Zak c87cce57d8 Merge branch 'fuzz' of https://github.com/evverx/util-linux
* '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
2020-08-10 14:40:44 +02:00
Karel Zak dc4816142c tests: add sfdisk test for 4fe7f9b614
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-08-10 12:00:17 +02:00
Evgeny Vereshchagin 877356164a tests: integrate test_last_fuzz into the testsuite
by adding tests/ts/* and a testcase triggering https://github.com/karelzak/util-linux/pull/1097

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-08-06 12:33:11 +00:00
Evgeny Vereshchagin 7b4ab119f4 tests: integrate test_mount_fuzz into the testsuite
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-08-06 12:33:11 +00:00
Evgeny Vereshchagin 78905e4450 tests: take exit codes into account
In its current form the testsuite isn't suitable for running
fuzz targets because it ignores exit codes and relies solely
on diffs (that unfortunately aren't helpful because the nondeterministic
nature of fuzz targets makes it kind of hard to specify expected output
in advance). This patch is supposed to address the "exit code" issue for now.

Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-08-06 12:33:11 +00:00
Karel Zak db85c0eb89 Merge branch 'mk-rm' of https://github.com/evverx/util-linux
* 'mk-rm' of https://github.com/evverx/util-linux:
  tests: an attempt to get around https://github.com/karelzak/util-linux/issues/1110
2020-08-06 11:49:29 +02:00
Evgeny Vereshchagin f04521f4ac tests: an attempt to get around https://github.com/karelzak/util-linux/issues/1110
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-28 08:15:23 +00:00
Chris Hofstaedtler dcd77a69da fdisk: fix expected test output on alpha
The last test output update inadvertedly replaced "ext2" with "MS-DOS"
in the alpha-specific data.

Fixes: 3c36438f0
Broken build log: https://buildd.debian.org/status/fetch.php?pkg=util-linux&arch=alpha&ver=2.36-1&stamp=1595550493&raw=0
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
2020-07-24 09:09:43 +02:00
Mauricio Faria de Oliveira ff84ba8b03 rename: tests: add more symlink checks
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>
2020-07-14 15:51:47 -03:00
Karel Zak f596692030 test_tiocsti: check ioctl() return code [coverity scan]
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-14 11:43:38 +02:00
Evgeny Vereshchagin 1b9f2ff333 tests: turn off detect_leaks on s390x, use more asan options
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-03 13:26:08 +00:00
Evgeny Vereshchagin d3c9e21fe7 tests: skip "blkid/dm-err" when `mknod` doesn't work
Signed-off-by: Evgeny Vereshchagin <evvers@ya.ru>
2020-07-03 11:44:23 +00:00
Karel Zak bc270ae1a8 Merge branch 'werror' of https://github.com/evverx/util-linux 2020-07-03 11:34:12 +02:00
Evgeny Vereshchagin 6af515811b tests: ignore the python libmount tests when they're run under UBSan
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
```
2020-07-03 11:18:54 +02:00
Evgeny Vereshchagin e6a4d8cc06 build-sys: add --enable-ubsan to make it possible to build util-linux with UBSan
mostly to prepare for https://github.com/karelzak/util-linux/pull/1068
but it's useful even without fuzzing.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-07-03 11:17:53 +02:00
Evgeny Vereshchagin bf04d98b93 skip hwclock/systohc on Travis CI on Ubuntu Precise
It's flaky there.

Closes https://github.com/karelzak/util-linux/issues/1082
2020-07-02 11:52:46 +00:00
Mark Hindley 3e93958117 tests: Fix mountpoint test failure in build chroots.
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>
2020-06-24 15:44:44 +02:00
Sami Kerola d8bfcb4cc5
col: fix output when first line does not have newline character
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>
2020-06-20 22:17:30 +01:00
Karel Zak b66e4d8a03 tests: cleanup cramfs checksums
Let's make the code more readable.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-06-15 11:48:13 +02:00
Karel Zak 2f6674b01b Merge branch 'cramfs-mkfs' of https://github.com/mator/util-linux
* 'cramfs-mkfs' of https://github.com/mator/util-linux:
  tests: add checksum for cramfs/mkfs for BE:8192 (sparc64)
2020-06-15 11:41:17 +02:00
Anatoly Pugachev 895839d064 tests: add checksum for cramfs/mkfs for BE:8192 (sparc64)
Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2020-06-11 14:25:04 +03:00
Karel Zak 7519c3edab tests: explain why MD tests with metadata v0.90 are KNOWN-FAIL
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>
2020-06-11 11:05:30 +02:00
Karel Zak 01977c3847 tests: add STATIC binaries to build-sys tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-06-09 10:55:20 +02:00
Karel Zak 1376cdeaf2 tests: update build-sys tests
- remove libasan from results
- link libcryptsetup (due to verity support in libmount)
- add lsiqr
- add irqtop

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-06-08 13:29:33 +02:00
Karel Zak f7c875d4a9 tests: don't use ASAN in build tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-06-08 11:45:09 +02:00
Helge Deller 2261cfdc26 setarch: fix stderr handling in uname26 tests
A while ago stdout and stderr have been split in these testcases, but
"FATAL: kernel too old" is actually treated as an "okay" output. However
this FATAL ends up on stderr, so when it happens, it is not seen in
the captured stdout.

Fix this by merging stdout/stderr in these cases once again.

Signed-off-by: Helge Deller <deller@gmx.de>
Signed-off-by: Chris Hofstaedtler <zeha@debian.org>
Bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=961639
Fixes: cbf858aa08
2020-05-28 15:59:13 +02:00
Karel Zak fd3a8fda9a tests: sfdisk fill correctly gaps if default start requested
References: 83fdb880b9
Addresses: https://github.com/karelzak/util-linux/issues/1044
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-05-22 11:30:27 +02:00
Aurelien LAJOIE f8d76efe97 cal: Add test, all are checked against ncal
ncal -M 09 2006
    September 2006
Mo     4 11 18 25
Tu     5 12 19 26
We     6 13 20 27
Th     7 14 21 28
Fr  1  8 15 22 29
Sa  2  9 16 23 30
Su  3 10 17 24

cal -mv 09 2006
    September 2006
Mo     4 11 18 25
Tu     5 12 19 26
We     6 13 20 27
Th     7 14 21 28
Fr  1  8 15 22 29
Sa  2  9 16 23 30
Su  3 10 17 24

For example `vertical-3sjv` `ncal -wjA2 08 2006`
The differences are 3 letters days when julian calendar with cal
Trailing spaces
2020-05-11 17:41:54 +02:00
Mark Hindley 89547e4767 tests: Fix for misc/fallocate test build failure.
This was already a known possible failure case. However, in the migration to a
clearer separation of stdout and stderr in the testsuite, the logfile used to
detect the failure was not updated.

Signed-off-by: Mark Hindley <mark@hindley.org.uk>
2020-05-06 15:14:48 +02:00
Rosen Penev ad296391f9
[clang-tidy] fix wrong *cmp usage
Found with bugprone-suspicious-string-compare

Signed-off-by: Rosen Penev <rosenp@gmail.com>
2020-04-20 13:21:00 -07:00
Karel Zak f12d5ad279 lib/strutils: fix uint64_t overflow
Addresses: https://github.com/karelzak/util-linux/issues/998
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-17 10:25:17 +02:00
Karel Zak 316617e848 tests: update fdisk outputs due to sizes rounding change
References: b38c20e13a
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-16 12:19:16 +02:00
Karel Zak b38c20e13a ilib/strutils: fix rounding in size_to_human_string()
Thanks to bub75 for the idea.

The patch adds SIZE_DECIMAL_2DIGITS into regression tests.

Addresses: https://github.com/karelzak/util-linux/issues/998
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-15 15:06:37 +02:00
Karel Zak ea4dcdc788 tests: add zonefs blkid test
Thanks to Damien Le Moal for the image.

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-04-06 15:33:23 +02:00
Aurelien LAJOIE b908299188 cal: Correctly center the year
Signed-off-by: Aurelien LAJOIE <orel@melix.net>
2020-03-31 15:31:54 +02:00
Karel Zak e7db499f1c tests: cleanup fdisk based stuff
* use fdisk --noauto-pt to avoid re-creation of the default architecture specific PT
* use more verbose "Created a new" messages in the output

Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-24 14:30:16 +01:00
Karel Zak f3c90e9172 Revert "tests: fixes fdisk/align-512-* tests"
This reverts commit 25f5c514b9.
2020-03-24 10:48:55 +01:00
Anatoly Pugachev 25f5c514b9 tests: fixes fdisk/align-512-* tests
write 'MSDOS' partition table before test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2020-03-23 17:23:01 +03:00
Anatoly Pugachev d4dc0fcf83 tests: fixes mount tests on SPARC
fdisk partition table fix for writting "msdos" label before the test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2020-03-11 17:22:21 +03:00
Anatoly Pugachev 356ed88a56 tests: fixes libmount/ on SPARC
fdisk partition table fix for writting "msdos" label before test

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2020-03-11 17:22:21 +03:00
Anatoly Pugachev f97c20f4a4 tests: fixes eject/umount on SPARC
Since SPARC is using 'sun' partition table by default, make test not to
assume that disk has 'dos' partition table, so write 'dos' partition
table on disk, before proceeding any further.

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2020-03-11 17:22:21 +03:00
Karel Zak ac762ed71f sfdisk: fix previous --append patch, improve man page
- fix stupid typo (!has_container_or_unused(sf))
- use fdisk_is_partition_used() as fdisk_get_partition() returns
  nothing for unused partition
- update tests
- add more hints to the man page

Addresses: https://github.com/calamares/calamares/issues/1332
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-03-02 14:41:39 +01:00
Sami Kerola 3c36438f0b
fdisk: update expected test outputs with command outputs
Reference; https://github.com/karelzak/util-linux/pull/959
Addresses: 5d271cefad
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2020-02-20 21:19:37 +00:00
Karel Zak 3239663361 Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
  tests: Add UDF hdd image with emoji label created by mkudffs 2.2
  libblkid: Fix UTF-16 support in function blkid_encode_to_utf8()
2020-02-10 13:51:23 +01:00
Karel Zak f88034e818 tests: add sfdisk --dump test
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-02-10 13:20:04 +01:00
Pali Rohár ef111c0b3e tests: Add UDF hdd image with emoji label created by mkudffs 2.2
mkudffs 2.2 can create UDF filesystem which label contains Unicode code
points above U+FFFF which cannot be represented by UCS-2 encoding and
therefore UTF-16 needs to be used (via surrogate pairs). Unicode code
points above U+FFFF are encoded in UTF-8 by four bytes and some example is
emoji "😀".

This is test case to check that libblkid correctly supports UTF-16
decoding. It was created by mkudffs 2.2:

$ dd if=/dev/zero of=udf-hdd-mkudffs-2.2.img bs=1M count=10
$ mkudffs -l 😀 udf-hdd-mkudffs-2.2.img
2020-02-09 13:04:39 +01:00
Karel Zak 27903b1cc4 Revert "libblkid: improve handling of ISO files with partition tables"
This reverts commit 7ef86a0891.
2020-01-13 11:53:11 +01:00
Karel Zak cd361f901e Revert "libblkid: improve identification of ISO9660 partition"
This reverts commit fc84bc0a46.
2020-01-13 11:48:37 +01:00
Karel Zak 4ae96cf77b tests: mark mdadm tests as TS_KNOWN_FAIL
It seems recent changes in mdadm make things a little bit unstable for
some users. Let's mark the tests temporary as TS_KNOWN_FAIL until we
get more information.

Addresses: https://github.com/karelzak/util-linux/issues/906
Signed-off-by: Karel Zak <kzak@redhat.com>
2020-01-07 11:41:01 +01:00
Karel Zak 63f8c66af8 Merge branch 'master' of https://github.com/dsd/util-linux
* 'master' of https://github.com/dsd/util-linux:
  libblkid: improve identification of ISO9660 partition
  isosize: move ISO size functions into a shared header
2019-12-20 12:55:49 +01:00
Karel Zak 653d1c8110 tests: (fdisk) make sure we use the same sizes for MD devices
It seems on some kernels MD can return error if the devices in RAID
have different size

 # mdadm -q --create /dev/md8 --chunk=64 --level=0 --raid-devices=2 /dev/sda1 /dev/sda2
 mdadm: RUN_ARRAY failed: Unknown error 524

 # dmesg
 ...
 [ 1485.148435] md/raid0:md8: cannot assemble multi-zone RAID0 with default_layout setting
 [ 1485.152306] md/raid0: please set raid.default_layout to 1 or 2
 [ 1485.154050] md: pers->run() failed ...
 [ 1485.154104] md: md8 stopped.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-17 18:10:31 +01:00
Karel Zak 5202d809b6 Merge branch 'master' of https://github.com/pali/util-linux
* 'master' of https://github.com/pali/util-linux:
  libblkid: udf: Fix reporting UDF 2.60 revision for Mac OS X disks
2019-12-17 12:34:18 +01:00
Karel Zak b2ef43864f tests: (chfn) force to bash
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-16 15:27:45 +01:00
Radka Skvarilova 02238bff66 tests: add new test for chfn gecos
Addresses: http://bugzilla.redhat.com/show_bug.cgi?id=1743555
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-16 13:22:29 +01:00
Daniel Drake fc84bc0a46 libblkid: improve identification of ISO9660 partition
Recent changes to the iso9660 handler attempt to better handle the case
where the media has both an ordinary ISO9660 filesystem, and a partition
table with a partition entry pointing at the ISO9660 filesystem.

Rather than assuming the presence of a partition table means that there
is an ISO9660 partition, check that such a partition exists before
deciding upon which device the metadata should be presented. One real
world example of this is the grub-mkrescue image format; add a unit test
to cover that.

Secondly, even if we find an appropriate entry in the partition table,
verify that we actually have a device that corresponds to the partition
where we would then proceed to expose this metadata. In the case of a
CD/DVD (i.e. /dev/sr0) we would not normally expect to see devices
corresponding to the partitions, in that case the ISO metadata should be
presented on the whole disk (/dev/sr0).

Fixes: 7ef86a0891 ("libblkid: improve handling of ISO files with partition tables")
Link: https://bugzilla.redhat.com/show_bug.cgi?id=1783066
Signed-off-by: Daniel Drake <drake@endlessm.com>
2019-12-16 14:29:24 +08:00
Pali Rohár 92fc937ba4 libblkid: udf: Fix reporting UDF 2.60 revision for Mac OS X disks
Apple's newfs_udf, when creating UDF 2.60 disks, sets value 2.50 into
both Minimum UDF Read Revision and Minimum UDF Write Revision fields in
LVIDIU. And sets 2.60 value into UDF revision field in LVD descriptor.

So to correctly parse and set blkid ID_FS_VERSION field, use maximum value
from Minimum UDF Read Revision in LVIDIU, Minimum UDF Write Revision in
LVDIU and UDF revision in LVD descriptor.

This commit also adds a testing UDF 2.60 disk image with 4K sectors created
by Apple's newfs_udf to verify that ID_FS_VERSION is set correctly to 2.60.
2019-12-15 12:55:41 +01:00
Karel Zak 4af92de983 build-sys: remove duplicate includes
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-12-10 13:50:18 +01:00
Karel Zak 21c97651f4 tests: mark scriptlive as KNOWN_FAILED
Not sure why, but on travis-ci the shell output is little bit
different, probably depends on shell version, etc.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-26 09:56:24 +01:00
Karel Zak 52722cda11 tests: another prompt fix
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-25 14:09:38 +01:00
Karel Zak a06b278bd3 tests: remove option --posix
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-25 10:45:38 +01:00
Karel Zak 53ea212dca tests: make scriptlive output more portable
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-22 14:21:20 +01:00
Karel Zak 45b819c124 tests: upadet scriptlive output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-22 14:04:11 +01:00
Karel Zak 85ecd3719b tests: add script and scriptlive replay
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-22 13:48:54 +01:00
Karel Zak b4402de7a0 tests: commit add missing file
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-05 15:42:19 +01:00
Karel Zak be906b20f2 tests: add mount --all tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-11-05 15:14:17 +01:00
Anatoly Pugachev a43665128c tests: fixes blkid/md-raidX-whole on Sparc
Since SPARC is using 'sun' partition table by default, make test not to
assume that disk has 'dos' partition table, so write 'dos' partition
table on disk, before proceeding any further.

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2019-10-23 11:26:19 +03:00
Karel Zak 93c2723772 tests: (lsblk) gather also udev attributes for new dumps
References: 7408a5d9c2
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-15 13:29:13 +02:00
Karel Zak a72a19865d tests: add missing 'ts_check_prog xz'
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-10 09:07:10 +02:00
Karel Zak 4abb659c18 tests: remove device name from blkdiscard output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 16:57:24 +02:00
Karel Zak b1154c4ece script: fix signalfd use
It's necessary to create signal-fd before fork() to get SIGCHLD,
because child could be faster than our code.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 16:51:34 +02:00
Karel Zak 125314c04a script: add debug messages around waitpid()
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 15:07:49 +02:00
Karel Zak 406fb25387 tests: add --parsable, remove TS_OPT_parsable
* don't enable parsable for non-parallel executions in travis
* add --parsable to run.sh
* use --parsable rather than TS_OPT_ in travis

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 13:04:34 +02:00
Karel Zak 060c4cee0f build-sys: cleanup prefixed used for tests
It's ugly to use the same TS_ prefix in tests as well as in
build-system (e.g. make check), because then some env. variable can be
interpreted by our regression tests. For example TS_PARALLEL=.

It's seems better to use TS_ exclusively for tests and TESTS_ for
build-system.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 12:31:28 +02:00
Karel Zak 571f5f5ba1 build-sys: support 'none' for parallel tests
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 12:01:57 +02:00
Karel Zak ac543a15b6 travis: don't call tests in parallel for root
Let's make it more readable in logs for root user.

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-09 09:55:27 +02:00
Karel Zak ec10634e7e script: use lib/pty-session
This patch consolidate pseudo-terminal stuff in util-linux. From now
there is only one implementation used in su(1) --pty, scriptlive(1)
and script(1).

The new stuff is based on the original script(1) -- it means poll()
and signalfd() based.

Note that script(1) code does not provide fallback for systems/libc
where is no openpty().

Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-08 13:11:54 +02:00
Elliott Mitchell 2bb3aa36b2 cleanup: Remove some spurious spaces
Sorry detail-oriented people tend to wipe these out if they notice them.
Add in automated tools and lots of excess end-of-line spaces get wiped
out.

Addresses: https://github.com/karelzak/util-linux/pull/849
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-10-01 13:01:43 +02:00
Karel Zak 52a1f767c0 Merge branch 'master' of https://github.com/dsd/util-linux
* 'master' of https://github.com/dsd/util-linux:
  libblkid: improve handling of ISO files with partition tables
2019-09-30 11:15:57 +02:00
Daniel Drake 7ef86a0891 libblkid: improve handling of ISO files with partition tables
The ISO format specifically leaves the first 32kb blank so that it
can be used for other purposes, such as adding a partition table.
This is commonly used (e.g. by Endless and Fedora installation media) to
have partition 0 starting at sector 0 as a mountable iso9660 filesystem,
followed by more partitions (e.g. an EFI system partition).
Such layouts can be easily created by tools such as xorriso.

When plugging in a USB disk flashed with this type of ISO, blkid presents
a somewhat confusing view of the block devices. Taking the example of
a 'sda' disk with two partitions:
 1. The "iso partition"
 2. An unformatted partition

In such a setup, before the changes here, blkid will currently report the
ISO metadata attributes ID_FS_PUBLISHER_ID, ID_FS_UUID, ID_FS_LABEL, and
ID_FS_TYPE=iso9660 on both sda *and* sda1.

Since sda2 is unformatted, it won't have any ID_FS_ attributes of it's
own. And due to the following standard udev rule:

  # for partitions import parent information
  ENV{DEVTYPE}=="partition", IMPORT{parent}="ID_*"

sda2 will actually import all of the ID_FS_ stuff from the parent device
sda.

The result at this point is that three udev devices all have the same
ID_FS_ attribute values, leading to strange results such as three
devices all racing to own the link in /dev/disk/by-uuid, so you can't
reliably do a mount-by-UUID.

Clean up this situation by detecting such partitioned ISO disks
in the superblock probing setup. If files of this kind are detected,
we now only expose the ISO metadata attributes on the specific partition
that points to the ISO data (and not the parent disk).

Signed-off-by: Daniel Drake <drake@endlessm.com>
2019-09-25 11:41:30 +08:00
Anatoly Pugachev 616f57d949 Don't use `nproc --all` for getting cpu number. For example below,
sparc64 is reporting 128 as a total, but only 32 is online. So use only
online cpus for tests parallel runs.

$ nproc
32

$ nproc --all
128

$ lscpu
Architecture:        sparc64
CPU op-mode(s):      32-bit, 64-bit
Byte Order:          Big Endian
CPU(s):              32
On-line CPU(s) list: 0-31
Thread(s) per core:  8
Core(s) per socket:  4
Socket(s):           1
Model name:          UltraSparc T5 (Niagara5)
Flags:               sun4v

Signed-off-by: Anatoly Pugachev <matorola@gmail.com>
2019-09-24 18:15:33 +03:00
Radka Skvarilova 2062164894 tests: lscpu s390 nested virtualization
Signed-off-by: Radka Skvarilova <rskvaril@redhat.com>
Addresses:https://bugzilla.redhat.com/show_bug.cgi?id=1739443
2019-09-22 13:49:45 +02:00
Karel Zak d978ec31f7 Merge branch 'typos' of https://github.com/kerolasa/util-linux
* 'typos' of https://github.com/kerolasa/util-linux:
  bash-completion: update options
  misc: fix typos [codespell]
2019-09-16 12:38:43 +02:00
Karel Zak c50d77e6a3 tests: update sfdisk dumps
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-16 12:01:54 +02:00
Sami Kerola 218b1dd6f9
misc: fix typos [codespell]
Signed-off-by: Sami Kerola <kerolasa@iki.fi>
2019-09-12 19:41:46 +01:00
Karel Zak b008e4d668 tests: (sfdisk) update move output
Signed-off-by: Karel Zak <kzak@redhat.com>
2019-09-09 11:27:03 +02:00