diff options
author | Pádraig Brady <P@draigBrady.com> | 2012-02-13 21:47:28 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2012-02-13 21:58:21 +0000 |
commit | 4bb5dbcfef55c4f66755dd3c48b906e4e9030b96 (patch) | |
tree | 319a68a46ddbe044f5851891f1826174e5f88360 /tests/dd/bytes | |
parent | 140eca15c4a3d3213629a048cc307fde0d094738 (diff) | |
download | coreutils-4bb5dbcfef55c4f66755dd3c48b906e4e9030b96.tar.xz |
dd: fix issues in the count_bytes and seek_bytes flags change
These edge cases were missed in the previous commit 140eca15c.
* src/dd.c (main): Include the bytes slop when truncating
without further I/O. Don't invalidate the whole file cache
in the case where 0 < count < ibs.
* tests/dd/bytes: Change to using the independent truncate
command to generate the file for comparison. Remove a redundant
test case and replace with one testing the truncation only logic.
Diffstat (limited to 'tests/dd/bytes')
-rwxr-xr-x | tests/dd/bytes | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/dd/bytes b/tests/dd/bytes index 603874290..15755aae3 100755 --- a/tests/dd/bytes +++ b/tests/dd/bytes @@ -45,13 +45,12 @@ esac # seek bytes echo abcdefghijklm | dd bs=5 seek=8 oflag=seek_bytes > out 2> /dev/null || fail=1 -echo abcdefghijklm | - dd bs=4 seek=2 > expected 2> /dev/null || fail=1 +printf '\0\0\0\0\0\0\0\0abcdefghijklm\n' > expected compare expected out || fail=1 -# seek bytes on empty file -echo abcdefghijklm | - dd bs=5 seek=8 oflag=seek_bytes > out2 2> /dev/null || fail=1 -compare expected out2 || fail=1 +# Just truncation, no I/O +dd bs=5 seek=8 oflag=seek_bytes of=out2 count=0 2> /dev/null || fail=1 +truncate -s8 expected2 +compare expected2 out2 || fail=1 Exit $fail |