Re: Imprecision in documentation of -newer

Bernhard Voelker <[email protected]>
Newsgroups gmane.comp.gnu.findutils.bugs
Message-ID <[email protected]>
On 11/21/20 2:18 PM, Reuben Thomas via Bug reports for the GNU find utilities wrote:
> The manual (current git) says:
> 
> True if the time of the last access (or status change or data modification)
>> of the current file is more recent than that of the last data modification
>> of the @var{reference} file.
>>
> 
> Presumably it really means:
> 
> True if the time of the last access (or status change or data modification)
> of the current file is more recent than that of the @var{reference} file.
> 
> In other words, like is compared with like, it's not always the mtime of
> the reference file that is used.

Yes, it is: the code uses get_stat_mtime() on the reference file
for all 3 variants:

* parse_anewer:
  https://git.savannah.gnu.org/cgit/findutils.git/tree/find/parser.c?id=cc5d59382f#n790

* parse_cnewer:
  https://git.savannah.gnu.org/cgit/findutils.git/tree/find/parser.c?id=cc5d59382f#n825

* parse_newer:
  https://git.savannah.gnu.org/cgit/findutils.git/tree/find/parser.c?id=cc5d59382f#n1513

As such, the documentation is correctly describing find's behavior.

-anewer and -cnewer are a GNU extension, so it's not specified by POSIX
how find should behave.

FWIW: it seems e.g. FreeBSD's find behaves the same.

Have a nice day,
Berny
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.