file times still not quite right with 1.5.14 on Windows 98

Josef Drexler nospam0405@joesbox.cjb.net
Sun Apr 3 18:29:00 GMT 2005


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.  Even if this was unix, the inode hasn't changed so even then 
ctime should be preserved.  I've verified these filetimes by looking at 
the filetimes using Windows Explorer, the "last modified" time is 14:05 
and the "created" time is 14:16.

This breaks `make' because it assumes the file is old and the targets 
that depend on it don't need remaking even when the file has changed.

But if I create a new file instead of appending, it works:

BASH-2.05b$ echo > versiond.h
BASH-2.05b$ ls -l versiond.h
-rw-r--r--  1 Josef Josef 1 Apr  3 14:16 versiond.h
BASH-2.05b$ ls -l --time=ctime versiond.h
-rw-r--r--  1 Josef Josef 1 Apr  3 14:16 versiond.h

As expected, both mtime and ctime are the same now.

-- 
    Josef Drexler                 |       http://jdrexler.com/home/
---------------------------------+----------------------------------------
  Please help Conserve Gravity    |  Email address is *valid*.
  Boycott multistory buildings.   |  Don't remove the "nospam" part.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: cygcheck-1.5.14.txt
URL: <http://cygwin.com/pipermail/cygwin/attachments/20050403/9fe21be0/attachment.txt>
-------------- next part --------------
--
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/


More information about the Cygwin mailing list