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

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
Message-ID: <425049DA.8090803@joesbox.cjb.net>
Date: Sun, 03 Apr 2005 15:54:02 -0400
From: Josef Drexler <nospam0405 AT joesbox DOT cjb DOT net>
User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206)
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: file times still not quite right with 1.5.14 on Windows 98
References: <040320051928 DOT 8840 DOT 425043D3000CBC800000228822007340760A050E040D0C079D0A AT comcast DOT net>
In-Reply-To: <040320051928.8840.425043D3000CBC800000228822007340760A050E040D0C079D0A@comcast.net>
X-IsSubscribed: yes

Eric Blake wrote:
> I wrote:
>> 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.

Oh, I have no problem with ctime changing, but mtime not changing is
definitely a bug in cygwin.  It must somehow intentionally copy the old
mtime when a file is modified.  If I repeat the sequence I posted using 
DOS tools instead of cygwin to modify the file, the mtime is updated 
correctly:

D:\>bash
BASH-2.05b$ date
Sun Apr  3 15:43:12 EDT 2005
BASH-2.05b$ ls -l versiond.h
-rw-r--r--  1 Josef Josef 13 Apr  3 14:16 versiond.h
BASH-2.05b$ ls -l --time=ctime versiond.h
-rw-r--r--  1 Josef Josef 13 Apr  3 14:16 versiond.h
BASH-2.05b$ exit
exit

D:\>echo >> versiond.h

D:\>bash
BASH-2.05b$ ls -l versiond.h
-rw-r--r--  1 Josef Josef 25 Apr  3 15:43 versiond.h
BASH-2.05b$ ls -l --time=ctime versiond.h
-rw-r--r--  1 Josef Josef 25 Apr  3 14:16 versiond.h

Now the mtime is correctly updated, which it isn't when using bash's 
echo builtin.

I can only guess that when cygwin is changing the ctime, it first reads 
the old mtime and preserves it instead of changing it as well.  But I've 
never looked at the cygwin internals so I don't know what's happening in 
detail, although I'll be happy to help with the debugging, given some 
pointers in where to look.

-- 
    Josef Drexler                 |       http://jdrexler.com/home/
---------------------------------+----------------------------------------
  Please help Conserve Gravity    |  Email address is *valid*.
  Play Chess, not Basketball.     |  Don't remove the "nospam" 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/

- Raw text -


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