Skip to content

od: output differs when previous files fail #15530

Closed

Description

@Devel08

Maybe that could be a bug in GNU?

GNU:

$ od qwe /dev/mem src renovate.json
od: qwe: No such file or directory
od: /dev/mem: Permission denied
od: src: Is a directory
0000000 005173 021011 074145 062564 062156 021163 020072 005133
0000020 000000 000000 000000 000000 000000 000000 000000 000000
0000040

uutils:

$ cargo run -q od qwe /dev/mem src renovate.json
od: qwe: No such file or directory
od: /dev/mem: Permission denied
od: src: Is a directory
0000000 005173 021011 074145 062564 062156 021163 020072 005133
0000020 004411 061442 067157 064546 035147 062562 067543 066555
0000040 067145 062544 021144 004412 005135 005175

Activity

  1. fixfon commented on Oct 31, 2026

    @fixfon
    Contributor

    I checked this against GNU coreutils 9.12, and I think the data difference is on the GNU side.

    Smaller repro, no JSON needed:

    mkdir d
    printf 'abcdefghijklmnopqrstuvwxyz0123456789\n' > f
    od d f
    od f
    

    GNU od 9.12 with od d f prints the first 16 bytes of f, then a line of zeros, and stops at 0000040. Running od f on its own dumps all 37 bytes and ends at 0000045. So once the directory operand fails, GNU loses the rest of the data from the next file. uutils prints the full dump of f here, the same as od f, which looks like the correct behavior to me.

    The missing final offset line is a separate issue, tracked in #15990 (#16035 is working on it).

    So I'd keep uutils as it is for the data part, and the GNU behavior is probably worth reporting upstream.

  2. Devel08 commented on Oct 31, 2026

    @Devel08
    SponsorContributorAuthor

    2. I checked this against GNU coreutils 9.12, and I think the data difference is on the GNU side.
    Smaller repro, no JSON needed:
    mkdir d printf 'abcdefghijklmnopqrstuvwxyz0123456789\n' > f od d f od f

        GNU od 9.12 with `od d f` prints the first 16 bytes of `f`, then a line of zeros, and stops at 0000040. Running `od f` on its own dumps all 37 bytes and ends at 0000045. So once the directory operand fails, GNU loses the rest of the data from the next file. uutils prints the full dump of `f` here, the same as `od f`, which looks like the correct behavior to me.
        The missing final offset line is a separate issue, tracked in [#15990](https://github.com/uutils/coreutils/issues/15990) ([#16035](https://github.com/uutils/coreutils/pull/16035) is working on it).
        So I'd keep uutils as it is for the data part, and the GNU behavior is probably worth reporting upstream.
    

    Thank you, I'm on the same opinion, I'll report that to upstream :)

  3. Devel08 commented on Oct 31, 2026

    @Devel08
    SponsorContributorAuthor

    It seems that Anthropic's OSS scanner found out about that before me, anyways, fixed upstream in coreutils/coreutils@171b53a

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

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions