public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: David Rothenberger <daveroth@acm.org>
To: cygwin <cygwin@cygwin.com>
Subject: [BUG 1.7] Read-only files are not.
Date: Wed, 31 Dec 2008 23:32:00 -0000	[thread overview]
Message-ID: <495C00DF.5020208@acm.org> (raw)

It seems that read-only files in Cygwin 1.7 are not truly
read-only. The sequence of steps below shows that "chmod 444 file1"
does not make the file read-only in Cygwin 1.7, while it does in
Cygwin 1.5. It may have something to do with the Read Only DOS
attribute. This is set by Cygwin 1.5 but not by Cygwin 1.7. If I
manually set it for Cygwin 1.7, the file does become read-only.

(This issue was brought to my attention by a failing subversion test
after building for 1.7.)

----------------------------------------------------------------------
[1.7] % mkdir /tmp/ro-test
[1.7] % cd /tmp/ro-test
[1.7] % ls -ld
drwxr-xr-x+ 1 drothe None 0 Dec 31 15:18 .
[1.7] % touch file1
[1.7] % ls -l
total 0
-rw-r--r-- 1 drothe None 0 Dec 31 15:18 file1
[1.7] % chmod 444 file1
[1.7] % ls -l
total 0
-r--r--r-- 1 drothe None 0 Dec 31 15:18 file1
[1.7] % test -w file1 && echo yes
yes
[1.7] % echo foo > file1
[1.7] % cat file1
foo
[1.7] % attrib file1
A          C:\cygwin-1.7\tmp\ro-test\file1
[1.7] % attrib +r file1
[1.7] % test -w file1 && echo yes
[1.7] % echo bar > file1
bash: file1: Permission denied
[1.7] % cat file1
foo
----------------------------------------------------------------------

Here is the same sequence of steps using Cygwin 1.5.

----------------------------------------------------------------------
[1.5] % mkdir /tmp/ro-test
[1.5] % cd /tmp/ro-test
[1.5] % ls -ld
drwxr-xr-x+ 2 drothe None 0 Dec 31 15:21 .
[1.5] % touch file1
[1.5] % ls -l
total 0
-rw-r--r-- 1 drothe None 0 Dec 31 15:21 file1
[1.5] % chmod 444 file1
[1.5] % ls -l
total 0
-r--r--r-- 1 drothe None 0 Dec 31 15:21 file1
[1.5] % test -w file1 && echo yes
[1.5] % echo foo > file1
bash: file1: Permission denied
[1.5] % cat file1
[1.5] % attrib file1
A    R     C:\cygwin\tmp\ro-test\file1
[1.5] % attrib -r file1
[1.5] % attrib file1
A          C:\cygwin\tmp\ro-test\file1
[1.5] % ls -l
total 0
-r--r--r-- 1 drothe None 0 Dec 31 15:21 file1
[1.5] % test -w file1 && echo yes
yes
[1.5] % echo foo > file1
bash: file1: Permission denied
[1.5] % cat file1

----------------------------------------------------------------------

-- 
David Rothenberger  ----  daveroth@acm.org

toilet toup'\bee, n.:
        Any shag carpet that causes the lid to become top-heavy, thus
        creating endless annoyance to male users.
                -- Rich Hall, "Sniglets"


--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

             reply	other threads:[~2008-12-31 23:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-12-31 23:32 David Rothenberger [this message]
2008-12-31 23:59 ` Christopher Faylor
2009-01-01  1:17   ` David Rothenberger
2009-01-01  0:07 ` Eric Blake
2009-01-01  0:57   ` David Rothenberger
2009-01-01  3:39   ` Christopher Faylor
2009-01-07 14:31     ` 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=495C00DF.5020208@acm.org \
    --to=daveroth@acm.org \
    --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).