delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2007/10/30/05:17:01

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Tue, 30 Oct 2007 11:16:32 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: "My Documents" directory not listed as writable?
Message-ID: <20071030101632.GK20400@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <DD74FBB8EE28D441903D56487861CD9D22BDD6FB AT lonpexch01 DOT citrite DOT net>
MIME-Version: 1.0
In-Reply-To: <DD74FBB8EE28D441903D56487861CD9D22BDD6FB@lonpexch01.citrite.net>
User-Agent: Mutt/1.5.16 (2007-06-09)
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On Oct 30 08:11, John Cooper wrote:
> [I'm using Cygwin 1.5.24-2 on Windows XP and Vista]
> 
> Does anyone know why, by default, the "My Documents" directory is not
> listed as writable? :
>   $ ls -ld $USERPROFILE/My\ Documents
>   dr-x------+ 22 John None 0 Oct 20 18:26 C:\Documents and
> Settings\John/My Documents/
> 
> .. even though it actually is writable:
> 
>   $ touch $USERPROFILE/My\ Documents/foo

I tried to find the same situation on my machine and what shall I say?
I found it in my "$USERPROFILE/My Documents" directory.

The ACL of my "My Documents" dir gives me full access, byt Cygwin shows
that the directory is not writable.  When debugging, I found to my
honest surprise that the "My Documents" directory has the good old
"Read-Only" DOS attribute set.

For as long as I'm working on Cygwin's security stuff, the R/O attribute
removes the write bits from the file mode.  What happens in stat(2) is
basically:

  read ACL       ==> st_mode = 0700
  is DOS R/O set ==> st_mode = 0500

Apparently this was never correct for directories(*).  Argh!  Why did
never anybody notice it before?!?

Thanks for the report.  I'll apply a fix in CVS.  For the time being the
best workaround for you would be to remove the R/O attribute from your
"My Documents" directory:

  $ attrib "$USERPROFILE\My Documents"


Corinna


(*) http://msdn2.microsoft.com/en-us/library/aa364944.aspx states:

    "FILE_ATTRIBUTE_READONLY

	A file or directory that is read-only.
	For a file, applications can read the file, but cannot write to
	it or delete it.
	For a directory, applications cannot delete it."


-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Project Co-Leader          cygwin AT cygwin DOT com
Red Hat

--
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/

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019