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