[Top][All Lists]

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

Re: wu-ftpd tricks ange-ftp into displaying a file as a directory

From: Charles Sebold
Subject: Re: wu-ftpd tricks ange-ftp into displaying a file as a directory
Date: Thu, 09 Aug 2001 13:11:57 -0500
User-agent: Gnus/5.090004 (Oort Gnus v0.04) Emacs/21.0.104

This is a good workaround for this problem (which has plagued many of
us)!  Thanks for sending this.

I am forwarding this to gnu.emacs.help (and setting followups there),
in case others who may need this haven't seen it.

On 20 Av 5761, Francis Litterio wrote:

> SYSTEM TYPES: GNU/Linux (Red Hat 6.2), Windows 2000
> When ange-ftp.el finds a file on a remote host that is running the
> wu-ftpd FTP server (e.g., many GNU/Linux systems run wu-ftpd),
> instead of displaying the contents of the file, Emacs displays a
> dired buffer showing the file as the sole entry.  For example,
> finding the file:
>   /joe@hostname:/home/joe/.bashrc
> results in a dired buffer with the following contents:
>   /joe@hostname:/home/joe/.bashrc: -rw-r--r-- 1 joe users 4794 Aug 7
>   11:00 /home/joe/.bashrc
> The cause of this problem is that ange-ftp.el decides whether a
> pathname is a file or a directory by sending this command to the
> remote FTP server:
>       ls "-alq" /home/joe/.bashrc/
> Notice the trailing '/' that has been appended to the pathname!
> ange-ftp.el expects the remote FTP server to return an error
> containing the string "Not a directory" if the pathname is not a
> directory or a legitimate directory listing if it is a directory.
> Unfortunately, wu-ftpd invokes /bin/ls without the trailing '/',
> which causes a one-line long-style "ls" listing of that file to be
> returned to ange-ftp.el.  That makes ange-ftp.el to think that
> /home/joe/.bashrc is a directory containing only the file .bashrc.
> Hence, the dired buffer appears instead of the contents of the file.
> I verified that wu-ftpd strips the trailing '/' by replacing /bin/ls
> on my GNU/Linux system with a script that echoes the command-line
> arguments to a file.
> A workaround is to put this form in my .emacs startup file:
>       (eval-after-load "ange-ftp"
>         (defun ange-ftp-allow-child-lookup (dir file)
>           nil))
> This works because, ange-ftp-allow-child-lookup is a macro that
> decides whether or not ange-ftp.el will use the trailing-'/' trick
> to decide if a pathname is a directory or not.  By defining it as a
> function that always returns nil, ange-ftp.el always uses a less
> efficient method: it generates a long listing of the file's parent
> directory and parses that.
> Forcing the less efficient method to be used all the time is a
> non-optimal solution, because the parent directory may be unreadable
> by the user or may have thousands of entries in it, causing a long
> delay for the user.
> If there's any more information I can provide, please contact me by
> email.

Charles Sebold                                          20th of Av, 5761
Random Answer to an Emacs Very Frequently Asked Question:
 Put (global-font-lock-mode 1) in your .emacs for syntax coloring.

reply via email to

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