[Bug: 21.4.20] Network Drives

Steve Higham steve at sjlt.co.uk
Mon Apr 30 17:57:03 EDT 2007


Vin,

Thanks for your help. It's really appreciated.

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.

My network drive issue has disappeared. This doesn't 100% surprise me. My
(home) network doesn't have a domain controller and I connect over a
wireless LAN. I believe there is some kind of race condition at login that
makes the network rights inconsistent.

I do dream of turning my server into a dedicated Linux box. Unfortunately
the kids insist on using it to play "The Simms" :-(

I still believe there is a network drive issue (with xemacs). This is
because Xemacs regarded a file as read only in the same (network) session,
that other editors could edit the file and successfully save the edited
version. It just means that I cannot investigate until the problem
reappears. I will keep you posted :-)

As you know, I am not convinced that this approach is sensible. Consider the
following scenario: -

I could download a CPAN Perl script "my_perl_script" and open it in xemacs.
However it will not execute because it has no extension. Even though Xemacs
has correctly recognised it as a Perl Script and invoked CPerl mode.

However trying to "execute" a my_book.doc file will work just fine and
launch Word.

This behaviour does not strike me as logical or helpful :-(

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.

I've also come across another issue when building a DEBUG version of Xemacs
on MSVC. The (DEBUG) version of "close" throws an exception if an attempt is
made to close a file that is not open. This happens in the following places:
-

--- callproc.c	2007/04/30 20:36:25	1.2
***************
*** 430,436 ****
      /* Close most of our fd's, but not fd[0]
         since we will use that to read input from.  */
      close (filefd);
!     if (fd1 >= 0)
        close (fd1);
    }
  
--- 430,436 ----
      /* Close most of our fd's, but not fd[0]
         since we will use that to read input from.  */
      close (filefd);
!     if ((fd1 >= 0) && (fd1 != fd_error))
        close (fd1);
    }
  
*** dumper.c	2007/04/27 21:42:10	1.1
--- dumper.c	2007/04/28 08:36:54	1.2
***************
*** 1067,1073 ****
    pdump_dump_root_objects ();
  
    fclose (pdump_out);
!   close (pdump_fd);
  
    free (pdump_buf);
  
--- 1067,1073 ----
    pdump_dump_root_objects ();
  
    fclose (pdump_out);
!   //close (pdump_fd); already closed by fclose (pdump_out)
  
    free (pdump_buf);

Cheers,

Steve

>	msvcr80d.dll!_access_s(const char * path=0x0082a860, int amode=1)
Line 81 + 0x2f bytes	C
 	msvcr80d.dll!_access(const char * path=0x0082a860, int amode=1)
Line 47 + 0xd bytes	C
 	temacs.exe!locate_file_in_directory_mapper(char * fn=0x0082a860,
void * arg=0x0082a904)  Line 1023 + 0x11 bytes	C lread.c
 	temacs.exe!locate_file_map_suffixes(long filename=52548764, long
suffixes=51893316, int (char *, void *)* fun=0x010faa00, void *
arg=0x0082a904)  Line 993 + 0xb bytes	C lread.c
 	temacs.exe!locate_file_in_directory(long directory=52536612, long
str=52536436, long suffixes=51893316, long * storeptr=0x0082abe4, int
mode=1)  Line 1089 + 0x16 bytes	C lread.c
 	temacs.exe!locate_file(long path=52546504, long str=52536436, long
suffixes=51893316, long * storeptr=0x0082abe4, int mode=1)  Line 1265 + 0x19
bytes	C lread.c
 	temacs.exe!Fold_call_process_internal(int nargs=103, long *
args=0x0082ecc4)  Line 224 + 0x22 bytes	C callproc.c
 	temacs.exe!Ffuncall(int nargs=104, long * args=0x0082ecc0)  Line
3558 + 0x10 bytes	C eval.c
 	temacs.exe!Fapply(int nargs=6, long * args=0x0082ef48)  Line 3811 +
0xd bytes	C eval.c
 	temacs.exe!Ffuncall(int nargs=7, long * args=0x0082ef44)  Line 3558
+ 0x10 bytes	C eval.c
 	temacs.exe!execute_optimized_program(const unsigned char *
program=0x03210930, int stack_depth=9, long * constants_data=0x03201040)
Line 748 + 0x10 bytes	C bytecode.c
 	temacs.exe!funcall_compiled_function(long fun=52436320, int
nargs=103, long * args=0x0082f234)  Line 519 + 0x33 bytes	C bytecode.c
 	temacs.exe!Ffuncall(int nargs=104, long * args=0x0082f230)  Line
3572 + 0x11 bytes	C eval.c
 	temacs.exe!Fapply(int nargs=6, long * args=0x0082f430)  Line 3811 +
0xd bytes	C eval.c
 	temacs.exe!Feval(long form=52546252)  Line 3361 + 0x16 bytes	C
eval.c
 	temacs.exe!Fprogn(long args=52546396)  Line 775 + 0x9 bytes	C
eval.c
 	temacs.exe!Fif(long args=52533520)  Line 693 + 0x9 bytes	C
eval.c
 	temacs.exe!Feval(long form=52533424)  Line 3309 + 0xf bytes	C
eval.c
 	temacs.exe!Fprogn(long args=52533304)  Line 775 + 0x9 bytes	C
eval.c
 	temacs.exe!Feval(long form=52533268)  Line 3309 + 0xf bytes	C
eval.c
 	temacs.exe!Fif(long args=52533256)  Line 691 + 0x9 bytes	C
eval.c
 	temacs.exe!Feval(long form=52533244)  Line 3309 + 0xf bytes	C
eval.c
 	temacs.exe!readevalloop(long readcharfun=52035992, long
sourcename=52019812, long (long)* evalfun=0x01072c60, int printflag=0)  Line
1449 + 0x7 bytes	C lread.c
 	temacs.exe!Fload_internal(long file=52019812, long noerror=16687156,
long nomessage=16687156, long nosuffix=16687156, long codesys=16687156, long
used_codesys=16687156)  Line 737 + 0x17 bytes	C lread.c
 	temacs.exe!Feval(long form=51995092)  Line 3335 + 0x181 bytes	C
eval.c
 	temacs.exe!condition_case_1(long handlers=16687252, long (long)*
bfun=0x01072c60, long barg=51995092, long (long, long)* hfun=0x01051360,
long harg=16687156)  Line 1652 + 0x7 bytes	C eval.c
 	temacs.exe!top_level_1(long dummy=16687156)  Line 206 + 0x23 bytes
C cmdloop.c
 	temacs.exe!internal_catch(long tag=51778124, long (long)*
func=0x01051300, long arg=16687156, int * volatile threw=0x00000000)  Line
1318 + 0x7 bytes	C eval.c
 	temacs.exe!initial_command_loop(long load_me=52019812)  Line 285 +
0x19 bytes	C cmdloop.c
 	temacs.exe!STACK_TRACE_EYE_CATCHER(int argc=9, char * *
argv=0x00fe5f48, char * * envp=0x00fe3980, int restart=0)  Line 2462	C
emacs.c
 	temacs.exe!main(int argc=9, char * * argv=0x00fe5f48, char * *
envp=0x00fe3980)  Line 2832	C emacs.c
 	temacs.exe!__tmainCRTStartup()  Line 597 + 0x19 bytes	C crtexe.c
 	temacs.exe!mainCRTStartup()  Line 414	C crtexe.c
 	kernel32.dll!7d4e7d2a() 	
 	[Frames below may be incorrect and/or missing, no symbols loaded for
kernel32.dll]	

-----Original Message-----
From: Vin Shelton [mailto:acs at xemacs.org] 
Sent: 30 April 2007 02:47
To: Steve Higham
Cc: 'Stephen J. Turnbull'; 'Benson Margulies'; xemacs-beta at xemacs.org
Subject: Re: [Bug: 21.4.20] Network Drives

"Steve Higham" <steve at sjlt.co.uk> writes:

> Vin, Stephen,
>
> I'm sorry if I've missed something here, but I cannot think of any
> benefit from trying to identify whether a file is executable under
> windows. Surely the sensible approach it to try and execute it if
> requested, and report any resulting failures.
>
> I appreciate that the Unix approach of having an "executable
> attribute" has benefits. Furthermore programs like xemacs should
> obviously respect this attribute. However windows does not have this
> attribute. The OS shell and all other systems, assume that all files
> are executable.
>
> I can see no end of problems with this proposed function. Where the
> function successfully identifies an executable file there will be no
> benefit. Where the function fails to recognise a file as executable,
> the user will presumably be told that his / her file is not marked
> as executable. This will presumably cause loads of grief and no
> benefit.
>

This afternoon I coded up 21.4 and 21.5 versions of a patch to check
the PATHEXT environment variable in mswindows_is_executable().  Those
patches are attached, largely for reference purposes.  The patches
correct the existing XEmacs brain-damage where it thinks only .BAT,
.COM, .EXE and .CMD are valid executable suffixes.

On thinking it over, I've come to the conclusion that I think that
Steve Higham is right.  Checking for executable access on windows is
fundamentally wrong.

Steve, try this simple patch to see if it gets past the access
problems on building a debug build with MSVC 2005:

--- src/nt.c~	2007-04-29 21:31:57.000000000 -0400
+++ src/nt.c	2007-04-29 21:37:18.734375000 -0400
@@ -1642,18 +1642,7 @@
   else
     permission = _S_IREAD | _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;
-    }
+  permission |= _S_IEXEC;
 
   buf->st_mode |= permission | (permission >> 3) | (permission >> 6);
 
Steve - please let me know how this works for you.  I'm very
interested in fixing the problems you're seeing with your network
drives, so I hope this helps you make progress.

Thanks,
  Vin



More information about the XEmacs-Beta mailing list