X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: AhsEAKIcKE7QB6CdkWdsb2JhbABUhEqUFI4PfRQBAQEBFBIUJYh8qyORBYErhAQwXwSHVZApFYtW Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8" Subject: RE: [ -w filename ] returns true when permissions are -r--r--r-- Date: Thu, 21 Jul 2011 07:43:10 -0500 Message-ID: <2BF01EB27B56CC478AD6E5A0A28931F202EC7114@A1DAL1SWPES19MB.ams.acs-inc.net> In-Reply-To: <4E271C9E.3060408@redhat.com> References: <4E271C9E DOT 3060408 AT redhat DOT com> From: "Nellis, Kenneth" To: Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id p6LChUsx025690 > 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 $ --Ken Nellis