unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Stefan Monnier <monnier@iro.umontreal.ca>
Cc: emacs-devel@gnu.org
Subject: Re: tiny patch to ange-ftp
Date: Sun, 02 Oct 2005 12:04:17 -0400	[thread overview]
Message-ID: <87ll1chs0h.fsf-monnier+emacs@gnu.org> (raw)
In-Reply-To: <b4mvf0h4eae.fsf@jpl.org> (Katsumi Yamaoka's message of "Sat, 01 Oct 2005 21:23:05 +0900")

> 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 "/ftp@ftp.gnu.org:/pub" "-lFd")

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

  (insert-directory "/ftp@ftp.gnu.org:/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	other threads:[~2005-10-02 16:04 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <b4mhde4fno0.fsf@jpl.org>
     [not found] ` <m1br46adb8.fsf-monnier+emacs@gnu.org>
     [not found]   ` <b4mr7d2o3j1.fsf@jpl.org>
     [not found]     ` <b4mbr46t4o1.fsf@jpl.org>
     [not found]       ` <b4mslxi3sp8.fsf@jpl.org>
     [not found]         ` <b4mu0hxp3h9.fsf@jpl.org>
     [not found]           ` <m17jer7ikd.fsf-monnier+emacs@gnu.org>
     [not found]             ` <b4m1x4zeiw6.fsf@jpl.org>
     [not found]               ` <m18xz761ro.fsf-monnier+emacs@gnu.org>
     [not found]                 ` <b4m1x4zuwmj.fsf@jpl.org>
     [not found]                   ` <b4miry7ptpu.fsf@jpl.org>
     [not found]                     ` <b4moe7yr42b.fsf@jpl.org>
     [not found]                       ` <b4mmzninzyb.fsf@jpl.org>
     [not found]                         ` <jwvek88ju9q.fsf-monnier+emacs@gnu.org>
     [not found]                           ` <b4mbr3cs7vg.fsf@jpl.org>
2005-09-02 14:14                             ` tiny patch to ange-ftp Stefan Monnier
2005-09-08  3:57                               ` Katsumi Yamaoka
2005-09-08  4:46                                 ` Katsumi Yamaoka
2005-09-08 20:50                                   ` Stefan Monnier
2005-09-21 23:41                                     ` Katsumi Yamaoka
2005-09-22 15:06                                       ` Stefan Monnier
2005-09-29  0:00                                         ` Katsumi Yamaoka
2005-09-30 21:05                                           ` Stefan Monnier
2005-10-01 12:23                                             ` Katsumi Yamaoka
2005-10-02 16:04                                               ` Stefan Monnier [this message]
2005-10-03 11:04                                                 ` Katsumi Yamaoka

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.gnu.org/software/emacs/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87ll1chs0h.fsf-monnier+emacs@gnu.org \
    --to=monnier@iro.umontreal.ca \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).