🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.emacs.bug
Article #87311

ange-ftp can't talk to FTP client; patch included

#87311
From: Jim Blandy
Date: Sat, 01 Oct 1994 02:53
98 lines
4654 bytes
Emacs version 19.27, running on a Sparc with SunOS 4.1.3.

Problem:

No ange-ftp operation works.  Try, for example, C-x C-f
/prep.ai.mit.edu:/pub/gnu.  I'm not sure how widespread the problem
is; ange-ftp works fine on DECstations.


Hypothesis:

For some reason, the tty running the FTP clients in the *ftp ...*
buffers has echoing and nl->cr nl translation turned on.  Every
command ange-ftp sends to a client appears twice in the buffer, and
every line output from the client has an extra ^M at the end of it;
this confuses ange-ftp.

I'll wager that child_setup_tty in sysdep.c is somehow not setting the
tty modes correctly.


Patch:

I think it would be better to fix child_setup_tty, if that's possible,
but I have poked around with it a little bit, and it does indeed seem
to be clearing the appropriate flags in the tty.  I don't see why it
isn't working.

So, as a hack, I define a new variable ange-ftp-setup-term-command,
which contains a command to send to the FTP client when it is started
up.  Setting this variable to the value of
ange-ftp-gateway-setup-term-command in one's .emacs file (or in the
site-init.el file) seems to clear up the problem.

Fri Sep 30 21:49:25 1994  Jim Blandy  <jimb@totoro.bio.indiana.edu>

	* ange-ftp.el (ange-ftp-setup-term-command): New variable.
	(ange-ftp-start-process): If it's set, send it to the client
        once it's started up.

*** ange-ftp.el~	Sun Jul 31 13:22:25 1994
--- ange-ftp.el	Thu Sep 15 12:48:40 1994
*************** (defvar ange-ftp-binary-file-name-regexp
*** 705,710 ****
--- 705,716 ----
  	  "\\.taz$\\|\\.tgz$")
    "*If a file matches this regexp then it is transferred in binary mode.")
  
+ (defvar ange-ftp-setup-term-command nil
+   "Command to send to FTP client to set up terminal modes.
+ If your Internal Ange-ftp buffers have ^M characters at the ends of 
+ the lines, and each command appears twice, try setting this
+ variable to the value of ange-ftp-gateway-setup-term-command.")
+ 
  (defvar ange-ftp-gateway-host nil
    "*Name of host to use as gateway machine when local FTP isn't possible.")
  
*************** (defun ange-ftp-start-process (host user
*** 1787,1795 ****
      (save-excursion
        (set-buffer (process-buffer proc))
        (internal-ange-ftp-mode))
      (set-process-sentinel proc (function ange-ftp-process-sentinel))
      (set-process-filter proc (function ange-ftp-process-filter))
!     (accept-process-output proc)	;wait for ftp startup message
      proc))
  
  (defun internal-ange-ftp-mode ()
--- 1793,1820 ----
      (save-excursion
        (set-buffer (process-buffer proc))
        (internal-ange-ftp-mode))
+     (if ange-ftp-setup-term-command
+ 	(progn
+ 	  (process-send-string proc (concat "!" ange-ftp-setup-term-command))
+ 	  (save-excursion
+ 	    (set-buffer (process-buffer proc))
+ 	    ;; I'm sure there's a better way to do this, but I can't
+ 	    ;; be bothered to find it.  The filter function is nicely
+ 	    ;; set up to look for prompts, check for error messages,
+ 	    ;; etcetera.  However, we can't let the filter function
+ 	    ;; run yet; if the filter function could cope with process
+ 	    ;; output now, we wouldn't need the setup command in the
+ 	    ;; first place.
+ 	    ;; The most serious omission here is error-checking.  What if
+ 	    ;; the FTP client can't be found?
+ 	    (while (progn
+ 		     (goto-char (point-min))
+ 		     (not (looking-at "\\(.\\|\n\\)*ftp>\\(.\\|\n\\)*ftp>")))
+ 	      (accept-process-output proc)))))
      (set-process-sentinel proc (function ange-ftp-process-sentinel))
      (set-process-filter proc (function ange-ftp-process-filter))
!     (if (not ange-ftp-setup-term-command)
! 	(accept-process-output proc))	;wait for ftp startup message
      proc))
  
  (defun internal-ange-ftp-mode ()
Technical Details
Message-ID: <9410010252.AA28470@totoro.bio.indiana.edu>
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!news.kei.com!MathWorks.Com!news.duke.edu!convex!cs.utexas.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!totoro.bio.INdiana.EDU!jimb

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: fb2f1,aefa5245b3e2c25b,start
X-Google-Attributes: gidfb2f1,public
X-Google-ArrivalTime: 1994-09-30 23:28:47 PST
Path: arc1-ca.pugleaf.net!bga.com!news.sprintlink.net!redstone.interpath.net!ddsw1!news.kei.com!MathWorks.Com!news.duke.edu!convex!cs.utexas.edu!math.ohio-state.edu!magnus.acs.ohio-state.edu!cis.ohio-state.edu!totoro.bio.INdiana.EDU!jimb
From: jimb@totoro.bio.INdiana.EDU (Jim Blandy)
Newsgroups: gnu.emacs.bug
Subject: ange-ftp can't talk to FTP client; patch included
Date: 30 Sep 1994 22:53:50 -0400
Organization: GNUs Not Usenet
Lines: 98
Sender: daemon@cis.ohio-state.edu
Approved: bug-gnu-emacs@prep.ai.mit.edu
Distribution: gnu
Message-ID: <9410010252.AA28470@totoro.bio.indiana.edu>