[comp.sys.xerox] TCPFTP & Host Names

lane@SUMEX-AIM.STANFORD.EDU (Christopher Lane) (11/19/88)

Starting with Lyric and continuing with Medley, we started not being able to
use TCP FTP with various of our Unix server hosts.  After pulling apart the
'Envos' TCPFTP LispLibrary module, I located the function causing the problem.

Apparently, the function \TCPFTP.INPUT behaves abnormally if your host name
has a "-" (hyphen) it.  All the hosts we lost contact with were Unix TCP-only
hosts with hyphens in their name.  Most recently, we lost contact with our
SUN4 when its name was changed to SUMEX-AIM several weeks ago.

The function continues to parse the TCPFTP command line well into the comment
portion and hits the hyphen and treats it as some kind of delimiter (i.e.
beyond the number in the "220 0 sumex-aim FTP server (SunOS 4.0/1) ready."
line).  However, for some reason yet to be explained, (FTPDEBUG T) makes the
problem go away.

The patched version of \TCPFTP.INPUT below fixes the problem and no evil side
effects from it have turned up yet (unfortunately we have to use Lyric sources
to patch Medley bugs).  However, it is a crude patch and I only recommend it
to sites that have lost contact with hosts due to hyphens in their names.  We,
of course, hope for an official Envos workaround for the problem.

- Christopher

PS: The only significant difference between the function below and the
original is the 'to 3' addition to the 'do' loop, other differences are due to
rewritting the function for clarity.  This assumes that TCPFTP command numbers
are less than 999, otherwise the '3' will need to be increased (or find the
real reason the loop doesn't terminate after the number is read).

(DEFINEQ

(\TCPFTP.INPUT
  [LAMBDA (STREAM)                     (* ; "Edited 17-Nov-88 15:16 by cdl")
    (DECLARE (GLOBALVARS FTPDEBUGFLG FTPDEBUGLOG))
    (LET (CCODE (RESULT 0))
         (to 3 do (SETQ CCODE (BIN STREAM))
                  [if (AND (GEQ CCODE (CHARCODE 0)) (LEQ CCODE (CHARCODE 9)))
                   then (SETQ RESULT (PLUS (TIMES RESULT 10)
                                           (DIFFERENCE CCODE (CHARCODE 0]
          repeatuntil (OR (EQ CCODE (CHARCODE SPACE)) (EQ CCODE (CHARCODE -))
                          (EQ CCODE 0))
          finally (if (EQ CCODE (CHARCODE -))
                   then (if FTPDEBUGFLG
                         then (printout FTPDEBUGLOG T "< " RESULT))
                        (DISCARDLINE STREAM)
                        (\TCPFTP.INPUT STREAM)))
         RESULT])
)

welch@TUT.CIS.OHIO-STATE.EDU (Arun Welch) (11/19/88)

>  However, for some reason yet to be explained, (FTPDEBUG T) makes the
>problem go away.

Wierd Science, indeed.  We had been having problems with unix
connections in Lyric just hanging after a while, and discovered that
we didn't have the problem if FTPDEBUG was turned on. It's now our
default setting, and probably explains why I've never seen the bug you
mentioned.  The best explanation I could come up with for our problem
was that it was some sort of wierd timing bug, and the extra time it
took to write out the stuff to the debug window took care of it.
Breaking out the Lanalyzer didn't throw any light on it either. 

...arun

ps.  Isn't it fun trying to debug a problem which doesn't show up when
the debugger switches are turned on :-)?

pps.  I'm slowing building up a collection of patches to the TCP
system, so if any of you out there have any others, let me know.  I
currently have: The patches from lispusers on sumex, our patches to
make TCP domain work, and a couple of patches from England. We might
have to make a <lispusers.TCP> directory...