public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: "Christian Gelinek" <cgelinek@radlogic.com.au>
To: <cygwin@cygwin.com>
Subject: NTFS write-protect flag translation (tar? rsync?) only one-way?
Date: Tue, 05 Apr 2011 13:04:00 -0000	[thread overview]
Message-ID: <003c01cbf364$23257e50$69707af0$@com.au> (raw)

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

             reply	other threads:[~2011-04-05  7:37 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-04-05 13:04 Christian Gelinek [this message]
2011-04-05 21:46 ` Larry Hall (Cygwin)
2011-04-06  6:16 Christian Gelinek
2011-04-06  6:54 ` Larry Hall (Cygwin)
2011-04-07  6:01   ` Christian Gelinek
2011-04-18 10:25   ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='003c01cbf364$23257e50$69707af0$@com.au' \
    --to=cgelinek@radlogic.com.au \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).