delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/2001/08/13/17:12:51

Mailing-List: contact cygwin-developers-help AT sourceware DOT cygnus DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-developers-subscribe AT sources DOT redhat DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin-developers/>
List-Post: <mailto:cygwin-developers AT sources DOT redhat DOT com>
List-Help: <mailto:cygwin-developers-help AT sources DOT redhat DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-developers-owner AT sources DOT redhat DOT com
Delivered-To: mailing list cygwin-developers AT sources DOT redhat DOT com
Message-ID: <3B783E6E.2546DF0@ece.gatech.edu>
Date: Mon, 13 Aug 2001 16:54:06 -0400
From: Charles Wilson <cwilson AT ece DOT gatech DOT edu>
X-Mailer: Mozilla 4.7 [en] (X11; I; SunOS 5.8 sun4u)
X-Accept-Language: en
MIME-Version: 1.0
To: cygwin-developers AT cygwin DOT com
Subject: readonly, NTFS, and file metadata

There is an ongoing thread on the automake list (started by yours truly,
agent provocateur) concerning some strangeness I've encountered on
NTFS(ntsec), with 'cp -p' and readonly files.  The URL for the beginning
of the relevant portion of the thread is:

http://sources.redhat.com/ml/automake/2001-08/msg00053.html

but basically the problem is:

On linux, this works:
$ touch foo
$ ls -l foo
-rw-r--r--    1 cwilson  cwilson         0 Aug 12 15:44 foo 
$ chmod a-w foo
$ ls -l foo
-r--r--r--    1 cwilson  cwilson         0 Aug 12 15:44 foo

Now, I shouldn't be able to modify the file. Wait one minute, and then:

$ touch foo
$ ls -l foo
-r--r--r--    1 cwilson  cwilson         0 Aug 12 15:45
foo                                                                 


Notice that the file access time changed.  This is works on linux 
(perhaps because the file metadata is treated as a property of the 
directory, not the file itself?)  However, on cygwin, the preceeding 
experiment fails:

$ touch foo
-rw-rw-r-- 1 cwilson cwilson 0 Aug 12 15:49 foo
$ chmod a-w foo
-r--r--r-- 1 cwilson cwilson 0 Aug 12 15:49 foo
$ touch foo
touch: creating `foo': Permission denied

This discrepancy causes a problem when you do:

$ ls -l
-r--r--r-- 1 cwilson cwilson 0 Aug 12 15:49 foo
$ cp -p foo bar
cp: preserving times for `....': Permission denied.

What happens is this: first, foo is copied to bar, with perms
-r--r--r--.  But, the timestamp is wrong.  Since cp was called with
'-p', cp then tries to set the timestamp of bar to match foo.  But it
can't on cygwin.  On linux, it can.

My suggestion to the automake list, which was to make foo be -rw-r--r--,
was not well received.  The suggestion in return was: make cygwin act
like linux.  I can't really argue against that, since that's been our
stated goal anyway.

Does anybody know offhand what it would take to 'linux-ize' this
behavior (e.g. would we have to take a performance hit?)  Do we want to
be like linux in this particular? Also, please check the thread
referenced above.

Thx,
Chuck

- Raw text -


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