Package: util-linux
Version: 2.37.2-3
Severity: serious
Tags: patch ftbfs
Justification: fails to build from source (but built successfully in the past)

Chris,

Whilst building a local version of util-linux 2.37.2-3, the misc/swaplabel test
failed.

I believe this is caused by the change in behaviour of mkswap, which now
complains on stderr if the provided image contains holes. My build environment
is pbuilder/cowbuilder chroot with /var/cache/pbuilder mounted as
ext3. Apparently the call to fallocate() in tests/ts/misc/swaplabel allocates a
file with holes that mkswap then complains about.  The additional, unexpected
text in /build/util-linux-2.37.2/tests/output/misc/swaplabel.err is:

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

which directly causes the failure.

I have worked around it with the attached patch which invokes fallocate() with
the -x flag. Although, I suppose fallocate could be dispensed with and truncate
always used instead.

Best wishes

Mark

-- System Information:
Debian Release: 10.0
Architecture: amd64 (x86_64)

Kernel: Linux 4.19.0-17-amd64 (SMP w/2 CPU cores)
Locale: LANG=en_GB.UTF-8, LC_CTYPE=en_GB.UTF-8 (charmap=UTF-8), 
LANGUAGE=en_GB:en (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages util-linux depends on:
ii  fdisk          2.33.1-0.1+devuan1~beowulf2
ii  libaudit1      1:2.8.4-3
ii  libblkid1      2.33.1-0.1+devuan1~beowulf2
ii  libc6          2.28-10
ii  libcap-ng0     0.7.9-2
ii  libeudev1      3.2.9-9~beowulf1
ii  libmount1      2.33.1-0.1+devuan1~beowulf2
ii  libpam0g       1.3.1-5
ii  libselinux1    2.8-1+b1
ii  libsmartcols1  2.33.1-0.1+devuan1~beowulf2
ii  libtinfo6      6.1+20181013-2+deb10u2
ii  libuuid1       2.33.1-0.1+devuan1~beowulf2
ii  login          1:4.5-1.1
ii  zlib1g         1:1.2.11.dfsg-1

util-linux recommends no packages.

Versions of packages util-linux suggests:
ii  dosfstools          4.1-2
ii  kbd                 2.0.4-4
ii  util-linux-locales  2.33.1-0.1+devuan1~beowulf2

-- no debconf information
>From 03a585290d86b74d4861e11569c426362c8b853c Mon Sep 17 00:00:00 2001
From: Mark Hindley <m...@hindley.org.uk>
Date: Sun, 17 Oct 2021 20:25:47 +0100
Subject: [PATCH 1/1] Fix test/misc/swaplabel failure due to change in mkswap
 behaviour.

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.

diff --git a/tests/ts/misc/swaplabel b/tests/ts/misc/swaplabel
index 0801cb213..8b1abb5c3 100755
--- a/tests/ts/misc/swaplabel
+++ b/tests/ts/misc/swaplabel
@@ -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"
 }
-- 
2.20.1

Reply via email to