ls -t changes the cygwin-access time of a file

Corinna Vinschen
Tue Apr 11 08:29:00 GMT 2017

On Apr 11 07:15, Ronald Fischer wrote:
> I'm running on Windows 7 64bit, the disk has NTFS, and I have Windows
> enabled to track the correct file access time.
> With Cygwin, I see the following oddity:
> -0-1- ~/gitwrk/vp5  > ls -lu c:/tmp/x*
> -rw-r--r-- 1 FISRONA Domain Users 10 Apr 11 06:59 c:/tmp/xx
> (waiting a couple of minutes)
> -0-1- ~/gitwrk/vp5  > ls -lut c:/tmp/x*
> -rw-r--r-- 1 FISRONA Domain Users 10 Apr 11 07:01 c:/tmp/xx
> I didn't touch the file in between, but the reported access time
> changed. Further experimentation shows, that the reported access time
> changes as soon as I use the -t option with ls. As long as I just do ls
> -lu, the access time does not change.

No, it changes every time you do an ls -l.  Yes, this is a bug, but it's
a bug in Windows, as old as Windows NT itself.

To fetch stat(2)-like meta information on a file, the caller has to open
the file (NtOpenFile), read the meta data (NtQueryInformationFile /
NtQuerySecurityObject) and close the file again (NtClose).

The problem is this: Even if you open the file explicitely with only
metadata access rights (READ_CONTROL | FILE_READ_ATTRIBUTES |
FILE_READ_EA), the access will count as data access and the file access
timestamp will be bumped.

Sticking to `fsutil behavior set disablelastaccess 1' works better.


Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <>

More information about the Cygwin mailing list