emacs-devel
[Top][All Lists]
Advanced

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

ange-ftp does not wait for file download to complete


From: Lennart Borgman
Subject: ange-ftp does not wait for file download to complete
Date: Sun, 12 Mar 2006 00:34:46 +0100
User-agent: Thunderbird 1.5 (Windows/20051201)

When retrieving a file through ftp with something like

C-x C-f Find file: /ftp:address@hidden:/some-path/the-file.html

most of the times for me the file buffer will be empty.

I do not understand what is happening. I added some (message ...) statements for tracing. Here is what I got in the message buffer:

*** ange-ftp-raw-send-cmd *ftp address@hidden get /htdocs/testing/EmacsW32Util.html d:/DOCUME~1/THEUSER~1/LOCALS~1/Temp/ange-ftp18963gD Retrieving /ftp:address@hidden:/htdocs/testing/EmacsW32Util.html...26k
    >>>>  handle-line=
    >>>>  handle-line=226-File successfully transferred
>>>> handle-line=226 0.000 seconds (measured here), 281.23 Mbytes per second >>>> good-msgs=226 0.000 seconds (measured here), 281.23 Mbytes per second Retrieving /ftp:address@hidden:/htdocs/testing/EmacsW32Util.html...done
    file-exists-p d:/DOCUME~1/THEUSER~1/LOCALS~1/Temp/ange-ftp18963gD
    file-readable-p d:/DOCUME~1/THEUSER~1/LOCALS~1/Temp/ange-ftp18963gD
--- attr -1 0 =(nil 1 0 0 (17427 23662) (17427 23662) (17427 23660) 0 -rw-rw-rw- nil -23880 (7235 . 55565)) --- attr 0 0 =(nil 1 0 0 (17427 23662) (17427 23662) (17427 23660) 0 -rw-rw-rw- nil -23880 (7235 . 55565)) [2 times] --- attr 0 0 =(nil 1 0 0 (17427 23663) (17427 23663) (17427 23660) 4344 -rw-rw-rw- nil -23880 (7235 . 55565)) --- attr 0 4344 =(nil 1 0 0 (17427 23663) (17427 23663) (17427 23660) 4344 -rw-rw-rw- nil -23880 (7235 . 55565))

See below for an diff showing where the messages comes from. As can be seen from the output the file does not seem to be transfered when status 226 is recieved. (sit-for 15) does not work either here. The file is actually 28k, but only 4k are recieved above (the transfer is still in progress and actually finishes fine).

I have been testing this with the ftp program that comes with w2k, the one mentioned at http://www.emacswiki.org/cgi-bin/wiki/AngeFtp and also ncftp from Cygwin. I am doing this on windows 2000:

GNU Emacs 22.0.50.1 (i386-mingw-nt5.0.2195) of 2006-03-08 on W2ONE




-------------------------------------------------------------------------------------------
*** ange-ftp.el    2006-02-12 13:41:30.808964800 +0100
--- \emacs\u\060308\emacs\lisp\net\ange-ftp.el 2006-03-12 00:19:46.953198000 +0100
***************
*** 1554,1559 ****
--- 1554,1560 ----
   "Look at the given LINE from the ftp process PROC.
 Try to categorize it into one of four categories:
 good, skip, fatal, or unknown."
+   (message ">>>>  handle-line=%s" line)
   (cond ((string-match ange-ftp-xfer-size-msgs line)
      (setq ange-ftp-xfer-size
            (/ (string-to-number (match-string 1 line))
***************
*** 1561,1566 ****
--- 1562,1568 ----
     ((string-match ange-ftp-skip-msgs line)
      t)
     ((string-match ange-ftp-good-msgs line)
+          (message ">>>>  good-msgs=%s" line)
      (setq ange-ftp-process-busy nil
            ange-ftp-process-result t
                ange-ftp-pending-error-line nil
***************
*** 1838,1843 ****
--- 1840,1846 ----
 process that caused the command to complete.
If NOWAIT is given then the routine will return immediately the command has
 been queued with no result.  CONT will still be called, however."
+   (message "*** ange-ftp-raw-send-cmd %s %s " proc cmd )
   (if (memq (process-status proc) '(run open))
       (with-current-buffer (process-buffer proc)
     (ange-ftp-wait-not-busy proc)
***************
*** 3334,3339 ****
--- 3337,3359 ----
                   (sleep-for ange-ftp-retry-time)
                   ;; Wait for file to hopefully appear.
                   (ange-ftp-real-file-readable-p temp))
+                           (progn
+                             (if (file-exists-p temp)
+                                 (message "file-exists-p %s" temp)
+                               (message "NOT file-exists-p %s" temp))
+                             (if (file-readable-p temp)
+                                 (message "file-readable-p %s" temp)
+                               (message "NOT file-readable-p %s" temp))
+                             (let ((size 0)
+                                   (old-size -1)
+                                   attr)
+                               (while (/= size old-size)
+                                 (setq attr (file-attributes temp))
+ (message "--- attr %s %s =%s" old-size size attr)
+                                 (setq old-size size)
+                                 (setq size (nth 7 attr))
+                                 (sleep-for 15)
+                                 ))
               (setq
                size
                (nth 1 (ange-ftp-real-insert-file-contents
***************
*** 3342,3347 ****
--- 3362,3368 ----
                ;; override autodetection of buffer file type
                ;; to ensure buffer is saved in DOS format
                buffer-file-type binary)
+                           )
             (signal 'ftp-error
                 (list
                  "Opening input file:"






reply via email to

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