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: ls -t changes the cygwin-access time of a file


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

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

Attachment: signature.asc
Description: PGP signature


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