[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#10257: 23.3.1 Cygwin: network drives - file is write protected (fals
From: |
Ken Brown |
Subject: |
bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive) |
Date: |
Fri, 16 Dec 2011 14:37:30 -0500 |
User-agent: |
Mozilla/5.0 (Windows NT 6.1; WOW64; rv:8.0) Gecko/20111105 Thunderbird/8.0 |
On 12/15/2011 9:42 AM, Ken Brown wrote:
On 12/14/2011 11:04 PM, Eli Zaretskii wrote:
How does the following patch look?
Looks fine to me, if it does the job.
Thanks.
It works for me, but I'd like Jari to confirm.
Jari has confirmed in private email that it works, but he has proposed
making it slightly more permissive and having check_writable return
success if either UID or GID is -1. The rationale is the same as
before: If euidaccess returns failure but either UID or GID is -1, then
the result of euidaccess is unreliable. The revised patch is below.
Eli, do you see any problem with this extra permissiveness?
Stefan, is it OK to apply the patch to the trunk, or would you rather I
wait for 24.2?
Ken
=== modified file 'src/fileio.c'
--- src/fileio.c 2011-12-05 08:55:25 +0000
+++ src/fileio.c 2011-12-16 19:32:23 +0000
@@ -2416,15 +2416,27 @@
return (st.st_mode & S_IWRITE || S_ISDIR (st.st_mode));
#else /* not MSDOS */
#ifdef HAVE_EUIDACCESS
- return (euidaccess (filename, 2) >= 0);
-#else
+ int res = (euidaccess (filename, 2) >= 0);
+#ifdef CYGWIN
+ /* euidaccess may have returned failure because Cygwin couldn't
+ determine the file's UID or GID; if so, we return success. */
+ if (!res)
+ {
+ struct stat st;
+ if (stat (filename, &st) < 0)
+ return 0;
+ res = (st.st_uid == -1 || st.st_gid == -1);
+ }
+#endif /* CYGWIN */
+ return res;
+#else /* not HAVE_EUIDACCESS */
/* Access isn't quite right because it uses the real uid
and we really want to test with the effective uid.
But Unix doesn't give us a right way to do it.
Opening with O_WRONLY could work for an ordinary file,
but would lose for directories. */
return (access (filename, 2) >= 0);
-#endif
+#endif /* not HAVE_EUIDACCESS */
#endif /* not MSDOS */
}
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), (continued)
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Eli Zaretskii, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), jari, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Eli Zaretskii, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Eli Zaretskii, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/15
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive),
Ken Brown <=
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Eli Zaretskii, 2011/12/16
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Stefan Monnier, 2011/12/16
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/17
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), jari, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), jari, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Eli Zaretskii, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Richard Stallman, 2011/12/14
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), jari, 2011/12/13
- bug#10257: 23.3.1 Cygwin: network drives - file is write protected (false positive), Ken Brown, 2011/12/13