Skip to content

hexdump: -e is rejected and -f is silently ignored; repeated lines are never squeezed, 2-byte modes drop a trailing odd byte, and multiple files restart offsets instead of forming one stream #1373

Closed

Description

@caomengxuan666

Probe-verified (same-source mingw+Wine harness, two runs; oracle: util-linux hexdump from bsdextrautils 2.39.3, installed for this verification wave). Five divergences in src/commands/hexdump.cpp:

  1. -e is rejected. hexdump -e '1/1 "%02x\n"' f → WinuxCmd: hexdump: -e format strings are not yet supported, exit 1. GNU applies the format (one hex byte per line).
  2. -f is silently ignored. hexdump -f fmt f (fmt contains 1/1 "%02x\n") → WinuxCmd exits 0 and prints the default dump, as if no format file were given. GNU applies the file's formats. This is the dangerous face: a documented option quietly does nothing.
  3. No squeeze. 48 identical bytes → WinuxCmd prints all three 16-byte lines; GNU prints one line, then *.
  4. 2-byte modes drop a trailing odd byte. hexdump -x on the 5-byte file abcde → WinuxCmd prints groups for ab and cd only; the final e vanishes (GNU prints it as a 0065 group). Data loss in the dump itself.
  5. Multiple files are separate streams. hexdump f1 f2 (16 bytes each) → WinuxCmd restarts offsets at 0000000 for f2 and ends at 0000010; GNU continues one stream (offsets to 0000020).

Expected (util-linux hexdump)

The format-string engine (-e/-f) is the core of the tool; repeated lines collapse to *; a trailing partial unit is printed padded; operands form one continuous stream with running offsets.

Regression seed

In-repo tests named with this issue number: the five probes above with byte-exact expected output.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugcompat-gap

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions