Re: compile problems on Lucid 19.10 and run problems on 19.22

sandy@ibm550.sissa.it
Tue, 16 Aug 1994 22:49:13 +0200


Lucid Emacs has a lot of bugs in its file-name-handler-alist support.
You need to apply the following patches.  This list of patches will be
distributed with efs 1.10.  I've heard that the Lucid XEmacs people
have made these fixes for XEmacs 1.11.

It's true that efs will not even compile in Lucid Emacs 1.10 without
these patches.

---------------------------------------------------------------------
Patches for Lucid Emacs 19.10
=============================

There are two bugs in fileio.c that break efs.  Hamish Macdonald has
kindly supplied these two patches.

As well there are bugs in vc-hooks.el, vm-folder.el, and vm-pop.el.
I've added patches for these as well.

Also, a bug in eval.c caused write-region to fail to update the
buffer-file-modtime.  Patch supplied by Jeff Sparkes.


A misplaced parenthesis in the find-file-name-handler function in
fileio.c results in filenames *always* matching a string in the
file-name-handler-alist.

Patch to fix this problem follows:

*** src/fileio.c~	Sun May 15 03:05:30 1994
--- src/fileio.c	Tue May 31 11:50:08 1994
***************
*** 261,267 ****
  	  if (STRINGP (string)
  	      && fast_string_match (string,
                                      (char *) XSTRING (filename)->data,
!                                     string_length (XSTRING (filename)) >= 0))
  	    {
  	      Lisp_Object handler = XCONS (elt)->cdr;
  	      if (NILP (Fmemq (handler, inhibited_handlers)))
--- 261,267 ----
  	  if (STRINGP (string)
  	      && fast_string_match (string,
                                      (char *) XSTRING (filename)->data,
!                                     string_length (XSTRING (filename))) >= 0)
  	    {
  	      Lisp_Object handler = XCONS (elt)->cdr;
  	      if (NILP (Fmemq (handler, inhibited_handlers)))



The function insert-file-contents changes one of its arguments before
it offers the job to the file-name-handler-alist.  If the function
from the file-name-handler-alist later calls insert-file-contents with
the arguments it was provided, the error "Attempt to visit less than
an entire file" is generated, since beg is non-nil and visit is
non-nil (assuming that visit was non-nil when insert-file-contents was
originally called).

This problem occurs with efs-1.6 which has been modified to *not*
supply its own version of insert-file-contents, but to use the
file-name-handler-alist for this function, since Lucid Emacs 19.10
supports the file-name-handler-alist for insert-file-contents.

The following patch fixes the problem with efs.  I'm not sure if there
are any other ramifications.  What the patch does is move the argument
checking to after file-name-handler-alist has been consulted (and any
appropriate function called).

*** fileio.c~	Fri Jun  3 11:05:24 1994
--- fileio.c	Fri Jun  3 11:24:07 1994
***************
*** 2532,2549 ****
  
    val = Qnil;
  
-   if (!NILP (beg) || !NILP (end))
-     if (!NILP (visit))
-       error (GETTEXT ("Attempt to visit less than an entire file"));
- 
-   if (!NILP (beg))
-     CHECK_FIXNUM (beg, 0);
-   else
-     beg = Qzero;
- 
-   if (!NILP (end))
-     CHECK_FIXNUM (end, 0);
- 
    GCPRO2 (filename, visit);
    if (!NILP (current_buffer->read_only))
      Fbarf_if_buffer_read_only ();
--- 2532,2537 ----
***************
*** 2559,2564 ****
--- 2547,2564 ----
                     visit, beg, end, replace);
        goto handled;
      }
+ 
+   if (!NILP (beg) || !NILP (end))
+     if (!NILP (visit))
+       error (GETTEXT ("Attempt to visit less than an entire file"));
+ 
+   if (!NILP (beg))
+     CHECK_FIXNUM (beg, 0);
+   else
+     beg = Qzero;
+ 
+   if (!NILP (end))
+     CHECK_FIXNUM (end, 0);
  
    fd = -1;
  


vc-registered should use find-file-name-handler, so that
inhibit-file-name-handlers and inhibit-file-name-operation get checked.

*** vc-hooks.el~	Fri Jun 17 13:46:02 1994
--- vc-hooks.el	Fri Jun 17 13:46:03 1994
***************
*** 78,93 ****
  ;;; actual version-control code starts here
  
  (defun vc-registered (file)
!   (let (handler handlers)
!     (if (boundp 'file-name-handler-alist)
! 	(save-match-data
! 	  (setq handlers file-name-handler-alist)
! 	  (while (and (consp handlers) (null handler))
! 	    (if (and (consp (car handlers))
! 		     (stringp (car (car handlers)))
! 		     (string-match (car (car handlers)) file))
! 		(setq handler (cdr (car handlers))))
! 	    (setq handlers (cdr handlers)))))
      (if handler
  	(funcall handler 'vc-registered file)
        ;; Search for a master corresponding to the given file
--- 78,84 ----
  ;;; actual version-control code starts here
  
  (defun vc-registered (file)
!   (let ((handler (find-file-name-handler file 'vc-registered)))
      (if handler
  	(funcall handler 'vc-registered file)
        ;; Search for a master corresponding to the given file



vm-spool-move-mail should supply a correct OPERATION arg to
find-file-name-handler.

*** vm-folder.el~	Fri Jun 17 13:48:55 1994
--- vm-folder.el	Fri Jun 17 13:49:00 1994
***************
*** 2213,2221 ****
  (defun vm-spool-move-mail (source destination)
    (let ((handler (and (fboundp 'find-file-name-handler)
  		      (condition-case ()
! 			  (find-file-name-handler source nil)
  			(wrong-number-of-arguments
! 			  (find-file-name-handler source)))))
  	status error-buffer)
      (if handler
  	(funcall handler 'vm-spool-move-mail source destination)
--- 2213,2221 ----
  (defun vm-spool-move-mail (source destination)
    (let ((handler (and (fboundp 'find-file-name-handler)
  		      (condition-case ()
! 			  (find-file-name-handler source 'vm-spool-move-mail)
  			(wrong-number-of-arguments
! 			 (find-file-name-handler source)))))
  	status error-buffer)
      (if handler
  	(funcall handler 'vm-spool-move-mail source destination)



vm-pop-move-mail should also supply find-file-name-handler with a
correct OPERATION arg.

*** vm-pop.el~	Fri Jun 17 13:50:29 1994
--- vm-pop.el	Fri Jun 17 13:50:30 1994
***************
*** 24,30 ****
  	(save-password nil)
  	(handler (and (fboundp 'find-file-name-handler)
  		      (condition-case ()
! 			  (find-file-name-handler source nil)
  			(wrong-number-of-arguments
  			  (find-file-name-handler source)))))
  	greeting timestamp n message-count
--- 24,30 ----
  	(save-password nil)
  	(handler (and (fboundp 'find-file-name-handler)
  		      (condition-case ()
! 			  (find-file-name-handler source 'vm-pop-move-mail)
  			(wrong-number-of-arguments
  			  (find-file-name-handler source)))))
  	greeting timestamp n message-count


The problem was that call6 wasn't using a big enough array to hold all
of the arguments.

I wonder if this could becausing the gc problems as well.  The only
functions that used call6 where write-region, directory-files and
insert-file-contents.  The last one is pretty heavily used...

*** 1.1	1994/07/22 19:47:37
--- eval.c	1994/07/22 19:47:48
***************
*** 2403,2409 ****
         Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5)
  {
    struct gcpro gcpro1;
!   Lisp_Object args[6];
    args[0] = fn;
    args[1] = arg0;
    args[2] = arg1;
--- 2403,2409 ----
         Lisp_Object arg3, Lisp_Object arg4, Lisp_Object arg5)
  {
    struct gcpro gcpro1;
!   Lisp_Object args[7];
    args[0] = fn;
    args[1] = arg0;
    args[2] = arg1;