Skip to content

find -printf: %a/%c/%t time directives are missing, unknown directives drop the '%' (GNU keeps it), the 0 flag zero-pads strings, '+' is dropped, and %T@ carries sub-microsecond jitter #1379

Closed

Description

@caomengxuan666

Probe-verified (same-source mingw+Wine harness, two runs, GNU findutils 4.9.0). The -printf implementation in src/commands/find.cpp diverges from GNU find in five measured ways (fixture file pinned to mtime @1600000000 where relevant):

  1. Time directives %a, %c, %t are missing. find . -name f -printf '%a\n' → WinuxCmd prints the literal letter a plus find: warning: unrecognized format directive '%a' on stderr. GNU prints Sun Sep 13 12:26:40.0000000000 2020.
  2. Unknown directives lose the %. -printf '%Q\n' → WinuxCmd prints Q; GNU prints %Q (both emit the same unrecognized-directive warning). Note: the in-repo regression pin for this behavior asserts the WinuxCmd output — the pin itself encodes the anti-GNU expectation and needs flipping with the fix.
  3. The 0 flag zero-pads strings. -printf '%05p|' → WinuxCmd 00./f|; GNU ./f| (0 is ignored for non-numeric conversions; width pads with spaces).
  4. The + flag is dropped. -printf '%+5d|' on a depth-1 file → WinuxCmd 1|; GNU +1|. (The space flag happens to agree.) The in-repo pin likewise encodes the current behavior.
  5. %T@ is imprecise and nondeterministic. Two consecutive runs printed 1599999999.999999400 and 1599999999.999999500 for a file pinned to exactly 1600000000; GNU prints 1600000000.0000000000. (Related format nit: %A@ prints 9 fractional digits, GNU prints 10.)

Expected (GNU find)

The full directive repertoire with ctime-style %a/%c/%t, verbatim % for unknown directives, C-printf flag semantics per conversion kind, and exact epoch rendering.

Regression seed

In-repo tests named with this issue number: the five probes above; the existing anti-GNU pins for faces 2 and 4 are updated to the GNU expectations.

Activity

  1. added
    bug
    compat-gap
    on Oct 26, 2026
  2. caomengxuan666 commented on Oct 27, 2026

    @caomengxuan666
    MemberAuthor

    Fixed by #1400: %a/%c/%t time directives, verbatim '%' for unknown -printf directives (GNU keeps the percent — the pre-existing anti-GNU pin was flipped during verification), C-printf flag semantics per conversion kind (0 ignored for %p, '+' honored for %d), and exact deterministic %T@ epoch rendering. Regression pins issue_1379_* landed with the PR; two pins were corrected to the probe-verified GNU oracle during verification.

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