Pádraig Brady <[email protected]> writes:

> On 20/11/2026 21:39, Collin Funk wrote:
>> I was looking at this one a bit yesterday (didn't have anything close to
>> a patch being finished, so don't worry about that), and wanted to see if
>> FTS_NOSTAT could be used to avoid stat'ing twice where O_PATH is
>> available. I guess it doesn't matter too much in practice. It is a
>> larger refactoring that can probably just be done later.
>
> Oh good point. I'll have a look at that optimization.

NP. My thinking was to enable FTS_NOSTAT always, and then just handle
the stat in adjust_file_mode(). Perhaps it is just me, but I find that
conditionally using FTS_NOSTAT as src/chown-core.c does require a bit
more careful thought.

FTS_NOSTAT still does stat command-line arguments, though. I was
conflicted about whether it was worth handling the FTS_ROOTLEVEL case or
not, to avoid stat.

>> Also, I didn't love calling it a bug given that O_PATH and AT_EMPTY_PATH
>> are Linux-isms, meaning that the bug, i.e., the second lookup, occurs
>> everywhere else. Maybe that can be mentioned in the NEWS entry, if it
>> can be done without making it too wordy?
> Well I only did a quick search on FreeBSD and it seems
> these are available since 13.1 (2022), but I have not tested there.
> I will test there and make the NEWS less Linux specific.

True, I am probably just splitting hairs. 2022 is relatively new. The
'shred' races, e.g., were also because the program was written before
openat existed. I felt less bad about calling those bugs since we were a
bit later in that case. :)

Collin

Reply via email to