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: [ -w filename ] returns true when permissions are -r--r--r--


On Jul 21 14:51, Larry Hall (Cygwin) wrote:
> On 7/21/2011 9:31 AM, Corinna Vinschen wrote:
> >On Jul 21 07:43, Nellis, Kenneth wrote:
> >>>From: Eric Blake
> >>>On 07/20/2011 12:05 PM, Reid Thompson wrote:
> >>>>Is this broken?  Or a known windows/cygwin discrepancy?  Or am I
> >>>missing
> >>>>something with my posix/windows file permissions settings
> >>>
> >>>If you are running as an administrator, that might explain it.  Admins
> >>>can alter any file regardless of permissions, in which case [ -w is
> >>>telling you the truth that under your current uid, you can indeed write
> >>>to the file.
> >>>
> >>>This is a feature of access(file,W_OK), and not a bug.
> >>
> >>FWIW, I'm not running as administrator and I'm running 1.7.9, and I'm
> >>seeing the same thing:
> >>
> >>$ touch afile
> >>$ chmod 444 afile
> >>$ ls -l
> >>total 0
> >>-r--r--r-- 1 knellis knellis 0 Jul 21 08:36 afile
> >>$ [ -w afile ]&&  echo writable || echo not writable
> >>writable
> >>$ echo abc>>  afile
> >>$ cat afile
> >>abc
> >>$ ls -l
> >>total 1
> >>-r--r--r-- 1 knellis knellis 4 Jul 21 08:37 afile
> >>$
> >
> >What system?  XP, Vista?  7?
> >What's the output of `id'?
> 
> Or even <http://cygwin.com/snapshots/>. ;-)

In this case I don't think so.  I can't reproduce this with 1.7.9
either, unless the SE_BACKUP_NAME privilege is in the user token and
can be enabled by Cygwin.  This is usually only the case if the user
is member of the Administrators group and the shell is not running
with a restricted token (UAC).


Corinna

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

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


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