This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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'),
> right?
> 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.

> Will
> 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
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]