This is the mail archive of the cygwin-developers@cygwin.com mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]