0

In the man page for the GNU version of find, at the end of the EXPRESSIONS: ACTIONS: -printf section, is the following perplexing line:

A '%' at the end of the format argument causes undefined behaviour since there is no following character. In some locales, it may hide your door keys, while in others it may remove the final page from the novel you are reading.

I like the imagery, but what the does this actually mean? The find utility does not actually allow such a printf argument to be processed:

> find -printf "%"
find: error: % at end of format string
azorin
  • 1
  • 1

1 Answers1

0

Inspection of the source code for reasonably recent versions of GNU find shows that it checks for this condition (a trailing %) and aborts with the error you indicate, so the excerpt from the man page appears to be nonsense.

I honestly can't imagine it ever behaved otherwise, so I doubt this excerpt was ever true.

My best guess is that the person writing the documentation somehow got it into their head that find's printf formats were somehow passed directly to the C library's printf function (which is ridiculous) and that the C library code might take some bizarre, locale-dependent action (which also seems ridiculous).

K. A. Buhr
  • 45,621
  • 3
  • 45
  • 71