Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Expect "spawn" command hangs in HPUX

Status
Not open for further replies.

jack6395

Technical User
Nov 15, 2013
1
HPUX version 11iV3 (B.11.31)
Expect version 5.45
All dependencies for Expect loaded properly.

I have just loaded expect and eventually want to use it connect to an sFTP server that I do not manage. The vendor who manages the sFTP server uses only password authentication, not key exchange.

I've tested a simple script (see below) and will expand on it when I get it to work.
Manually connecting to the sFTP server works fine.

When running the Expect script, it hangs at the spawn command until I issue a control C, which of course also terminates the program. I have tested this with several spawned commands including telnet, and ksh. It doesn't seem to matter what it tries to spawn, it still hangs.

I have googled this issue and found only two similar issues, one was related to a bug in Cygwin, the other was resolved by spawning a ksh shell and then using "send" to send a telnet command. But the Cygwin bug does not apply to HPUX and spawning a shell results in the same problem.


I suspect an HPUX bug, but can't confirm that and don't know what to do if it is.
Any help would be greatly appreciated.

Here is the basic script (user name, password, and server redacted):
#!/usr/local/bin/expect -d
spawn "user@server.com"
expect "password:"
send "password\n"
expect "sftp>"
send "mget *.* \r"
expect "sftp>"
send "quit \r

And here is the debug:
expect version 5.45
argv[0] = /usr/local/bin/expect argv[1] = -d argv[2] = ./sftptest
set argc 0
set argv0 "./sftptest"
set argv ""
executing commands from command file ./sftptest
spawn sftp user@server.com
parent: waiting for sync byte

<----- Hangs here forever until I issue Control C

parent: telling child to go ahead
parent: now unsynchronized from child
spawn: returns {9247}
sighandler: handling signal(2)
async event handler: Tcl_Eval(exit 130)

--------------------------------------------

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top