expect 5.38.0_3 problems

Vivek Khera khera at kcilink.com
Tue Nov 18 07:38:35 PST 2003


Yesterday I updated to the latest expect port, 5.38.0_3, and since
then I've had a lot of failures with spawned processes.

My expect script spawns a telnet and then issues some commands.  Every
so often, the telnet goes into a spin loop, and expect times out on
that command, yet the child expect keeps waiting for the process to
begin.  If I kill the looping telnet, expect gives me an error about a
non-open file handle.  It doens't happen every time, but it is
happening with significant frequency.

This has also happened with an expect script running the "host"
program to see if a name resolves to test if the name server is up.

Has anyone else run into this?  My guess is it has something to do
with TCL 8.4 since that's the only change from the prior version of
expect (I compile without X on this server).

Here's the script to check for an up name server:

--cut here--
#!/usr/local/bin/expect -f
# -*- tcl -*-

# check if the name server is running on the given host.
# return 0 if alive, 2 on timeout, 1 on any other error

# V. Khera <khera at kciLink.com>
# 4-MAR-1995
# $Id: checknameserver,v 1.3 2001/07/05 15:48:24 khera Exp $

exp_version -exit 5.0

if $argc!=1 {
    send_user "usage: checknameserver host\n"
    exit
}

set host $argv

proc systemdead {} {
    puts "The system is dead\r"
    exit 1
}

proc systemdeadto {} {
    puts "The system is not responding quickly\r"
    exit 2
}

proc systemalive {} {
    puts "The system is alive\r"
    exit 0
}

proc systemunknown {} {
    puts "Unknown system name!\r"
    exit 1
}


# see if localhost has an entry

spawn host -t a localhost $host
expect {
    timeout systemdeadto
    "Host not found, try again" systemdead
    "Error in looking up server name" systemunknown
    -re "has address 127\.0\.0\.1" systemalive
}

# if we fall through the cracks, assume the worst
systemdead
--cut here--


More information about the freebsd-ports mailing list