delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/07/21/09:32:41

X-Recipient: archive-cygwin AT delorie DOT com
X-Spam-Check-By: sourceware.org
Date: Thu, 21 Jul 2011 15:31:48 +0200
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: [ -w filename ] returns true when permissions are -r--r--r--
Message-ID: <20110721133148.GL15150@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <4E271C9E DOT 3060408 AT redhat DOT com> <2BF01EB27B56CC478AD6E5A0A28931F202EC7114 AT A1DAL1SWPES19MB DOT ams DOT acs-inc DOT net>
MIME-Version: 1.0
In-Reply-To: <2BF01EB27B56CC478AD6E5A0A28931F202EC7114@A1DAL1SWPES19MB.ams.acs-inc.net>
User-Agent: Mutt/1.5.21 (2010-09-15)
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 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'?


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

- Raw text -


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