Skip to contentSkip to conversation

Fix test/misc/swaplabel failure due to change in mkswap behaviour.

PATCH Applied Chris Hofstaedtler 2 participants 2 messages Oct 18, 2021 – Oct 19, 2021 Util-Linux package

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 Fix test/misc/swaplabel failure due to change in mkswap behaviour.

From: Mark Hindley <[email protected]>

mkswap now warns if the image file has holes. If fallocate is used to create the file, use POSIX semantics to ensure the file has no holes.

This fixes the test failure

misc: swaplabel ... FAILED (misc/swaplabel)
========= script: /build/util-linux-2.37.2/tests/ts/misc/swaplabel ================= ================= OUTPUT =====================

     1  Setting up swapspace version 1, size = 9 pages (9xPGSZ bytes)
     2  LABEL=1234567890abcde, UUID=12345678-abcd-abcd-abcd-1234567890ab
     3  LABEL: 1234567890abcde
     4  UUID:  12345678-abcd-abcd-abcd-1234567890ab
================= EXPECTED ===================
     1  Setting up swapspace version 1, size = 9 pages (9xPGSZ bytes)
     2  LABEL=1234567890abcde, UUID=12345678-abcd-abcd-abcd-1234567890ab
     3  LABEL: 1234567890abcde
     4  UUID:  12345678-abcd-abcd-abcd-1234567890ab

================= O/E diff ===================
==============================================

The additional error appears in swaplabel.err:

mkswap: <swapfile> contains holes or other unsupported extents.
This swap file can be rejected by kernel on swap activation! Use --verbose for more details.

[[email protected]: this appears to be important/required when building inside cowbuilder, on an ext3 filesystem.]

---
 tests/ts/misc/swaplabel | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/ts/misc/swaplabel +1 -1
index 0801cb213..8b1abb5c3 100755
@@ -25,7 +25,7 @@ ts_check_test_command "$TS_HELPER_SYSINFO"
 # fallocate does not work on most file systems
 function fallocate_or_skip()
 {
-	$TS_CMD_FALLOCATE -l $1 $2 2>/dev/null || \
+	$TS_CMD_FALLOCATE -x -l $1 $2 2>/dev/null || \
 	truncate -s $1 $2 || \
 	ts_skip "no way to create test image"
 }
Signature · 1 line
2.20.1
maintainer Applied
#1 lore raw
Quoted 2 lines · Chris Hofstaedtler
 tests/ts/misc/swaplabel | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Signature · 2 lines
 Karel Zak  <[email protected]>
 http://karelzak.blogspot.com