From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Stefan Monnier Newsgroups: gmane.emacs.devel Subject: Re: tiny patch to ange-ftp Date: Sun, 02 Oct 2005 12:04:17 -0400 Message-ID: <87ll1chs0h.fsf-monnier+emacs@gnu.org> References: <877jdrnv2k.fsf-monnier+emacs@gnu.org> <878xxpxhvc.fsf-monnier+emacs@gnu.org> <87k6gyi7vo.fsf-monnier+emacs@gnu.org> NNTP-Posting-Host: main.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: sea.gmane.org 1128269506 23557 80.91.229.2 (2 Oct 2005 16:11:46 GMT) X-Complaints-To: usenet@sea.gmane.org NNTP-Posting-Date: Sun, 2 Oct 2005 16:11:46 +0000 (UTC) Cc: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sun Oct 02 18:11:43 2005 Return-path: Original-Received: from lists.gnu.org ([199.232.76.165]) by ciao.gmane.org with esmtp (Exim 4.43) id 1EM6Pr-000857-Fh for ged-emacs-devel@m.gmane.org; Sun, 02 Oct 2005 18:10:19 +0200 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EM6Pq-0004wD-Tg for ged-emacs-devel@m.gmane.org; Sun, 02 Oct 2005 12:10:18 -0400 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1EM6O3-0004Vd-Iw for emacs-devel@gnu.org; Sun, 02 Oct 2005 12:08:29 -0400 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1EM6Nt-0004Qf-3S for emacs-devel@gnu.org; Sun, 02 Oct 2005 12:08:20 -0400 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1EM6Ns-0004Ng-6C for emacs-devel@gnu.org; Sun, 02 Oct 2005 12:08:16 -0400 Original-Received: from [209.226.175.97] (helo=tomts40-srv.bellnexxia.net) by monty-python.gnu.org with esmtp (Exim 4.34) id 1EM6K2-0002Bt-7x for emacs-devel@gnu.org; Sun, 02 Oct 2005 12:04:18 -0400 Original-Received: from alfajor ([70.49.82.228]) by tomts40-srv.bellnexxia.net (InterMail vM.5.01.06.10 201-253-122-130-110-20040306) with ESMTP id <20051002160417.DJU1799.tomts40-srv.bellnexxia.net@alfajor>; Sun, 2 Oct 2005 12:04:17 -0400 Original-Received: by alfajor (Postfix, from userid 1000) id 75138D780A; Sun, 2 Oct 2005 12:04:17 -0400 (EDT) Original-To: Katsumi Yamaoka In-Reply-To: (Katsumi Yamaoka's message of "Sat, 01 Oct 2005 21:23:05 +0900") User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.0.50 (gnu/linux) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:43460 Archived-At: > 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