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

