delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2005/10/19/10:33:32

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
To: cygwin AT cygwin DOT com
From: Eric Blake <ebb9 AT byu DOT net>
Subject: Re: please test: coreutils-5.90-3
Date: Wed, 19 Oct 2005 14:23:33 +0000 (UTC)
Lines: 44
Message-ID: <loom.20051019T160122-280@post.gmane.org>
References: <Pine DOT OSF DOT 4 DOT 21 DOT 0510181859340 DOT 2152-101000 AT ax0rm1 DOT roma1 DOT infn DOT it>
Mime-Version: 1.0
User-Agent: Loom/3.14 (http://gmane.org/)
X-IsSubscribed: yes

Angelo Graziosi <Angelo.Graziosi <at> roma1.infn.it> writes:

> 1)
> Using coreutils-5.90-3 I have observed  that the command 'cp -p' does not
> preserve the timestamp of a file:
> 
> $ ls -lrt
> -rw-r--r-- 1 Administrator Administrators    418 Aug  7 18:55 t.c
> 
> $ cp -p t.c t.cpp
> $ ls -lrt
> -rw-r--r-- 1 Administrator Administrators    418 Aug  7 18:55 t.c
> -rw-r--r-- 1 Administrator Administrators    418 Oct 18 19:05 t.cpp
> 
> Reinstalling coreutilis-5.3.0-9 the files have the same timestamps.

As far as I can tell, this is a bug in cygwin.

5.3.0 made the following sequence of calls:
dest_desc = open(dest,...);
write(dest_desc,...);
close(dest_desc);
utimes(dest,...);
chmod(dest,...);

5.90 makes the following sequence of calls:
dest_desc = open(dest,...);
write(dest_desc,...);
utimes(dest,...);  // at this point, timestamp is correct
fchmod(dest_desc,...);
close(dest_desc);  // oops, timestamp changed

I can't see anything in SUSv3 that lets close() change the mtime of an open 
file descriptor that has not been modified since the last utimes() to the same 
underlying file.

Meanwhile, coreutils does check for futimes, and would use that if cygwin were 
to provide it.  That might help, since the problem stems from the fact that the 
utimes() to an open file is being lost on close(), but an futimes() would only 
work on an open file.

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