X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=1.9 required=5.0 tests=AWL,BAYES_50,TW_PX X-Spam-Check-By: sourceware.org From: "Christian Gelinek" To: Subject: NTFS write-protect flag translation (tar? rsync?) only one-way? Date: Tue, 5 Apr 2011 17:06:11 +0930 Message-ID: <003c01cbf364$23257e50$69707af0$@com.au> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit x-cr-hashedpuzzle: CPcP CyjP EvEE E4X2 FLm1 FRkY FXWU Gh1e Gxjw HMXr H2Vw IXov JOLA JkNF KPh+ LgqS;1;YwB5AGcAdwBpAG4AQABjAHkAZwB3AGkAbgAuAGMAbwBtAA==;Sosha1_v1;7;{AA95D1FE-483A-4518-902E-E50E763F6208};YwBnAGUAbABpAG4AZQBrAEAAcgBhAGQAbABvAGcAaQBjAC4AYwBvAG0ALgBhAHUA;Tue, 05 Apr 2011 07:36:09 GMT;TgBUAEYAUwAgAHcAcgBpAHQAZQAtAHAAcgBvAHQAZQBjAHQAIABmAGwAYQBnACAAdAByAGEAbgBzAGwAYQB0AGkAbwBuACAAKAB0AGEAcgA/ACAAcgBzAHkAbgBjAD8AKQAgAG8AbgBsAHkAIABvAG4AZQAtAHcAYQB5AD8A x-cr-puzzleid: {AA95D1FE-483A-4518-902E-E50E763F6208} X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com 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 AT gar ~/permission-test $ echo "I'll be write-protected" > wp.txt cgelinek AT gar ~/permission-test $ echo "I'll be writable" > rw.txt cgelinek AT 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 AT 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 AT gar ~/permission-test $ tar -pcf files.tar rw.txt wp.txt cgelinek AT gar ~/permission-test $ tar -pxf files.tar cgelinek AT 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