dd is returning different content using same inputs
Dewayne Geraghty
dewaynegeraghty at gmail.com
Thu Jun 8 08:10:43 UTC 2017
I'm attempting to skip the first three bytes of a file and then pull the
header out of message. Please note the file size varies between 105 and 54
bytes, even though the input file and everything else remains constant, on
FreeBSD hathor 11.1-PRERELEASE FreeBSD 11.1-PRERELEASE #0 r319562M: Mon
Jun 5 03:13:08 AEST 2017 root at hathor:/110007/D/K8/hqdev-amd64-smp-vga
amd64 1100514 1100514
# rm encheader;dd if=/tmp/tLbdoJ/encmessage bs=1 skip=3 | dd bs=384 count=1
of=encheader ; ls -lrth encheader
0+1 records in
0+1 records out
105 bytes transferred in 0.000026 secs (4071661 bytes/sec)
-rw-r--r-- 1 root wheel 105B Jun 8 16:35 encheader
# rm encheader;dd if=/tmp/tLbdoJ/encmessage bs=1 skip=3 | dd bs=384 count=1
of=encheader ; ls -lrth encheader
0+1 records in
0+1 records out
67 bytes transferred in 0.000026 secs (2554912 bytes/sec)
-rw-r--r-- 1 root wheel 67B Jun 8 16:35 encheader
# rm encheader;dd if=/tmp/tLbdoJ/encmessage bs=1 skip=3 | dd bs=384 count=1
of=encheader ; ls -lrth encheader
0+1 records in
0+1 records out
68 bytes transferred in 0.000024 secs (2867263 bytes/sec)
-rw-r--r-- 1 root wheel 68B Jun 8 16:35 encheader
# rm encheader;dd if=/tmp/tLbdoJ/encmessage bs=1 skip=3 | dd bs=384 count=1
of=encheader ; ls -lrth encheader
0+1 records in
0+1 records out
54 bytes transferred in 0.000025 secs (2167717 bytes/sec)
-rw-r--r-- 1 root wheel 54B Jun 8 16:35 encheader
# rm encheader;dd if=/tmp/tLbdoJ/encmessage bs=1 skip=3 | dd bs=384 count=1
of=encheader ; ls -lrth encheader
0+1 records in
0+1 records out
91 bytes transferred in 0.000024 secs (3751494 bytes/sec)
-rw-r--r-- 1 root wheel 91B Jun 8 16:35 encheader
I used this around May 8th (from a OS and ports rebuild on 4th May) and was
performing some final testing on an 11.1 Prerelease built on Jun 5.
This works correctly so perhaps I'm not using dd correctly?
dd if=/tmp/tLbdoJ/encmessage skip=1 bs=3 | dd bs=1 count=384 of=encheader
; hd encheader|head -n1; ls -l encheader
More information about the freebsd-stable
mailing list