[minicom-Bugs][311260] "expect" command cannot distinguish expected string "timeout" from command "timeout"

minicom-bugs at alioth.debian.org minicom-bugs at alioth.debian.org
Wed Dec 17 01:43:34 UTC 2008


Bugs item #311260, was opened at 2008-11-17 11:49
Status: Open
Priority: 3
Submitted By: jim lee (uukkhh-guest)
Assigned to: Nobody (None)
Summary:  "expect" command cannot distinguish expected string "timeout" from command "timeout"  
Category: None
Group: None
Resolution: None


Initial Comment:
I am sorry if it is a repeated report.

minicom "expect" command may consider another command "timeout", which is frequently used inside "expect", as an expected string! In other words, if the text being searched by "expect" command contains string "timeout", "expect" will try to execute the timeout value as a minicom statement and cause abnormal exit. 

For an example, if use "expect" to automatically login freebsd,

expect {
   "login:"
   timeout 300 goto exit_label
}
send username 

when booting freebsd, the following string appears:

" ...

bridge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> metric 0 mtu 1500

    ether aa:aa:aa:aa:aa:aa id 00:00:00:00:00:00 priority 32768 hellotime 2 fwddelay 15 maxage 20 holdcnt 6 proto rstp maxaddr 100 timeout 1200 root id 00:00:00:00:00:00 priority 32768 ifcost 0 port 0

... " 

The above "timeout" in "... maxaddr 100 timeout 1200 root..." caused minicom script to exit with a mesg of "300 is unknown statement."

I worked around this as follows but do not think it is a permanent solution. I modified src/script.c to replace
if (!strncmp(seq[f]->line, "timeout", 7)){
with
if (!strncmp(seq[f]->line, "timeout", 7)||!strncmp(seq[f]->line, "TiMeOuT", 7)) {
The string "TiMeOuT" is presumed not to appear in the text. 
Can we enforce that all searching strings must be enclosed with quotes?

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

Comment By: Bill Bollenbacher (wcbwcb-guest)
Date: 2008-12-16 17:43

Message:
The correct fix for this would be to remove the timeout command from the seq list after it has been processed to extract the timeout value and action pair.  

Leaving it to be processed later as a pattern is obviously incorrect.



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

You can respond by visiting: 
http://alioth.debian.org/tracker/?func=detail&atid=100031&aid=311260&group_id=30018



More information about the minicom-devel mailing list