This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: "My Documents" directory not listed as writable?


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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]