[Bug 923080] [NEW] hexdump elides a partial last line with asterisk

Ralph Corderoy ralph at inputplus.co.uk
Sat Jan 28 15:17:57 UTC 2012


Public bug reported:

Package bsdmainutils 8.2.3's hexdump(1) says

    -v   Cause hexdump to display all input data.  Without the -v
    option, any number of groups of output lines, which would be
    identical to the immediately preceding group of output lines (except
    for the input offsets), are replaced with a line comprised of a
    single asterisk.

(Aside: "immediately preceding group of output lines" is misleading, the
"*" always indicates just the last printed line is repeated, not a group
of them.)

This suggests it's as coreutils's od's -v/--output-duplicates but it
behaves differently.

    $ printf 0123456789abcdef0 | hd
    00000000  30 31 32 33 34 35 36 37  38 39 61 62 63 64 65 66  |0123456789abcdef|
    *
    00000011
    $

I have to subtract the address before the * from the one after to find
out the number of bytes that are the same as the previous fully-printed
line;  in this case 1, the 0x30 byte.

Note, on some Ubuntus, e.g. 10.10, bsdmainutils 8.0.11ubuntu1, it's
worse as the final offset is incorrect.

    $ printf 0123456789abcdef0 | hd
    00000000  30 31 32 33 34 35 36 37  38 39 61 62 63 64 65 66  |0123456789abcdef|
    *
    00000010
    $

I've no way of knowing how many bytes have been elided.

Here's coreutils's od.

    $ s=0123456789abcdef
    $ printf ${s}0 | od -tx1
    0000000 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66
    0000020 30
    0000021
    $ printf $s$s${s}0 | od -tx1
    0000000 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66
    *
    0000060 30
    0000061
    $

Clearly, hexdump should print the trailing line of bytes in full if it's
an incomplete line just as coreutils's od does;  I shouldn't have to do
arithmetic.  However, if the current behaviour is deemed to be correct
then hexdump(1) needs correcting.

** Affects: bsdmainutils (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Ubuntu
Foundations Bugs, which is subscribed to bsdmainutils in Ubuntu.
https://bugs.launchpad.net/bugs/923080

Title:
  hexdump elides a partial last line with asterisk

Status in “bsdmainutils” package in Ubuntu:
  New

Bug description:
  Package bsdmainutils 8.2.3's hexdump(1) says

      -v   Cause hexdump to display all input data.  Without the -v
      option, any number of groups of output lines, which would be
      identical to the immediately preceding group of output lines (except
      for the input offsets), are replaced with a line comprised of a
      single asterisk.

  (Aside: "immediately preceding group of output lines" is misleading, the
  "*" always indicates just the last printed line is repeated, not a group
  of them.)

  This suggests it's as coreutils's od's -v/--output-duplicates but it
  behaves differently.

      $ printf 0123456789abcdef0 | hd
      00000000  30 31 32 33 34 35 36 37  38 39 61 62 63 64 65 66  |0123456789abcdef|
      *
      00000011
      $

  I have to subtract the address before the * from the one after to find
  out the number of bytes that are the same as the previous fully-printed
  line;  in this case 1, the 0x30 byte.

  Note, on some Ubuntus, e.g. 10.10, bsdmainutils 8.0.11ubuntu1, it's
  worse as the final offset is incorrect.

      $ printf 0123456789abcdef0 | hd
      00000000  30 31 32 33 34 35 36 37  38 39 61 62 63 64 65 66  |0123456789abcdef|
      *
      00000010
      $

  I've no way of knowing how many bytes have been elided.

  Here's coreutils's od.

      $ s=0123456789abcdef
      $ printf ${s}0 | od -tx1
      0000000 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66
      0000020 30
      0000021
      $ printf $s$s${s}0 | od -tx1
      0000000 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 66
      *
      0000060 30
      0000061
      $

  Clearly, hexdump should print the trailing line of bytes in full if it's
  an incomplete line just as coreutils's od does;  I shouldn't have to do
  arithmetic.  However, if the current behaviour is deemed to be correct
  then hexdump(1) needs correcting.

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/bsdmainutils/+bug/923080/+subscriptions




More information about the foundations-bugs mailing list