emacs-pretest-bug
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

ange-ftp-insert-directory should not follow symlinks


From: Stefan Monnier
Subject: ange-ftp-insert-directory should not follow symlinks
Date: Mon, 03 Oct 2005 10:59:24 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

ange-ftp-insert-directory currently has code to follow symlinks.
This code was added as follows:

   revision 1.20
   date: 2001/12/29 02:50:34;  author: rms;  state: Exp;  lines: +12 -6
   (ange-ftp-insert-directory): Explicitly follow symlinks.

In the ChangeLog file, we get a tiny bit more info:

        * net/ange-ftp.el (ange-ftp-allow-child-lookup): Always return nil.
        This fixes a bug that treated all files as directories.
        (ange-ftp-insert-directory): Explicitly follow symlinks.

My understanding is that it was added because with some FTP servers "ls foo"
fails to list the contents of the foo directory when foo is a symlink.
It was probably an OK workaround at the time, but now that ange-ftp-ls
doesn't send "ls foo" but "cd foo; ls" the problem has been fixed directly
in ange-ftp-ls and we don't need to follow symlinks in
ange-ftp-insert-directory.

So I suggest we remove the symlink-following code from
ange-ftp-insert-directory, since it is otherwise harmful.  See sample
patch below.

Some of the problems that are caused by following symlinks:

- (insert-directory "/address@hidden:/pub" "-lFd")
  doesn't return anything.

- (insert-directory "/address@hidden:/gnu/aspell-dict-csb" "-lFd")
  lists

  drwxr-xr-x    2 1003     1003         4096 Mar 11  2005 csb/

  instead of

  lrwxr-xr-x    1 0        0              15 Mar 11  2005 aspell-dict-csb -> 
aspell/dict/csb



        Stefan


--- ange-ftp.el 02 oct 2005 11:37:24 -0400      1.74
+++ ange-ftp.el 02 oct 2005 11:38:44 -0400      
@@ -4481,14 +4481,6 @@
 (defun ange-ftp-insert-directory (file switches &optional wildcard full)
   (if (not (ange-ftp-ftp-name (expand-file-name file)))
       (ange-ftp-real-insert-directory file switches wildcard full)
-    ;; Follow symlinks.
-    (let (tem)
-      (while (and (not wildcard)
-                  (stringp (setq tem (file-symlink-p
-                                      (directory-file-name file)))))
-        (setq file
-              (ange-ftp-expand-symlink
-               tem (file-name-directory (directory-file-name file))))))
     (insert
      (cond
       (wildcard




reply via email to

[Prev in Thread] Current Thread [Next in Thread]