[Rpm-maint] [PATCH] Only process regular files when generating build-ids
pmatilai at redhat.com
Thu Jan 5 12:33:17 UTC 2017
On 01/05/2017 02:08 PM, Mark Wielaard wrote:
> On Thu, Jan 05, 2017 at 12:27:52PM +0200, Panu Matilainen wrote:
>> It looks commit bbfe1f86b2e4b5c0bd499d9f3dd9de9c9c20fff2 intends to skip
>> symlinks since it filters on S_ISREG(), but since uses fstat()
>> on already open()'ed file it ends up stat()'ing the symlink target.
>> Flip stat() + open() around and use lstat() instead to fix it.
> Oops. You are right.
> I think I was trying to guard for TOCTOU (time of check time of use)
> issues (where the file might change between the stat check and the open
Ok, thanks for confirming.
> I think just changing fstat into an lstat without flipping the
> open/stat around would also do the right thing (given that the lstat
> will be on the diskPath not the fd). But that would be the TOCTOU in
> reverse of course. And I assume that if the build dir is still
> changing at this point we have other issues creating the file list.
Yup, that'd also work of course but opening files that we will be
skipping seems wasteful/redundant/silly :) Nobody is supposed to be
messing around rpm's back in the build directories so you generally
don't need to worry about concurrency there.
- Panu -
More information about the Rpm-maint