X-Recipient: archive-cygwin AT delorie DOT com X-SWARE-Spam-Status: No, hits=-3.2 required=5.0 tests=AWL,BAYES_00,J_CHICKENPOX_64,RCVD_IN_DNSWL_LOW,SPF_HELO_PASS,SPF_PASS,UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: Eric Blake Subject: Re: [BUG 1.7] Read-only files are not. Date: Thu, 1 Jan 2009 00:06:40 +0000 (UTC) Lines: 30 Message-ID: References: <495C00DF DOT 5020208 AT acm DOT org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit User-Agent: Loom/3.14 (http://gmane.org/) X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: 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 David Rothenberger acm.org> writes: > > It seems that read-only files in Cygwin 1.7 are not truly > read-only. The sequence of steps below shows that "chmod 444 file1" > does not make the file read-only in Cygwin 1.7, while it does in > Cygwin 1.5. It may have something to do with the Read Only DOS > attribute. This is set by Cygwin 1.5 but not by Cygwin 1.7. If I > manually set it for Cygwin 1.7, the file does become read-only. Are you perchance running as an Administrator, and therefore you have backup privileges? If so, then you have root-like power, and cygwin exposes that by opening files with intent to backup even when the ACLs would otherwise make the file unreadable. Therefore, even though none of S_IRUSR, S_IRGRP, S_IROTH are set in the posixy st_mode bits, access(file, R_OK) returns 0 and open() is able to exploit your root-like powers to read that file. I thought Corinna mentioned this in the release notes. > > (This issue was brought to my attention by a failing subversion test > after building for 1.7.) The findutils testsuite also had to make accomodations to skip certain tests when run with root-like privileges. -- Eric Blake -- 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/