Bug#996764: FTBFS: test misc/swaplabel failure

2021-10-18 Thread Mark Hindley
Chris,

On Mon, Oct 18, 2021 at 03:17:14PM +0200, Chris Hofstaedtler wrote:
> Could you add your Signed-off-by: to the patch, so I can forward it
> upstream? (Or you could send it to util-li...@vger.kernel.org
> directly, too.)

Yes, of course. Attached. I'll leave you to send it upstream, so everything is
in one place. Hope that is OK.

Best wishes

Mark
>From b2e6485bbb9e9ce1929d8ba4a3aa0965a52cd52f Mon Sep 17 00:00:00 2001
From: Mark Hindley 
Date: Sun, 17 Oct 2021 20:25:47 +0100
Subject: [PATCH] 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:  contains holes or other unsupported extents.
 This swap file can be rejected by kernel on swap activation!
 Use --verbose for more details.

Signed-off-by: Mark Hindley 
---
 tests/ts/misc/swaplabel | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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



Processed: Re: Bug#996764: FTBFS: test misc/swaplabel failure

2021-10-18 Thread Debian Bug Tracking System
Processing control commands:

> found -1 2.37.2-1
Bug #996764 [util-linux] FTBFS: test misc/swaplabel failure
Marked as found in versions util-linux/2.37.2-1.

-- 
996764: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=996764
Debian Bug Tracking System
Contact ow...@bugs.debian.org with problems



Bug#996764: FTBFS: test misc/swaplabel failure

2021-10-18 Thread Chris Hofstaedtler
Control: found -1 2.37.2-1

Hello Mark,

* Mark Hindley  [211018 12:33]:
[..]
> 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.
[..]
> 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.

Right, thanks for the patch.

Could you add your Signed-off-by: to the patch, so I can forward it
upstream? (Or you could send it to util-li...@vger.kernel.org
directly, too.)

Best wishes,
Chris



Bug#996764: FTBFS: test misc/swaplabel failure

2021-10-18 Thread Mark Hindley
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:  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  libselinux12.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 
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:  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