Skip to content

hexdump -b: one extra trailing space on short lines vs util-linux hexdump (GNU bash printf.tests padding) #1133

Closed

Description

@caomengxuan666

Reproduction (WinuxCmd hexdump 1.0.6, compare with util-linux hexdump on GNU):

$ printf 'AB\n' | hexdump -b | cat -A
GNU (util-linux):   0000000 101 102 012                                                    $
WinuxCmd 1.0.6:     0000000 101 102 012                                                     $

Expected: line content 0000000 101 102 012 padded with trailing spaces to the same total line width as util-linux hexdump (short lines are space-padded so all output lines align). WinuxCmd emits exactly ONE extra trailing space on short (< 16-byte) lines; 16-byte full lines match.

Impact: GNU bash's tests/printf.tests pipes printf '%lc'/%ls output into hexdump -b; the rubash-side baseline uses WinuxCmd hexdump, and every short dump line diverges by one trailing space (30 diff lines in the current run) even though the byte content is identical.

Verified: diffing gnu.out vs rb.out with trailing whitespace stripped yields zero differences. Rubash artifacts: target/issue-suites/results/true-baseline/printf/{gnu.out,rb.out} in the rubash repo; classifying probe: printf 'AB\n' | hexdump -b | cat -A on both sides.

Fix target: the -b (one-byte-octal) display's per-line padding width; util-linux pads the octal-display line to the same width regardless of how many bytes are present (the padding is to the FULL 16-slot display width, and the byte count and column alignment otherwise match).

Activity

  1. added
    bug
    compat-gap
    on Sep 28, 2026
  2. caomengxuan666 commented on Sep 29, 2026

    @caomengxuan666
    MemberAuthor

    已修(PR #1136):-b/-c 行宽对齐 util-linux 固定 71 列(16 槽去掉最后一个尾随空格),1/2/4/16 字节样本与 GNU 逐字节一致。

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugcompat-gap

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions