bug-findutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug #51069] find changes access time on directories


From: James Youngman
Subject: Re: [bug #51069] find changes access time on directories
Date: Sun, 21 May 2017 09:24:20 +0100

On Sun, May 21, 2017 at 6:19 AM, Adesh Kumar <address@hidden> wrote:

> Thanks James Youngman for excellent clarification.
>
>
> I thought "find" uses only stat syscalls, but yeah I can see how that
> cannot help with directory contents. My guess is that for simple tests
> like iname or name, find does not need to read the direcotry list. Is my
> understanding correct?
>

Each directory itself  contains all the names of its children, and they
cannot be enumerated without reading the directory.    This means that your
understanding isn't correct.   See for example
http://www.grymoire.com/Unix/Inodes.html for further information.



> So, what are the filters, other than amin, mmin and the like, for which
> find needs to read the directory contents.
>

Find always reads the directory contents, that's how it searches the file
system.   There is no other way to do it.


> Can you please also explain this for me.
>
>
> Regards,
>
> Adesh
>
> ------------------------------
> *From:* James Youngman <address@hidden>
> *Sent:* 20 May 2017 18:02:16
> *To:* James Youngman; address@hidden; address@hidden
> *Subject:* [bug #51069] find changes access time on directories
>
> Update of bug #51069 (project findutils):
>
>              Assigned to:                    None =>
> jay
>
>     _______________________________________________________
>
> Follow-up Comment #1:
>
> The access time of the directory is being updated by the kernel when find
> reads the directory to search it.  POSIX requires this.
>
> If find offered an extension which saved and restored the st_atime in
> directories, then the step of restoring the st_actime timestamp would
> (unavoidably, I believe, because of the way utimes is specified) update the
> st_ctime timestamp.   That is, if anything, worse.
>
> If you want access times not to be updated, your best bet is to mount the
> file
> system read-only, or (if the kernel is Linux) to use the noatime mount
> option.
>
>     _______________________________________________________
>
> Reply to this item at:
>
>   <http://savannah.gnu.org/bugs/?51069>
>
> _______________________________________________
>   Message sent via/by Savannah
>   http://savannah.gnu.org/
>
>


-- 
--
This email is intended solely for the use of its addressee, sender, and any
readers of a mailing list archive in which it happens to appear.   If you
have received this email in error, please say or type three times, "I
believe in the utility of email disclaimers," and then reply to the author
correcting any spellings (and, optionally, any incorrect spellings),
accompanying these with humorous jests about the author's parentage.   If
you are not the addressee, you are nevertheless permitted to both copy and
forward this email since without such permissions email systems are unable
to transmit email to anybody, intended recipient or not.  To those still
reading by this point, the author would like to apologise for being unable
to maintain a consistent level of humour throughout this disclaimer.
Contents may settle during transit.  Do not feed the animals.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]