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: file times still not quite right with 1.5.14 on Windows 98


> Despite posting yesterday that utime() worked in the snapshot (and now 
> 1.5.14), cygwin now doesn't quite do the right thing with file times in 
> 1.5.14.
> 
> Whenever a file is being appended to or rewritten by truncating an 
> existing file (as opposed to deleting and creating a new file), the 
> mtime field is not updated, but the ctime field is updated instead.  It 
> should be the other way round, because this totally breaks `make'.
> 
> I noticed the problem first when `nasm' didn't update the filetimes of 
> its output files, but it can easily be reproduced with bash:
> 
> BASH-2.05b$ date
> Sun Apr  3 14:16:08 EDT 2005
> BASH-2.05b$ ls -l versiond.h
> -rw-r--r--  1 Josef Josef 122 Apr  3 14:05 versiond.h
> BASH-2.05b$ ls -l --time=ctime versiond.h
> -rw-r--r--  1 Josef Josef 122 Apr  3 14:05 versiond.h
> 
> So both mtime and ctime are 14:05 at the beginning.  Now I append to the 
> file:
> 
> BASH-2.05b$ echo >> versiond.h
> BASH-2.05b$ ls -l versiond.h
> -rw-r--r--  1 Josef Josef 123 Apr  3 14:05 versiond.h
> BASH-2.05b$ ls -l --time=ctime versiond.h
> -rw-r--r--  1 Josef Josef 123 Apr  3 14:16 versiond.h
> 
> Only the ctime has changed, the mtime (which make looks at) hasn't.  In 
> fact, the ctime shouldn't have changed, because it's creation time on 
> Windows.

The change in cygwin 1.5.13 to make ctime track change-time and not creation-time was intentional.  Yes, this is different from the default Window's behavior, but cygwin is trying to provide a POSIX environment, not a windows environment, and POSIX requires ctime to stand for change time.

The bug is not that ctime was touched, but that mtime was not touched.  Normally, Windows updates mtime automatically if you edit a file, only the ctime needed special treatment from cygwin.  I have no idea why Win98 is not touching the mtime on appending or truncation.

--
Eric Blake



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


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