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

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

Re: tiny patch to ange-ftp


From: Katsumi Yamaoka
Subject: Re: tiny patch to ange-ftp
Date: Thu, 11 Aug 2005 12:16:50 +0900
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/22.0.50 (gnu/linux)

>>>>> In <address@hidden> Katsumi Yamaoka wrote:

> I noticed those changes cause some other problems.  Please
> ignore the patch I sent last.  I will fix them, verify most of
> features and send a new patch again, tomorrow maybe.  Sorry.

After perusing and testing Juri Linkov's patch, I realized that
is the best solution at the present.  So I merged them, tested
it with various ways, and made a new patch.

>>>>> In <address@hidden> Katsumi Yamaoka wrote:
(A reply to Juri Linkov)

> I tested it briefly.  Accessing NetBSD's ftpd seems ok, but it
> hangs up when uploading of files for the unknown reason...

That was caused by my fault.  I was trying to upload a file
which contains space characters in the name then.  I think
there's no way to handle such files using ange-ftp, though it's
not serious.


2005-08-11  Juri Linkov <address@hidden>

        * net/ange-ftp.el (ange-ftp-send-cmd): Don't concat ls switches
        and file name if switches aren't specified.
        (ange-ftp-ls): Retry to get file-listing without ls switches if
        the server seems to run NetBSD's ftpd or lukemftpd.

2005-08-11  Katsumi Yamaoka  <address@hidden>  (tiny change)

        * net/ange-ftp.el (ange-ftp-canonize-filename): Add comments.

--8<---------------cut here---------------start------------->8---
--- ange-ftp.el~        2005-08-09 21:56:54 +0000
+++ ange-ftp.el 2005-08-11 03:12:01 +0000
@@ -2333,8 +2333,14 @@
                                    ;; `cd' is performed is a directory.
                                    (file-name-directory (nth 1 cmd))
                                    'noerror)))
-       ;; Concatenate the switches and the target to be used with `ls'.
-       (setq cmd1 (concat "\"" cmd3 " " cmd1 "\""))))
+       (unless (equal cmd3 "")
+         ;; Concatenate the switches and the target to be used with `ls', and
+         ;; the command will be issued as `ls "-switches target" local_file'.
+         ;; Although this will make it impossible to get a file-listing from
+         ;; the server which runs some kind of ftpd, e.g., the NetBSD version,
+         ;; lukemftpd, or equivalent, `ange-ftp-ls' will retry it without
+         ;; using the switches, like `ls target local_file'.
+         (setq cmd1 (concat "\"" cmd3 " " cmd1 "\"")))))
 
      ;; First argument is the remote name
      ((progn
@@ -2650,7 +2656,14 @@
                          ;; `DIR /some/file/.' which leads ange-ftp to
                          ;; believe that /some/file is a directory ;-(
                          nil
-                       ange-ftp-ls-cache-res))
+                       (if (and (equal ange-ftp-ls-cache-res "")
+                                (not (equal lsargs "")))
+                           ;; Some kind of ftpd, e.g., the NetBSD version,
+                           ;; lukemftpd, or equivalent returns an empty
+                           ;; file-listing when using non-empty lsargs.
+                           ;; So try without ls arguments.
+                           (ange-ftp-ls file "" parse no-error wildcard)
+                         ange-ftp-ls-cache-res)))
                  (if no-error
                      nil
                    (ange-ftp-error host user
@@ -3127,12 +3140,22 @@
                        (rest (substring name (match-end 0)))
                        (dir (ange-ftp-expand-dir host user tilda)))
                   (if dir
-                      (setq name (cond ((string-equal rest "")
-                                        dir)
-                                       ((string-equal dir "/")
-                                        rest)
-                                       (t
-                                        (concat dir rest))))
+                      (setq name
+                            (cond ((string-equal rest "")
+                                   ;; The case accessing ~ or ~user.
+                                   ;; `dir' may be chroot'ed.
+                                   dir)
+                                  ((string-equal dir "/")
+                                   ;; The case accessing ~/file or ~user/file
+                                   ;; in the chroot'ed environment.
+                                   ;; `rest' has the value "/file".
+                                   rest)
+                                  (t
+                                   ;; The case accessing ~/file or ~user/file
+                                   ;; but chroot is not applied there. `dir'
+                                   ;; has the expanded home directory, and
+                                   ;; `rest' has the value "/file".
+                                   (concat dir rest))))
                     (error "User \"%s\" is not known"
                            (substring tilda 1)))))
 
--8<---------------cut here---------------end--------------->8---




reply via email to

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