emacs-devel
[Top][All Lists]
Advanced

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

Re: tiny patch to ange-ftp


From: Stefan Monnier
Subject: Re: tiny patch to ange-ftp
Date: Sun, 02 Oct 2005 12:04:17 -0400
User-agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux)

> I rebuilt Emacs.  However, I still could not upload files with
> another problem.  `ange-ftp-insert-directory' passes a file name
> without directory components to `ange-ftp-get-file-entry' then.

That's an error in ange-ftp-insert-directory.

> So, the following change seems to be required (I confirmed it
> did the trick):

It works around the bug, tho.  I'd rather fix it instead.
I've just installed a patch which should fix it.  Does it work for you?

Although the patch works (it fixes the symlink-following code), in reality,
I see no reason why we should follow symlinks at all.  The normal code for
insert-directory doesn't follow symlinks, so why should the ange-ftp
version of it do it?  It seems to be asking for trouble, especially in the
present case: what if dired wants to refresh a single line that contains
a symlink?

The change to follow symlinks has sadly no explanation:

   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.

But it's still not clear why we'd want to follow symlinks.  My suspicion is
that at that time, it was necessary to follow symlinks in order for the
ange-ftp-ls command to give us a listing of a directory rather than just the
single-line listing of a symlink.  In that case, this is not a problem any
more since ange-ftp-ls now does "cd foo; ls" rather than "ls foo".  So I'd
be happy to install the second patch.

To see one of the problems with the idea of following symlinks, try
something like

  (insert-directory "/address@hidden:/pub" "-lFd")

Of course, there's also the problem where the symlink points to itself.
And also the problem that

  (insert-directory "/address@hidden:/pub/gnu/winboard" "-lFd")

will not list

  lrwxrwxrwx    1 0        0              15 Nov 21  2003 winboard -> 
xboard/winboard

but

  drwxrwxr-x    2 0        1003         4096 Nov 29  2003 winboard/

Contrary to what it would have done if we were working locally.


        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]