Really weird expect problem

From: Fletcher Glenn (fletcher_at_removethisfoglight.com)
Date: 11/01/04


Date: Mon, 01 Nov 2004 17:04:17 GMT

This may be somewhat long-winded, but after I explain the problem, I
must tell you everything that I have examined and tried.

First, the problem:

I'm working on a legacy expect script. This script is huge and
rewriting it is not an option. This script has worked successfully for
years, until I ran into a new situation at a customer site. When the
script telnets into the customer's HPUX machine, it does the strangest
echoing I have ever seen. If I send:

test string\r

I get in return:

test string\ntest string\r\n

Does anyone have any idea why this is happening?

At first glance it would seem that the shell is in echo or verbose mode,
except that I explicitly turn these things off. I've attempted
duplicating this problem locally, and I cannot. Even stranger, when you
telnet to the host from a command line, there's no problem, and you
don't get this strange double echo. If it helps any, the expect script
is operating telnet from a Windows 2000 machine.

One observation is that until the shell is started, everything works
normally - that is, there's no double echo of the username to the login
prompt (of course I can't tell about the password).

Things that I have examined and tried in order to duplicate the problem:
1. I've looked for strange environment variables.
2. I've looked at the parent/child path from inetd to my shell on the HP
machine.
3. I've looked at the shell's verbose and echo and insured that these
things are off.
4. I've determined that the problem is not in the local telnet program
because I've examined each and every telnet option both locally and in
the target machine.
5. I've looked at the tty settings and used the same settings in my
local shop on my HP machines. No luck. One point of interest is that
from the command line the HP machine sees the terminal as "ansi" and
from the expect program it sees the terminal as "unknown".

I'm flat out of ideas. Can anyone suggest something that I should be
examining?

--
Fletcher Glenn


Relevant Pages

  • Telnet script
    ... I need to telnet to an UNIX server with telnet and run a script ... (echo open $$ ...
    (SunManagers)
  • execute script on remote server using telnet
    ... it will kick off what we will call Script. ... My only solution thus far is to use a telnet session to telnet to B ... next command, "echo username". ...
    (comp.unix.aix)
  • Telnet Response via PHP Sockets
    ... on multiple UNIX servers via telnet. ... I've created a script similar to the on found an old post ... echo $output."\n"; ... // Send telnet Header 1 ...
    (comp.lang.php)
  • cUrl working unpredictable (connect failed)
    ... I'm working with cUrl and I'm getting strange results. ... following script, most of the time I get the error "connectfailed" but ... ifecho curl_error; ... I'am working with PHP 4.0.6 and libcurl 7.9.3. ...
    (comp.lang.php)
  • Re: Really weird expect problem (solved)
    ... TERM variable to "ansi" like what happens when using telnet directly. ... > I'm working on a legacy expect script. ... > don't get this strange double echo. ... I've looked for strange environment variables. ...
    (comp.unix.programmer)