Hi, Steve,
First, thanks for the patches on closing file descriptors. I took
your patches, made a few changes and will submit something to
xemacs-patches quickly. I'll CC: you when I submit.
On 4/30/07, Steve Higham <steve(a)sjlt.co.uk> wrote:
Your fix does not work. The stack dump is listed below. As you can
see,
mswindows_stat (...) is not being called. This is using version 21.4.20
code. The crash is invoked by temacs as it happens during the build process.
Thanks for the stack trace - it was a big help.
mswindows_stat (...) is not being called
To be a bit more
precise, mswindows_stat() has already been called
before access() gets called. My thinko was that if the code had
already called ...stat(), a call to a function like access() would be
superfluous. After thinking it over a little bit, I'm back to
thinking that the right way to handle this (without significant code
surgery) is to redefine X_OK as you had previously suggested.
My fix of defining X_OK as 2 (under WIN32) is working fine and will
enable
me to debug my drive issue if / when it reappears.
... except you mean 4 (R_OK), right?
Here's the patch I'm currently trying out under Windows (native and
cygwin) and linux:
--- src/ChangeLog~ 2007-04-29 22:16:11.000000000 -0400
+++ src/ChangeLog 2007-05-01 22:20:19.218750000 -0400
@@ -0,0 +1,6 @@
+2007-05-01 Vin Shelton <acs(a)xemacs.org>
+
+ * nt.c (mswindows_stat): Tie _S_IEXEC permission to read access.
+ (mswindows_fstat): Ditto.
+ * sysfile.h: Under Windows, define X_OK to be the same as R_OK.
+
Index: src/sysfile.h
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/sysfile.h,v
retrieving revision 1.9.2.1
diff -a -u -r1.9.2.1 sysfile.h
--- src/sysfile.h 2001/07/25 07:45:39 1.9.2.1
+++ src/sysfile.h 2007/05/02 18:38:51
@@ -261,12 +261,18 @@
#endif
/* The following definitions are needed under Windows, at least */
-#ifndef X_OK
-# define X_OK 1
-#endif
-
#ifndef R_OK
# define R_OK 4
+#endif
+
+/* Under native Windows, there is no concept of execute permission,
+ so redefine execute permissions to be the same as read permission */
+#ifndef X_OK
+# ifdef WIN32_NATIVE
+# define X_OK R_OK
+# else
+# define X_OK 1
+# endif
#endif
#ifndef W_OK
Index: src/nt.c
===================================================================
RCS file: /pack/xemacscvs/XEmacs/xemacs/src/nt.c,v
retrieving revision 1.21.2.4
diff -a -u -r1.21.2.4 nt.c
--- src/nt.c 2005/01/31 02:55:24 1.21.2.4
+++ src/nt.c 2007/05/02 18:39:05
@@ -1449,9 +1449,9 @@
/* determine rwx permissions */
if (info.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
- permission = _S_IREAD;
+ permission = _S_IREAD | _S_IEXEC;
else
- permission = _S_IREAD | _S_IWRITE;
+ permission = _S_IREAD | _S_IEXEC |_S_IWRITE;
if (info.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
permission |= _S_IEXEC;
@@ -1638,22 +1638,12 @@
/* determine rwx permissions */
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_READONLY)
- permission = _S_IREAD;
+ permission = _S_IREAD | _S_IEXEC;
else
- permission = _S_IREAD | _S_IWRITE;
+ permission = _S_IREAD | _S_IEXEC |_S_IWRITE;
if (wfd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)
permission |= _S_IEXEC;
- else
- {
- char * p = strrchr (name, '.');
- if (p != NULL &&
- (stricmp (p, ".exe") == 0 ||
- stricmp (p, ".com") == 0 ||
- stricmp (p, ".bat") == 0 ||
- stricmp (p, ".cmd") == 0))
- permission |= _S_IEXEC;
- }
buf->st_mode |= permission | (permission >> 3) | (permission >> 6);
Comments welcome.
- Vin
--
The Journey by Mary Oliver
http://www.poemhunter.com/p/m/poem.asp?poet=6771&poem=30506
_______________________________________________
XEmacs-Beta mailing list
XEmacs-Beta(a)xemacs.org
http://calypso.tux.org/cgi-bin/mailman/listinfo/xemacs-beta