unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
* Ftp freezes on w32
@ 2006-11-04 11:21 Lennart Borgman
  2006-11-05  0:29 ` Lennart Borgman
  0 siblings, 1 reply; 18+ messages in thread
From: Lennart Borgman @ 2006-11-04 11:21 UTC (permalink / raw)


I have seen a problem with ftp on w32 which I have not had time to 
report before. The problem is that if I make a small pause for some 
minutes then ftp hangs. Looks like there perhaps is some problem with 
the ftp process. Here is a more detailed description:


I have downloaded the ftp program mentioned on 
http://www.emacswiki.org/cgi-bin/wiki/AngeFtp and my 
ange-ftp-ftp-program-name is c:/dl/ftp-for-win32/Release/ftp.exe. I am 
using w2k on this pc. My CVS Emacs is from 2006-11-03.

I open a remote file with the name 
"/ftp:someuser@ftp.somehost.com:/htdocs/somepath/index.html". After 
doing the first changes to the remote file point is on line 79 in the 
buffer "*ftp someuser@ftp.somehost.com*".

Now I wait maybe 10 min. Then I try again to change the file. Now Emacs 
freezes right after the first character, but C-g helps and the screen 
gets updated again. Looking in the ftp buffer point is still on line 79 
right after the prompt. However now there is some text after the prompt:

  ftp> quote mdtm /htdocs/somepath/index.html

If I in the window showing the ftp buffer now press up arrow I get the 
error message:

  Wrong type argument: processp, nil

Now I try again changing the file. It succeeds and there are about 30 
new lines in the "*ftp someuser@ ..." buffer. Here is the content from 
from some lines above 79 to the end:

  ftp> quote mdtm /htdocs/somepat
  213 20061104043346
  ftp> put d:/DOCUME~1/MYUSER~1/LOCALS~1/Temp/ange-ftp2640lNf 
/htdocs/somepath/index.html
  227 Entering Passive Mode (65,254,250,101,188,193)
  150 Opening ASCII mode data connection for /htdocs/somepath/index.html

  226 Transfer complete.
  698 bytes sent in 0 seconds (0.68 Kbytes/s)
  ftp> quote mdtm /htdocs/somepath/index.html
  213 20061104053139
  ftp> quote mdtm /htdocs/somepath/index.html
  213 20061104053139
  ftp> quote mdtm /htdocs/somepath/index.html
  213 20061104053139
  ftp> quote mdtm /htdocs/somepath/index.html
  213 20061104053139
  ftp> quote mdtm /htdocs/somepath/index.html
  213 20061104053139
  ftp> quote mdtm /htdocs/somepath/index.html
  213 20061104053139

row 79:  ftp> quote mdtm /htdocs/somepath/index.html
  ftp> ?Invalid help command foo
  ftp> open ftp.somehost.com
  Connected to ftp.somehost.com.
  220 Somehost FTP Server ready
  ftp> user "someuser" Turtle Power!
  331 Password required for someuser.
  230 User someuser logged in.
  ftp> hash
  Hash mark printing on (1024 bytes/hash mark).
  ftp> pwd
  257 "/" is current directory.
  ftp> quote mdtm /htdocs/somepath/index.html
  ftp> ?Invalid help command foo
  ftp> open ftp.somehost.com
  Connected to ftp.somehost.com.
  220 Somehost FTP Server ready
  ftp> user "someuser" Turtle Power!
  331 Password required for someuser.
  230 User someuser logged in.
  ftp> hash
  Hash mark printing on (1024 bytes/hash mark).
  ftp> pwd
  257 "/" is current directory.
  ftp> quote mdtm /htdocs/somepath/index.html
  213 20061104053139
  ftp> quote mdtm /htdocs/somepath/index.html
  213 20061104053139
  ftp>

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-04 11:21 Ftp freezes on w32 Lennart Borgman
@ 2006-11-05  0:29 ` Lennart Borgman
  2006-11-05 12:51   ` Lennart Borgman
  0 siblings, 1 reply; 18+ messages in thread
From: Lennart Borgman @ 2006-11-05  0:29 UTC (permalink / raw)


Lennart Borgman wrote:
> I have seen a problem with ftp on w32 which I have not had time to 
> report before. The problem is that if I make a small pause for some 
> minutes then ftp hangs. Looks like there perhaps is some problem with 
> the ftp process. Here is a more detailed description:
>
>
> I have downloaded the ftp program mentioned on 
> http://www.emacswiki.org/cgi-bin/wiki/AngeFtp and my 
> ange-ftp-ftp-program-name is c:/dl/ftp-for-win32/Release/ftp.exe. I am 
> using w2k on this pc. My CVS Emacs is from 2006-11-03.
>
> I open a remote file with the name 
> "/ftp:someuser@ftp.somehost.com:/htdocs/somepath/index.html". After 
> doing the first changes to the remote file point is on line 79 in the 
> buffer "*ftp someuser@ftp.somehost.com*".
>
> Now I wait maybe 10 min. Then I try again to change the file. Now 
> Emacs freezes right after the first character, but C-g helps and the 
> screen gets updated again. Looking in the ftp buffer point is still on 
> line 79 right after the prompt. However now there is some text after 
> the prompt:
>
>  ftp> quote mdtm /htdocs/somepath/index.html
>
> If I in the window showing the ftp buffer now press up arrow I get the 
> error message:
>
>  Wrong type argument: processp, nil

I have looked at this a bit more. The process get killed in 
`ange-ftp-wait-not-busy' so there is no strange with that the process is 
gone.

However what is happening is that the `ange-ftp-wait-not-busy' never 
ends. The process filter in `ange-ftp-process-filter' recieves a string 
with only nulls (in the argument str).

Since this is reproducible it seems possible to make a fix for it. A 
signal can be sent from the process filter and this can be caught in 
`ange-ftp-raw-send'. But it does not seem quite right to me.

Is there not something suspicious about that the process filter receives 
just nulls? Is there something wrong with emacs_read?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-05  0:29 ` Lennart Borgman
@ 2006-11-05 12:51   ` Lennart Borgman
  2006-11-07  1:14     ` Lennart Borgman
  0 siblings, 1 reply; 18+ messages in thread
From: Lennart Borgman @ 2006-11-05 12:51 UTC (permalink / raw)


Lennart Borgman wrote:
> Lennart Borgman wrote:
>> I have seen a problem with ftp on w32 which I have not had time to 
>> report before. The problem is that if I make a small pause for some 
>> minutes then ftp hangs. Looks like there perhaps is some problem with 
>> the ftp process. Here is a more detailed description:
>>
>>
>> I have downloaded the ftp program mentioned on 
>> http://www.emacswiki.org/cgi-bin/wiki/AngeFtp and my 
>> ange-ftp-ftp-program-name is c:/dl/ftp-for-win32/Release/ftp.exe. I 
>> am using w2k on this pc. My CVS Emacs is from 2006-11-03.
>>
>> I open a remote file with the name 
>> "/ftp:someuser@ftp.somehost.com:/htdocs/somepath/index.html". After 
>> doing the first changes to the remote file point is on line 79 in the 
>> buffer "*ftp someuser@ftp.somehost.com*".
>>
>> Now I wait maybe 10 min. Then I try again to change the file. Now 
>> Emacs freezes right after the first character, but C-g helps and the 
>> screen gets updated again. Looking in the ftp buffer point is still 
>> on line 79 right after the prompt. However now there is some text 
>> after the prompt:
>>
>>  ftp> quote mdtm /htdocs/somepath/index.html
>>
>> If I in the window showing the ftp buffer now press up arrow I get 
>> the error message:
>>
>>  Wrong type argument: processp, nil
>
> I have looked at this a bit more. The process get killed in 
> `ange-ftp-wait-not-busy' so there is no strange with that the process 
> is gone.
>
> However what is happening is that the `ange-ftp-wait-not-busy' never 
> ends. The process filter in `ange-ftp-process-filter' recieves a 
> string with only nulls (in the argument str).
>
> Since this is reproducible it seems possible to make a fix for it. A 
> signal can be sent from the process filter and this can be caught in 
> `ange-ftp-raw-send'. But it does not seem quite right to me.
>
> Is there not something suspicious about that the process filter 
> receives just nulls? Is there something wrong with emacs_read?

Some more information.

Workaround: It is possible to workaround the problem by simply deleting 
the inferior ftp process in `ange-ftp-process-filter' when a string with 
just a lot of nulls is recieved.

However it looks to me like there is a more general bug involved here. 
If I run the ftp program above in just a w32 command window (cmd.exe) it 
looks like this

  C:\dl\ftp-for-win32\Release>ftp.exe
  ftp> open ftp.somehost.com
  Connected to ftp.somehost.com.
  220 somehost FTP Server ready
  Name (ftp.somehost.com:none): someuser
  331 Password required for someuser.
  Password:
  230 User someuser logged in.
  ftp> hash
  Hash mark printing on (1024 bytes/hash mark).
  ftp> pwd
  257 "/" is current directory.
  ftp> quote mdtm /htdocs/BalkanFotter/index.html
  213 20061104161649

Now I wait a bit more than 300 s and then try getting mode time again:

  ftp> quote mdtm /htdocs/BalkanFotter/index.html
  421 No Transfer Timeout (300 seconds): closing control connection.
  ftp>

If I try the last command in the ftp buffer instead then I get no 
response. Looking at Windows Task Manager I can see that both Emacs and 
the ftp process are active.

My guess is that the ftp process sends the line "421 ..." to standard 
error and that Emacs somehow misses this. Seems like a bug in either the 
ftp program or Emacs.

Could someone please comment on this?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-05 12:51   ` Lennart Borgman
@ 2006-11-07  1:14     ` Lennart Borgman
  2006-11-07  8:13       ` Lennart Borgman
                         ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: Lennart Borgman @ 2006-11-07  1:14 UTC (permalink / raw)
  Cc: Emacs Devel

Lennart Borgman wrote:
> Lennart Borgman wrote:
>> Lennart Borgman wrote:
>>> I have seen a problem with ftp on w32 which I have not had time to 
>>> report before. The problem is that if I make a small pause for some 
>>> minutes then ftp hangs. Looks like there perhaps is some problem 
>>> with the ftp process. Here is a more detailed description:
>>>
>>>
>>> I have downloaded the ftp program mentioned on 
>>> http://www.emacswiki.org/cgi-bin/wiki/AngeFtp and my 
>>> ange-ftp-ftp-program-name is c:/dl/ftp-for-win32/Release/ftp.exe. I 
>>> am using w2k on this pc. My CVS Emacs is from 2006-11-03.
>>>
>>> I open a remote file with the name 
>>> "/ftp:someuser@ftp.somehost.com:/htdocs/somepath/index.html". After 
>>> doing the first changes to the remote file point is on line 79 in 
>>> the buffer "*ftp someuser@ftp.somehost.com*".
>>>
>>> Now I wait maybe 10 min. Then I try again to change the file. Now 
>>> Emacs freezes right after the first character, but C-g helps and the 
>>> screen gets updated again. Looking in the ftp buffer point is still 
>>> on line 79 right after the prompt. However now there is some text 
>>> after the prompt:
>>>
>>>  ftp> quote mdtm /htdocs/somepath/index.html
>>>
>>> If I in the window showing the ftp buffer now press up arrow I get 
>>> the error message:
>>>
>>>  Wrong type argument: processp, nil
>>
>> I have looked at this a bit more. The process get killed in 
>> `ange-ftp-wait-not-busy' so there is no strange with that the process 
>> is gone.
>>
>> However what is happening is that the `ange-ftp-wait-not-busy' never 
>> ends. The process filter in `ange-ftp-process-filter' recieves a 
>> string with only nulls (in the argument str).
>>
>> Since this is reproducible it seems possible to make a fix for it. A 
>> signal can be sent from the process filter and this can be caught in 
>> `ange-ftp-raw-send'. But it does not seem quite right to me.
>>
>> Is there not something suspicious about that the process filter 
>> receives just nulls? Is there something wrong with emacs_read?
>
> Some more information.
>
> Workaround: It is possible to workaround the problem by simply 
> deleting the inferior ftp process in `ange-ftp-process-filter' when a 
> string with just a lot of nulls is recieved.

I was wrong when I said I can work around the problem by deleting the 
inferior ftp process. I can't because I can not get rid of the ftp 
process. It seems impossible in Emacs on w32.

Does someone have any reciepe how to get ange-ftp to work on w32? I do 
not know of any way to get it working.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-07  1:14     ` Lennart Borgman
@ 2006-11-07  8:13       ` Lennart Borgman
  2006-11-07  8:23       ` Lennart Borgman
  2006-11-07  8:25       ` Lennart Borgman
  2 siblings, 0 replies; 18+ messages in thread
From: Lennart Borgman @ 2006-11-07  8:13 UTC (permalink / raw)


Lennart Borgman wrote:
>
> I was wrong when I said I can work around the problem by deleting the 
> inferior ftp process. I can't because I can not get rid of the ftp 
> process. It seems impossible in Emacs on w32.
>
> Does someone have any reciepe how to get ange-ftp to work on w32? I do 
> not know of any way to get it working.

Forgot to say that kill-process does not kill the process immediately on 
w32. Is that a bug or by purpose?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-07  1:14     ` Lennart Borgman
  2006-11-07  8:13       ` Lennart Borgman
@ 2006-11-07  8:23       ` Lennart Borgman
  2006-11-07 15:29         ` Lennart Borgman
  2006-11-07  8:25       ` Lennart Borgman
  2 siblings, 1 reply; 18+ messages in thread
From: Lennart Borgman @ 2006-11-07  8:23 UTC (permalink / raw)


Lennart Borgman wrote:
>
> I was wrong when I said I can work around the problem by deleting the 
> inferior ftp process. I can't because I can not get rid of the ftp 
> process. It seems impossible in Emacs on w32.
>
> Does someone have any reciepe how to get ange-ftp to work on w32? I do 
> not know of any way to get it working.

Forgot to say that kill-process does not kill the process immediately on 
w32. Is that a bug or by purpose?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-07  1:14     ` Lennart Borgman
  2006-11-07  8:13       ` Lennart Borgman
  2006-11-07  8:23       ` Lennart Borgman
@ 2006-11-07  8:25       ` Lennart Borgman
  2 siblings, 0 replies; 18+ messages in thread
From: Lennart Borgman @ 2006-11-07  8:25 UTC (permalink / raw)


Lennart Borgman wrote:
>
> I was wrong when I said I can work around the problem by deleting the 
> inferior ftp process. I can't because I can not get rid of the ftp 
> process. It seems impossible in Emacs on w32.
>
> Does someone have any reciepe how to get ange-ftp to work on w32? I do 
> not know of any way to get it working.

Forgot to say that kill-process does not kill the process immediately on 
w32. Is that a bug or by purpose?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-07  8:23       ` Lennart Borgman
@ 2006-11-07 15:29         ` Lennart Borgman
  2006-11-07 16:53           ` Jason Rumney
  2006-11-07 17:00           ` Stuart D. Herring
  0 siblings, 2 replies; 18+ messages in thread
From: Lennart Borgman @ 2006-11-07 15:29 UTC (permalink / raw)
  Cc: Juanma Barranquero, Eli Zaretskii, Jason Rumney

Lennart Borgman wrote:
> Lennart Borgman wrote:
>>
>> I was wrong when I said I can work around the problem by deleting the 
>> inferior ftp process. I can't because I can not get rid of the ftp 
>> process. It seems impossible in Emacs on w32.
>>
>> Does someone have any reciepe how to get ange-ftp to work on w32? I 
>> do not know of any way to get it working.
>
> Forgot to say that kill-process does not kill the process immediately 
> on w32. Is that a bug or by purpose?

Am I the only person here using ange-ftp (through tramp of course) on w32???

I have tried a couple of workarounds, but none has worked as I wish yet. 
What I thought would work was to kill and restart the ange ftp process 
in ange-ftp-send-cmd when ange-ftp-process-filter finds that the  ftp 
process sends just nulls. I tried something like this then

    (delete-process proc)
   (while (not (eq 'exit (process-status proc)))
     (sit-for 1)
     (sleep-for 1) ;; Hope one of them works
    (message "process-status=%s" (process-status proc)))

This just loops and tells that the process is "signaled". Is there 
something else I can do here? (I have tried kill-process too with the 
same result.) I thought that sit-for or sleep-for would give Emacs a 
chance to finish the ftp process, but it does not seem so.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-07 15:29         ` Lennart Borgman
@ 2006-11-07 16:53           ` Jason Rumney
  2006-11-07 17:02             ` Lennart Borgman
  2006-11-07 17:00           ` Stuart D. Herring
  1 sibling, 1 reply; 18+ messages in thread
From: Jason Rumney @ 2006-11-07 16:53 UTC (permalink / raw)
  Cc: Juanma Barranquero, Eli Zaretskii, Emacs Devel

Lennart Borgman wrote:
> Am I the only person here using ange-ftp (through tramp of course) on 
> w32???

You said at the start of the thread that you were using it with a 
non-standard port of an ftp client. I use it occassionally with the 
default Windows ftp client and have never seen such problems. It is just 
as likely that your problems are caused by the non-standard version of 
ftp that you are using.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-07 15:29         ` Lennart Borgman
  2006-11-07 16:53           ` Jason Rumney
@ 2006-11-07 17:00           ` Stuart D. Herring
  2006-11-07 18:45             ` Lennart Borgman
  1 sibling, 1 reply; 18+ messages in thread
From: Stuart D. Herring @ 2006-11-07 17:00 UTC (permalink / raw)
  Cc: Juanma Barranquero, Eli Zaretskii, Jason Rumney, Emacs Devel

> Am I the only person here using ange-ftp (through tramp of course) on
> w32???

I may have some helpful comments on your previous email, but they're not
solid yet.  For now:

> I have tried a couple of workarounds, but none has worked as I wish yet.
> What I thought would work was to kill and restart the ange ftp process
> in ange-ftp-send-cmd when ange-ftp-process-filter finds that the  ftp
> process sends just nulls. I tried something like this then
>
>     (delete-process proc)
>    (while (not (eq 'exit (process-status proc)))
>      (sit-for 1)
>      (sleep-for 1) ;; Hope one of them works
>     (message "process-status=%s" (process-status proc)))
>
> This just loops and tells that the process is "signaled". Is there
> something else I can do here? (I have tried kill-process too with the
> same result.) I thought that sit-for or sleep-for would give Emacs a
> chance to finish the ftp process, but it does not seem so.

Look at the docs for `process-status'.  A return of `signal' means that
the process -is dead-, and that it was killed by a signal (rather than
exiting of its own volition, which yields `exit').  You got exactly what
you wanted.  (You can check which signal killed it with
`process-exit-status'.)

Davis

-- 
This product is sold by volume, not by mass.  If it appears too dense or
too sparse, it is because mass-energy conversion has occurred during
shipping.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-07 16:53           ` Jason Rumney
@ 2006-11-07 17:02             ` Lennart Borgman
  0 siblings, 0 replies; 18+ messages in thread
From: Lennart Borgman @ 2006-11-07 17:02 UTC (permalink / raw)
  Cc: Juanma Barranquero, Eli Zaretskii, Emacs Devel

Jason Rumney wrote:
> Lennart Borgman wrote:
>> Am I the only person here using ange-ftp (through tramp of course) on 
>> w32???
>
> You said at the start of the thread that you were using it with a 
> non-standard port of an ftp client. I use it occassionally with the 
> default Windows ftp client and have never seen such problems. It is 
> just as likely that your problems are caused by the non-standard 
> version of ftp that you are using.
>

Yes, it could be. But the default ftp client on w2k does not work for 
me, see http://www.emacswiki.org/cgi-bin/wiki/AngeFtp. What w32 version 
are you using?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-07 17:00           ` Stuart D. Herring
@ 2006-11-07 18:45             ` Lennart Borgman
  2006-11-07 22:30               ` Lennart Borgman
  0 siblings, 1 reply; 18+ messages in thread
From: Lennart Borgman @ 2006-11-07 18:45 UTC (permalink / raw)
  Cc: Juanma Barranquero, Eli Zaretskii, Jason Rumney, Emacs Devel

Stuart D. Herring wrote:
> Look at the docs for `process-status'.  A return of `signal' means that
> the process -is dead-, and that it was killed by a signal (rather than
> exiting of its own volition, which yields `exit').  You got exactly what
> you wanted.  (You can check which signal killed it with
> `process-exit-status'.)
>
> Davis
>   

Ah! Thanks, I just tried and at least my workaround now works.

I thought that that 'signal meant dying ....

Now, my workaround (which is the only way I currently know of getting 
this working with w2k) is as follows:

1) Throw to a tag in ange-ftp-process-filter if the ftp process seems 
out of order (waiting, only nulls and more than 20 characters is my 
current test)
2) Catch this in ange-ftp-send-cmd and call delete-process there and 
then let ange-ftp-get-process restart the ftp process

Is this something we want in ange-ftp? If not I believe we should give a 
reciepe for how to get ange-ftp working, but I am not sure how this 
should look. What I do know is that this does not work OTB for all w2k 
users, see the page on EmacsWiki that I mentioned before.

The ftp program I am using is from 
ftp.gnu.org/old-gnu/emacs/windows/contrib/ftp-for-win32.zip.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-07 18:45             ` Lennart Borgman
@ 2006-11-07 22:30               ` Lennart Borgman
  2006-11-08  4:08                 ` Eli Zaretskii
  0 siblings, 1 reply; 18+ messages in thread
From: Lennart Borgman @ 2006-11-07 22:30 UTC (permalink / raw)
  Cc: Juanma Barranquero, Eli Zaretskii, Emacs Devel, Jason Rumney

Lennart Borgman wrote:
> Stuart D. Herring wrote:
>> Look at the docs for `process-status'.  A return of `signal' means that
>> the process -is dead-, and that it was killed by a signal (rather than
>> exiting of its own volition, which yields `exit').  You got exactly what
>> you wanted.  (You can check which signal killed it with
>> `process-exit-status'.)
>>
>> Davis
>>   
>
> Ah! Thanks, I just tried and at least my workaround now works.
>
> I thought that that 'signal meant dying ....
>
> Now, my workaround (which is the only way I currently know of getting 
> this working with w2k) is as follows:
>
> 1) Throw to a tag in ange-ftp-process-filter if the ftp process seems 
> out of order (waiting, only nulls and more than 20 characters is my 
> current test)
> 2) Catch this in ange-ftp-send-cmd and call delete-process there and 
> then let ange-ftp-get-process restart the ftp process
>
> Is this something we want in ange-ftp? If not I believe we should give 
> a reciepe for how to get ange-ftp working, but I am not sure how this 
> should look. What I do know is that this does not work OTB for all w2k 
> users, see the page on EmacsWiki that I mentioned before.
>
> The ftp program I am using is from 
> ftp.gnu.org/old-gnu/emacs/windows/contrib/ftp-for-win32.zip.

(Hope I do not send this two times. Thunderbird got upset by some
problems with the SMTP server.)

FYI: I have included a patch doing the things above in the
Emacs+EmacsW32 distribution, see http://ourcomments.org/Emacs/EmacsW32.html.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-07 22:30               ` Lennart Borgman
@ 2006-11-08  4:08                 ` Eli Zaretskii
  2006-11-08  7:20                   ` Lennart Borgman
  2006-11-09  0:53                   ` Richard Stallman
  0 siblings, 2 replies; 18+ messages in thread
From: Eli Zaretskii @ 2006-11-08  4:08 UTC (permalink / raw)
  Cc: lekktu, jasonr, emacs-devel

> Date: Tue, 07 Nov 2006 23:30:40 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> Cc: Juanma Barranquero <lekktu@gmail.com>, Eli Zaretskii <eliz@gnu.org>,
> 	Emacs Devel <emacs-devel@gnu.org>, Jason Rumney <jasonr@gnu.org>
> 
> FYI: I have included a patch doing the things above in the
> Emacs+EmacsW32 distribution, see http://ourcomments.org/Emacs/EmacsW32.html.

I think it's not a good idea to have changes in your version that are
not in the official code base.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-08  4:08                 ` Eli Zaretskii
@ 2006-11-08  7:20                   ` Lennart Borgman
  2006-11-09  4:23                     ` Eli Zaretskii
  2006-11-09  0:53                   ` Richard Stallman
  1 sibling, 1 reply; 18+ messages in thread
From: Lennart Borgman @ 2006-11-08  7:20 UTC (permalink / raw)
  Cc: lekktu, emacs-devel, jasonr

Eli Zaretskii wrote:
>> Date: Tue, 07 Nov 2006 23:30:40 +0100
>> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
>> Cc: Juanma Barranquero <lekktu@gmail.com>, Eli Zaretskii <eliz@gnu.org>,
>> 	Emacs Devel <emacs-devel@gnu.org>, Jason Rumney <jasonr@gnu.org>
>>
>> FYI: I have included a patch doing the things above in the
>> Emacs+EmacsW32 distribution, see http://ourcomments.org/Emacs/EmacsW32.html.
>>     
>
> I think it's not a good idea to have changes in your version that are
> not in the official code base.
>   

So what is your suggestion?

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-08  4:08                 ` Eli Zaretskii
  2006-11-08  7:20                   ` Lennart Borgman
@ 2006-11-09  0:53                   ` Richard Stallman
  1 sibling, 0 replies; 18+ messages in thread
From: Richard Stallman @ 2006-11-09  0:53 UTC (permalink / raw)
  Cc: lennart.borgman.073, jasonr, emacs-devel, lekktu

    > FYI: I have included a patch doing the things above in the
    > Emacs+EmacsW32 distribution, see http://ourcomments.org/Emacs/EmacsW32.html.

    I think it's not a good idea to have changes in your version that are
    not in the official code base.

That is right.  We want OUR RELEASE to be tested.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-08  7:20                   ` Lennart Borgman
@ 2006-11-09  4:23                     ` Eli Zaretskii
  2006-11-12 12:13                       ` Lennart Borgman
  0 siblings, 1 reply; 18+ messages in thread
From: Eli Zaretskii @ 2006-11-09  4:23 UTC (permalink / raw)
  Cc: lekktu, emacs-devel, jasonr

> Date: Wed, 08 Nov 2006 08:20:45 +0100
> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
> CC:  lekktu@gmail.com,  jasonr@gnu.org,  emacs-devel@gnu.org
> >
> > I think it's not a good idea to have changes in your version that are
> > not in the official code base.
> >   
> 
> So what is your suggestion?

Either convince us to install your changes in the CVS, or wait with
the change until after the release and get it into CVS then.

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: Ftp freezes on w32
  2006-11-09  4:23                     ` Eli Zaretskii
@ 2006-11-12 12:13                       ` Lennart Borgman
  0 siblings, 0 replies; 18+ messages in thread
From: Lennart Borgman @ 2006-11-12 12:13 UTC (permalink / raw)
  Cc: lekktu, emacs-devel, jasonr

[-- Attachment #1: Type: text/plain, Size: 895 bytes --]

Eli Zaretskii wrote:
>> Date: Wed, 08 Nov 2006 08:20:45 +0100
>> From: Lennart Borgman <lennart.borgman.073@student.lu.se>
>> CC:  lekktu@gmail.com,  jasonr@gnu.org,  emacs-devel@gnu.org
>>     
>>> I think it's not a good idea to have changes in your version that are
>>> not in the official code base.
>>>   
>>>       
>> So what is your suggestion?
>>     
>
> Either convince us to install your changes in the CVS, or wait with
> the change until after the release and get it into CVS then.
>   

Ok. My main argument is that I can find no way to get ange-ftp to work 
on w2k (at least on my pc) without something like this patch. The patch 
is also quite general in its structure so it can perhaps be used for 
other problems with the ftp process.

And it is quite small. In the attached patch I did not remove my trace 
functions. They should of course not be there in the final version.

[-- Attachment #2: ange-ftp-nulls.diff --]
[-- Type: text/plain, Size: 5884 bytes --]

Index: ange-ftp.el
===================================================================
RCS file: /cvsroot/emacs/emacs/lisp/net/ange-ftp.el,v
retrieving revision 1.80
diff -u -r1.80 ange-ftp.el
--- ange-ftp.el	6 Feb 2006 11:33:04 -0000	1.80
+++ ange-ftp.el	11 Nov 2006 14:22:59 -0000
@@ -1641,10 +1641,43 @@
 ;; Build up a complete line of output from the ftp PROCESS and pass it
 ;; on to ange-ftp-process-handle-line to deal with.
 
+(defvar ange-ftp-proc-trace nil)
+(defvar ange-ftp-proc-trace-on nil)
+;;(setq ange-ftp-proc-trace-on t) <-
+(defun ange-ftp-add-to-proc-trace(str)
+  (when ange-ftp-proc-trace-on
+    (setq ange-ftp-proc-trace (cons str ange-ftp-proc-trace))))
+(defun ange-ftp-show-proc-trace()
+  (interactive)
+  (let ((buf (get-buffer-create "ange-ftp-proc-trace")))
+    (with-current-buffer buf
+      (erase-buffer)
+      (insert (format "%s" (apply 'concat ange-ftp-proc-trace))))
+    (switch-to-buffer-other-window buf)))
+
 (defun ange-ftp-process-filter (proc str)
   ;; Eliminate nulls.
-  (while (string-match "\000+" str)
-    (setq str (replace-match "" nil nil str)))
+  ;;
+  ;; Also check if the ftp process seems ok.  If it is not ok throw
+  ;; `ange-ftp-proc-defunct' which will be caught by
+  ;; `ange-ftp-raw-send' that will then restart the ftp process.
+  ;;
+  ;; On w32 when the ftp program from gnu
+  ;; (ftp://ftp.gnu.org/old-gnu/emacs/windows/contrib/ftp-for-win32.zip)
+  ;; is used Emacs will read a string consisting of only nulls after
+  ;; the ftp program has timed out.  The only way I have found to cure
+  ;; this is to delete the ftp process.
+  (ange-ftp-add-to-proc-trace (format "str=%s\n" str))
+  (let ((str-len (length str)))
+    (while (string-match "\000+" str)
+      (setq str (replace-match "" nil nil str)))
+    (when (and (boundp 'ange-ftp-check-proc-ok)
+               ange-ftp-check-proc-ok
+               (cond ((eq system-type 'windows-nt)
+                      (and
+                       (= 0 (length str))
+                       (< 20 str-len)))))
+      (throw 'ange-ftp-proc-defunct t)))
 
   ;; see if the buffer is still around... it could have been deleted.
   (when (buffer-live-p (process-buffer proc))
@@ -2277,7 +2310,9 @@
 	(ange-ftp-this-user user)
 	(ange-ftp-this-host host)
 	(ange-ftp-this-msg msg)
-	cmd2 cmd3 host-type fix-name-func result)
+	cmd2 cmd3 host-type fix-name-func result
+        (sent-sts nil)
+        (sent-res nil))
 
     (cond
 
@@ -2365,37 +2400,55 @@
 		      (and cmd2 (concat " " cmd2))))
 
     ;; Actually send the resulting command.
-    (if (and (consp result) (null (car result)))
-	;; `ange-ftp-cd' has failed, so there's no point sending `cmd'.
-	result
-      (let (afsc-result
-	    afsc-line)
-	(ange-ftp-raw-send-cmd
-	 (ange-ftp-get-process host user)
-	 cmd
-	 msg
-	 (list (lambda (result line host user cmd msg cont nowait)
-		 (or cont (setq afsc-result result
-				afsc-line line))
-		 (if result (ange-ftp-call-cont cont result line)
-                   (ange-ftp-raw-send-cmd
-                    (ange-ftp-get-process host user)
-                    cmd
-                    msg
-                    (list (lambda (result line cont)
-                            (or cont (setq afsc-result result
-                                           afsc-line line))
-                            (ange-ftp-call-cont cont result line))
-                          cont)
-		    nowait)))
-	       host user cmd msg cont nowait)
-	 nowait)
-
-	(if nowait
-	    nil
-	  (if cont
-	      nil
-	    (cons afsc-result afsc-line)))))))
+    (while (memq sent-sts '(nil tried))
+      (when (eq sent-sts 'tried)
+        ;; Delete ftp process if send failed before, it will be
+        ;; restarted by `ange-ftp-get-process'.
+        (message "Ftp process possibly defunct, deleting it ...")
+        (ange-ftp-add-to-proc-trace "\n********* DEFUNCT killing ftp process\\n")
+        (let* ((proc (ange-ftp-get-process host user))
+               (delete-exited-processes t))
+          (delete-process proc)))
+      (if (and (consp result) (null (car result)))
+          ;; `ange-ftp-cd' has failed, so there's no point sending `cmd'.
+          (progn
+            (setq sent-res result)
+            (setq sent-sts 'failed))
+        (let (afsc-result
+              afsc-line
+              (ange-ftp-check-proc-ok (not nowait)))
+          (catch 'ange-ftp-proc-defunct
+            (setq sent-sts 'tried)
+            ;; May throw 'ange-ftp-proc-defunct:
+            (ange-ftp-add-to-proc-trace (format "cmd=%s\n" cmd))
+            (ange-ftp-raw-send-cmd
+             (ange-ftp-get-process host user)
+             cmd
+             msg
+             (list (lambda (result line host user cmd msg cont nowait)
+                     (or cont (setq afsc-result result
+                                    afsc-line line))
+                     (if result (ange-ftp-call-cont cont result line)
+                       (ange-ftp-raw-send-cmd
+                        (ange-ftp-get-process host user)
+                        cmd
+                        msg
+                        (list (lambda (result line cont)
+                                (or cont (setq afsc-result result
+                                               afsc-line line))
+                                (ange-ftp-call-cont cont result line))
+                              cont)
+                        nowait)))
+                   host user cmd msg cont nowait)
+             nowait)
+
+            (setq sent-sts 'ok)
+            (if nowait
+                (setq sent-res nil)
+              (if cont
+                  (setq sent-res nil)
+                (setq sent-res (cons afsc-result afsc-line))))))))
+    sent-res))
 
 ;; It might be nice to message users about the host type identified,
 ;; but there is so much other messaging going on, it would not be

[-- Attachment #3: Type: text/plain, Size: 142 bytes --]

_______________________________________________
Emacs-devel mailing list
Emacs-devel@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-devel

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2006-11-12 12:13 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-11-04 11:21 Ftp freezes on w32 Lennart Borgman
2006-11-05  0:29 ` Lennart Borgman
2006-11-05 12:51   ` Lennart Borgman
2006-11-07  1:14     ` Lennart Borgman
2006-11-07  8:13       ` Lennart Borgman
2006-11-07  8:23       ` Lennart Borgman
2006-11-07 15:29         ` Lennart Borgman
2006-11-07 16:53           ` Jason Rumney
2006-11-07 17:02             ` Lennart Borgman
2006-11-07 17:00           ` Stuart D. Herring
2006-11-07 18:45             ` Lennart Borgman
2006-11-07 22:30               ` Lennart Borgman
2006-11-08  4:08                 ` Eli Zaretskii
2006-11-08  7:20                   ` Lennart Borgman
2006-11-09  4:23                     ` Eli Zaretskii
2006-11-12 12:13                       ` Lennart Borgman
2006-11-09  0:53                   ` Richard Stallman
2006-11-07  8:25       ` Lennart Borgman

Code repositories for project(s) associated with this public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).