[vim/vim] xxd -r doesn't work on files with extra whitespace after colon (Issue #10502)

99 views
Skip to first unread message

jpmorrison

unread,
May 30, 2022, 12:25:40 PM5/30/22
to vim/vim, Subscribed

Steps to reproduce

Extra space after the colon in the address causes xxd -r to produce empty/invalid output

Example 1:

echo '00000000:  4D5A4950 00000001 60080000 00000001    MZIP .... `... ....'  | xxd -r > test
sum test
00000     0

Workaround/correct result

echo '00000000:  4D5A4950 00000001 60080000 00000001    MZIP .... `... ....'  | tr -s ' ' |  xxd -r > test
sum test
59979     1  # correct

Example 2: any file

xxd file1| sed 's/: /:  /' | xxd -r > file2
cmp file1 file2
cmp: EOF on file2 which is empty

Expected behaviour

xxd -r should ignore extra whitespace between the colon and hex dump and produce correct output

Version of Vim

xxd 2022-01-14 / vim 8.2.5044

Environment

Linux xxd V1.10 27oct98 through xxd 2022-01-14
Cygwin xxd 2022-01-14

Logs and stack traces

No response


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10502@github.com>

Bram Moolenaar

unread,
May 30, 2022, 1:28:21 PM5/30/22
to vim/vim, Subscribed

How did that extra space get there?

"xxd -r" is really only for reversing the output of xxd itself. It's not a generic hex-dump-to-binary conversion tool.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10502/1141367599@github.com>

jpmorrison

unread,
May 30, 2022, 2:05:19 PM5/30/22
to vim/vim, Subscribed

It was a memory dump from an embedded system, it was the only way to transfer off the device.

" It's not a generic hex-dump-to-binary conversion tool." - good to know


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/issues/10502/1141386986@github.com>

Reply all
Reply to author
Forward
0 new messages