www.delorie.com/archives/browse.cgi | search |
X-Recipient: | archive-cygwin AT delorie DOT com |
X-SWARE-Spam-Status: | No, hits=-1.7 required=5.0 tests=AWL,BAYES_00 |
X-Spam-Check-By: | sourceware.org |
Message-ID: | <4A9580FE.9080901@t-online.de> |
Date: | Wed, 26 Aug 2009 20:37:50 +0200 |
From: | Christian Franke <Christian DOT Franke AT t-online DOT de> |
User-Agent: | Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.21) Gecko/20090403 SeaMonkey/1.1.16 |
MIME-Version: | 1.0 |
To: | cygwin AT cygwin DOT com |
Subject: | Inconsistent setting of readonly attribute in 1.7 ? |
X-IsSubscribed: | yes |
Mailing-List: | contact cygwin-help AT cygwin DOT com; run by ezmlm |
List-Id: | <cygwin.cygwin.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 |
If ACLs are used, Cygwin 1.7 chmod() does never set R/O attribute, but open() sets it if a R/O file is created: $ touch test1 $ chmod a=r test1 $ cp -p test1 test2 $ ls -l test1 test2 -r--r--r-- 1 franke users 0 Aug 26 19:33 test1 -r--r--r-- 1 franke users 0 Aug 26 19:33 test2 $ attrib 'test?' A C:\cygwin\tmp\test1 A R C:\cygwin\tmp\test2 The chmod() behavior is intentional: fhandler_disk_file::fchmod (mode_t mode) ... if (mode & (S_IWUSR | S_IWGRP | S_IWOTH)) pc &= (DWORD) ~FILE_ATTRIBUTE_READONLY; else if (!pc.has_acls ()) /* Never set DOS R/O if security is used. */ pc |= (DWORD) FILE_ATTRIBUTE_READONLY; This change might be enough (or not): fhandler_base::open (int flags, mode_t mode) ... -if (!(mode & (S_IWUSR | S_IWGRP | S_IWOTH))) +if (!pc.has_acls () && !(mode & (S_IWUSR | S_IWGRP | S_IWOTH))) file_attributes |= FILE_ATTRIBUTE_READONLY; -- Regards, Christian Franke -- 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
webmaster | delorie software privacy |
Copyright © 2019 by DJ Delorie | Updated Jul 2019 |