[BusyBox 0000874]: Incorrect output spacing using "hexdump -C"

bugs at busybox.net bugs at busybox.net
Thu May 18 17:30:31 UTC 2006


The following issue has been SUBMITTED. 
====================================================================== 
http://busybox.net/bugs/view.php?id=874 
====================================================================== 
Reported By:                bengardner
Assigned To:                BusyBox
====================================================================== 
Project:                    BusyBox
Issue ID:                   874
Category:                   Other
Reproducibility:            always
Severity:                   trivial
Priority:                   normal
Status:                     assigned
====================================================================== 
Date Submitted:             05-18-2006 10:30 PDT
Last Modified:              05-18-2006 10:30 PDT
====================================================================== 
Summary:                    Incorrect output spacing using "hexdump -C"
Description: 
Using "hexdump -C", the output of a 20-byte file looks like this:
00000000  61 62 63 64 65 66 67 68  69 6a 6b 6c 6d 6e 6f 70 
|abcdefghijklmnop|
00000010  71 72 73 74                                         |qrst|
00000014
(note the extra 2 spaces before the ascii output)

And a 26-byte file looks like this:
00000000  61 62 63 64 65 66 67 68  69 6a 6b 6c 6d 6e 6f 70 
|abcdefghijklmnop|
00000010  71 72 73 74 75 76 77 79  78 7a                     |qrstuvwyxz|
0000001a
(note the extra space before the ascii output)

The problem is that bpad() in dump.c shortens the length of the format
string (from "%02x " to "%2s "), but does not update the nospace pointer,
so the last byte in the 8-byte set is printed as 3 spaces instead of 2
spaces.

A simple fix is to decrease the nospace pointer by the number of
characters removed. A patch that does this is attached.
====================================================================== 

Issue History 
Date Modified   Username       Field                    Change               
====================================================================== 
05-18-06 10:30  bengardner     New Issue                                    
05-18-06 10:30  bengardner     Status                   new => assigned     
05-18-06 10:30  bengardner     Assigned To               => BusyBox         
05-18-06 10:30  bengardner     File Added: libbb-dump-bpad-nospace.diff.txt     
              
======================================================================




More information about the busybox-cvs mailing list