This is the mail archive of the
mailing list for the Cygwin project.
Re: find command seems to lock files
On 8/19/2019 1:21 PM, Morten Kjærulff wrote:
> I guess that the reason find opens the file (and thereby trigger
> antivirus) is because I print the files timestamp (-printf '%A+\n'),
> If I just printed the filename, the file would not be opened, right?
I wouldn't say it _opens_ the file, but I read through the Posix man
page for stat/lstat/fstatat and it reveals that those calls update
the last access time in the inode, so that access the file "more"
than just getting some information from the directory.
> find /xx -type f -iname "zzz" -mtime +10s -execdir 'msg * "Achtung
> programme crash boom!"'
> not open the file to get the timestamp?
It still needs to look at the timestamps, and presumably
needs stat to do that. All you can get from the directory
proper is the inode number and the name, I believe. That is
not even enough for find to know whether it has to recurse
into the thing (is it a directory or not?), so I suspect
that find always does a stat call on every entry.
Regards - EM
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple