hexdump `_u` conversion outputs ambiguous string.

Bug #1842908 reported by agc
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
bsdmainutils (Ubuntu)
New
Undecided
Unassigned

Bug Description

Output hex codes for 12 and 255, then convert it to binary, and dump these using hexdump's '_u' conversion string, (_u means output US ASCII characters):

    printf '%.2x\n' 12 255 | xxd -r -p | hexdump -v -e '/1 " _%_u\_\n"'

Output:

     _ff_
     _ff_

Expected result would be two different strings, (maybe "FF" for the first one?), or failing that, to document this ambiguity in 'man hexdump'.

Note that some format strings like '_p' are quite non-specific, and output all non-printing chars as a '.', and that's to be expected. But for '_u' this is not expected, and the above is the only instance of ambiguous output, as shown by:

    printf '%.2x\n' {0..255} | xxd -r -p | \
    hexdump -v -e '/1 " _%_u\_\n"' | \
    sort | uniq -c | sort -nr | head -2

Output (i.e. the only duplicate is 'ff'):

      2 _ff_
      1 _Z_

Hope this helps...

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.