Bug 13881 - xxd -p -r fails with input longer than 30 bytes
Summary: xxd -p -r fails with input longer than 30 bytes
Status: RESOLVED FIXED
Alias: None
Product: Busybox
Classification: Unclassified
Component: Other (show other bugs)
Version: unspecified
Hardware: All Linux
: P5 normal
Target Milestone: ---
Assignee: unassigned
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-06-29 14:50 UTC by Trammell Hudson
Modified: 2021-10-08 21:04 UTC (History)
1 user (show)

See Also:
Host:
Target:
Build:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trammell Hudson 2021-06-29 14:50:08 UTC
version: 21fbee2e87ddf7b47bb501b6529b63ac2b3af0bd (git checkout 2021-06-29)

xxd -p -r discards input longer than 30 bytes when the characters are all on one line:

% echo "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" \
| ./busybox xxd -p -r | xxd -g1
00000000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f  ................
00000010: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d        ..............


% echo "000102030405060708090a0b0c0d0e0f 101112131415161718191a1b1c1d1e1f" \
| ./busybox xxd -p -r | xxd -g1
00000000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f  ................
00000010: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d        ..............

Splitting the values onto separate lines works:

% echo "000102030405060708090a0b0c0d0e0f
101112131415161718191a1b1c1d1e1f" \
| ./busybox xxd -p -r | xxd -g1
00000000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f  ................
00000010: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f  ................

Using the system xxd produces the expected result regardless of whitespace:

% echo "000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f" \
| /usr/bin/xxd -p -r | xxd -g1
00000000: 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f  ................
00000010: 10 11 12 13 14 15 16 17 18 19 1a 1b 1c 1d 1e 1f  ................
Comment 1 Denys Vlasenko 2021-10-08 21:04:26 UTC
Fixed in git, thank you