delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/04/03/15:28:25

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
From: ericblake AT comcast DOT net (Eric Blake)
To: cygwin AT cygwin DOT com
Subject: Re: file times still not quite right with 1.5.14 on Windows 98
Date: Sun, 03 Apr 2005 19:28:19 +0000
Message-Id: <040320051928.8840.425043D3000CBC800000228822007340760A050E040D0C079D0A@comcast.net>
X-Authenticated-Sender: ZXJpY2JsYWtlQGNvbWNhc3QubmV0

> 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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019