This is the mail archive of the
cygwin
mailing list for the Cygwin project.
NTFS write-protect flag translation (tar? rsync?) only one-way?
- From: "Christian Gelinek" <cgelinek at radlogic dot com dot au>
- To: <cygwin at cygwin dot com>
- Date: Tue, 5 Apr 2011 17:06:11 +0930
- Subject: NTFS write-protect flag translation (tar? rsync?) only one-way?
Hi everyone,
I have a problem with the tar command with the "extract permissions
information" option being set.
I am running Cygwin (CYGWIN_NT-6.1-WOW64 1.7.8(0.236/5/3) 2011-03-01 09:36)
under Windows 7 (Windows 7 Professional N Ver 6.1 Build 7600) with NTFS and
the CYGWIN=ntsec environment variable.
It appears that when tar reads files for adding to archives, it correctly
interprets the Windows-set "R" attribute, which is also seen by ls under
Cygwin. After extracting the files using tar though, only Cygwin's ls
command seems to be aware of the read-only attribute; the attrib command (as
well as Explorer and other Windows-apps) see and handle the file as being
writeable.
There are some rather old posts in the archives stating the same (or
similar) problems, but I couldn't find anything suggesting that there is
anything wrong with my setup:
http://sourceware.org/ml/cygwin/2002-05/msg00317.html
I think this problem also applies to the rsync command, but I haven't tested
it to that extent.
Please see the following sequence of commands, partly in a Cygwin shell,
partly in a Windows CMD shell:
=== Cygwin ===
cgelinek@gar ~/permission-test
$ echo "I'll be write-protected" > wp.txt
cgelinek@gar ~/permission-test
$ echo "I'll be writable" > rw.txt
cgelinek@gar ~/permission-test
$ ls -l
total 2
-rw-r--r-- 1 cgelinek None 17 Apr 5 16:36 rw.txt
-rw-r--r-- 1 cgelinek None 24 Apr 5 16:35 wp.txt
=== CMD ===
C:\cygwin\home\cgelinek\permission-test>attrib
A C:\cygwin\home\cgelinek\permission-test\rw.txt
A C:\cygwin\home\cgelinek\permission-test\wp.txt
C:\cygwin\home\cgelinek\permission-test>attrib +R wp.txt
C:\cygwin\home\cgelinek\permission-test>attrib
A C:\cygwin\home\cgelinek\permission-test\rw.txt
A R C:\cygwin\home\cgelinek\permission-test\wp.txt
=== Cygwin ===
cgelinek@gar ~/permission-test
$ ls -l
total 2
-rw-r--r-- 1 cgelinek None 17 Apr 5 16:36 rw.txt
-r--r--r-- 1 cgelinek None 24 Apr 5 16:35 wp.txt
cgelinek@gar ~/permission-test
$ tar -pcf files.tar rw.txt wp.txt
cgelinek@gar ~/permission-test
$ tar -pxf files.tar
cgelinek@gar ~/permission-test
$ ls -l
total 14
-rw-r--r-- 1 cgelinek None 10240 Apr 5 16:39 files.tar
-rw-r--r-- 1 cgelinek None 17 Apr 5 16:36 rw.txt
-r--r--r-- 1 cgelinek None 24 Apr 5 16:35 wp.txt
=== CMD ===
C:\cygwin\home\cgelinek\permission-test>attrib
A C:\cygwin\home\cgelinek\permission-test\files.tar
A C:\cygwin\home\cgelinek\permission-test\rw.txt
A C:\cygwin\home\cgelinek\permission-test\wp.txt
Any suggestions or pointers on how to solve this would be appreciated.
Regards,
Christian
--
Problem reports: http://cygwin.com/problems.html
FAQ: http://cygwin.com/faq/
Documentation: http://cygwin.com/docs.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple