Bug 53242

Summary: hexdumps in word mode are hardly readable
Product: [Retired] Red Hat Linux Reporter: Rick van Rein <vanrein>
Component: util-linuxAssignee: Elliot Lee <sopwith>
Status: CLOSED NOTABUG QA Contact: David Lawrence <dkl>
Severity: medium Docs Contact:
Priority: medium    
Version: 7.1   
Target Milestone: ---   
Target Release: ---   
Hardware: i386   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2001-09-05 12:46:12 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Rick van Rein 2001-09-05 12:46:07 UTC
From Bugzilla Helper:
User-Agent: Mozilla/4.75 [en] (X11; U; Linux 2.2.16-22 i686)

Description of problem:
Due to endianity, a hexdump of words usually means the bytes in a file get
swapped around when hexdump prints words, in an order like 2211 4433
6655... which requires hopping over the numbers in a hard-to-do-well
scheme. Please allow for a byte-by-byte hexdump option in addition to
current dumping options; hexdumps can now only made per word.


How reproducible:
Always

Steps to Reproduce:
bash$ uname -m
i586
bash$ echo "ABCD" | hexdump
bash$  echo -n "ABCD" | hexdump
0000000 4241 4443
0000004
bash$ 

Actual Results:  See what I entered between the commandlines.

Expected Results:  bash$  echo -n "ABCD" | hexdump
0000000 41 42 43 44
0000004
bash$ echo -n "ABCD" | hexdump -x
0000000    4241    4443
0000004


Additional info:

The -x option now is doing nothing, it just confirms the default
word-printing.
Perhaps the default should be byte-by-byte, to make the hexdump more
trustworthy
when parsing files?

Application I was working on: mastering the format of PGP files, as
specified in RFC2440.
In the past, the same problem showed up when parsing DNS message packets.

Comment 1 Elliot Lee 2002-01-04 18:17:56 UTC
You can do all this with format strings.

A crude example:
hexdump -e '8/1 "%02x " "\n"' /foo/bar

If you want an option added to make this more convenient, please talk to the
util-linux maintainers (util-linux.no). I would guess that there is not
a huge demand for it