Bug#567041: [Patch] xxd: Fix lossy reverse conversion

James Vega jamessan at debian.org
Mon Feb 8 04:04:48 UTC 2010


Bram,

As described below, xxd doesn't correctly convert free-form hex dumps to
their original form.  Attached patch, from Jean-Baptiste Wons, fixes the
issue.

On Wed, Jan 27, 2010 at 12:15:11AM +0300, Nikolai Kondrashov wrote:
> The attached input file (logitech_precision_gamepad_hidrd.txt) is
> interpreted by xxd -r -p incorrectly. In effect, not according to manual,
> which states:
> 
>     Use the combination -r -p to read plain hexadecimal dumps without line
>     number information and without a particular column layout. Additional
>     Whitespace and line-breaks are allowed anywhere.
> 
> The following command:
> cat logitech_precision_gamepad_hidrd.txt | xxd -r -p | hexdump -C
> 
> results in the following output:
> 00000000  05 01 09 04 a1 01 a1 02  75 08 95 02 15 00 26 ff  |........u.....&.|
> 00000010  25 01 45 01 05 09 19 01  29 0a 81 02 06 00 ff 75  |%.E.....)......u|
> 00000020
> 
> which is incorrect.
> 
> While the following command:
> cat logitech_precision_gamepad_hidrd.txt | tr -d ' \n' | xxd -r -p | hexdump -C
> 
> results in the correct output:
> 00000000  05 01 09 04 a1 01 a1 02  75 08 95 02 15 00 26 ff  |........u.....&.|
> 00000010  00 35 00 46 ff 00 09 30  09 31 81 02 75 01 95 0a  |.5.F...0.1..u...|
> 00000020  25 01 45 01 05 09 19 01  29 0a 81 02 06 00 ff 75  |%.E.....)......u|
> 00000030  01 95 06 25 01 45 01 09  01 81 02 c0 c0           |...%.E.......|
> 0000003d

-- 
James
GPG Key: 1024D/61326D40 2003-09-02 James Vega <jamessan at debian.org>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: xxd.diff
Type: text/x-diff
Size: 584 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20100207/853d07be/attachment.diff>
-------------- next part --------------
 05 01 09 04 A1 01 A1 02 75 08 95 02 15 00 26 FF
 00 35 00 46 FF 00 09 30 09 31 81 02 75 01 95 0A
 25 01 45 01 05 09 19 01 29 0A 81 02 06 00 FF 75
 01 95 06 25 01 45 01 09 01 81 02 C0 C0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.alioth.debian.org/pipermail/pkg-vim-maintainers/attachments/20100207/853d07be/attachment.pgp>


More information about the pkg-vim-maintainers mailing list