From: Yu Watanabe Date: Wed, 13 Aug 2025 06:57:15 +0000 (+0900) Subject: TEST-72-SYSUPDATE: make randomly generated image file not have compression header X-Git-Tag: v258-rc3~45^2~1 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=535539222d0636fade66236d4d1603f49a6c7a13;p=thirdparty%2Fsystemd.git TEST-72-SYSUPDATE: make randomly generated image file not have compression header Otherwise, the generated image may be wrongly detected as compressed, and importing the image may fail: ``` [ 35.194578] TEST-72-SYSUPDATE.sh[411]: + dd if=/dev/urandom of=/var/tmp/test-72-N7uTeO/source/part1-v5.raw bs=4096 count=2048 [ 35.236342] TEST-72-SYSUPDATE.sh[1075]: 2048+0 records in [ 35.236342] TEST-72-SYSUPDATE.sh[1075]: 2048+0 records out [ 35.236342] TEST-72-SYSUPDATE.sh[1075]: 8388608 bytes (8.4 MB, 8.0 MiB) copied, 0.0408601 s, 205 MB/s (snip) [ 35.948634] TEST-72-SYSUPDATE.sh[1085]: \ Acquiring /var/tmp/test-72-N7uTeO/source/part1-v5.raw → /proc/self/fd/3p2... [ 35.952878] TEST-72-SYSUPDATE.sh[1085]: Successfully forked off '(sd-import-raw)' as PID 1089. [ 35.958952] TEST-72-SYSUPDATE.sh[1089]: Importing '/var/tmp/test-72-N7uTeO/source/part1-v5.raw', saving at offset 9437184 in '/dev/loop0'. [ 35.959575] TEST-72-SYSUPDATE.sh[1089]: Failed to decode and write: Input/output error [ 35.959575] TEST-72-SYSUPDATE.sh[1089]: Exiting. ``` Fixes #38524. --- diff --git a/test/units/TEST-72-SYSUPDATE.sh b/test/units/TEST-72-SYSUPDATE.sh index e5c62c635ef..57510b9638f 100755 --- a/test/units/TEST-72-SYSUPDATE.sh +++ b/test/units/TEST-72-SYSUPDATE.sh @@ -61,8 +61,11 @@ new_version() { local sector_size="${1:?}" local version="${2:?}" - # Create a pair of random partition payloads, and compress one - dd if=/dev/urandom of="$WORKDIR/source/part1-$version.raw" bs="$sector_size" count=2048 + # Create a pair of random partition payloads, and compress one. + # To make not the initial bytes of part1-xxx.raw accidentally match one of the compression header, + # let's make the first sector filled by zero. + dd if=/dev/zero of="$WORKDIR/source/part1-$version.raw" bs="$sector_size" count=1 + dd if=/dev/urandom of="$WORKDIR/source/part1-$version.raw" bs="$sector_size" count=2047 conv=notrunc oflag=append dd if=/dev/urandom of="$WORKDIR/source/part2-$version.raw" bs="$sector_size" count=2048 gzip -k -f "$WORKDIR/source/part2-$version.raw"