[gnu.emacs.bug] list-directory bug

wolfgang@MGM.MIT.EDU (Wolfgang Rupprecht) (09/29/88)

In GNU Emacs 18.52.6 of Tue Sep 20 1988 on mgm.mit.edu (berkeley-unix)
seen under 4.3 BSD.  

There is a small bug in list-directory that will lead to an incorrect
*Directory* buffer.  If the requested directory doesn't exist, then
the contents of the CURRENT directory will be listed, along with a
legend that claims that the contents are from the requested directory.

To demonstrate run:

	(list-directory "/foo/")  ; where dir /foo doesn't exist.

This patch will fix the problem.

cd /u/src/gnuemacs-18.52/lisp/
diff -c files.el.~1~ files.el
*** files.el.~1~	Mon Aug  8 08:16:09 1988
--- files.el	Wed Sep 28 23:23:42 1988
***************
*** 967,976 ****
  	  (call-process "ls" nil standard-output nil
  			switches dirname)
  	(let ((default-directory (file-name-directory dirname)))
! 	  (call-process shell-file-name nil standard-output nil
! 			"-c" (concat "exec ls "
! 				     switches " "
! 				     (file-name-nondirectory dirname))))))))
  
  (defun save-buffers-kill-emacs (&optional arg)
    "Offer to save each buffer, then kill this Emacs fork.
--- 967,979 ----
  	  (call-process "ls" nil standard-output nil
  			switches dirname)
  	(let ((default-directory (file-name-directory dirname)))
! 	  (if (file-exists-p default-directory)
! 	      (call-process shell-file-name nil standard-output nil
! 			    "-c" (concat "exec ls "
! 					 switches " "
! 					 (file-name-nondirectory dirname)))
! 	    (princ "No such file or directory")
! 	    (terpri)))))))
  
  (defun save-buffers-kill-emacs (&optional arg)
    "Offer to save each buffer, then kill this Emacs fork.

diff exited abnormally with code 1 at Wed Sep 28 23:24:05