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.
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
Reference in New Issue
Block a user