From 535539222d0636fade66236d4d1603f49a6c7a13 Mon Sep 17 00:00:00 2001 From: Yu Watanabe Date: Wed, 13 Aug 2025 15:57:15 +0900 Subject: [PATCH] TEST-72-SYSUPDATE: make randomly generated image file not have compression header MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- test/units/TEST-72-SYSUPDATE.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/test/units/TEST-72-SYSUPDATE.sh b/test/units/TEST-72-SYSUPDATE.sh index e5c62c635e..57510b9638 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"