all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Lennart Borgman <lennart.borgman.073@student.lu.se>
Subject: ange-ftp does not wait for file download to complete
Date: Sun, 12 Mar 2006 00:34:46 +0100	[thread overview]
Message-ID: <44135E96.3050103@student.lu.se> (raw)

When retrieving a file through ftp with something like

    C-x C-f Find file: 
/ftp:user@ftphost.somewhere.net:/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 someuser@some.host.com* get 
/htdocs/testing/EmacsW32Util.html 
d:/DOCUME~1/THEUSER~1/LOCALS~1/Temp/ange-ftp18963gD
     Retrieving 
/ftp:someuser@some.host.com:/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:someuser@some.host.com:/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	other threads:[~2006-03-11 23:34 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-03-11 23:34 Lennart Borgman [this message]
2006-03-12 21:11 ` ange-ftp does not wait for file download to complete Lennart Borgman
2006-03-13 12:55   ` Richard Stallman

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

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

  git send-email \
    --in-reply-to=44135E96.3050103@student.lu.se \
    --to=lennart.borgman.073@student.lu.se \
    /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 external index

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

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.