This is the mail archive of the cygwin@cygwin.com mailing list for the Cygwin project.
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
| Other format: | [Raw text] | |
A 40-page expect script I've been maintaining for my department for a
year and a half stopped working when I upgraded to 20021217-1 last
December. I reported it at that time:
http://cygwin.com/ml/cygwin/2002-12/msg01316.html
The same problem still occurs after upgrades to 20021218-1 as well as
20030128-1. When I back out to version 20010117-1, the script resumes
functioning correctly.
The script dies thusly (although the strings displayed after "invalid
command name" and "while executing" vary):
----------------------------------------
expect: does "\r\n=== Received trap ===\r\n" (spawn_id 4) match regular expression "=+ +(Journaled Event [(]C[^:]*: +([0-9]+|0x[0-9A-Fa-f]+), +S[^:]*: +([0-9]+|0x[0-9A-Fa-f]+)[)]) +=+ *[\n\r]+"? no
"=+ +(Received trap) +=+ *[\n\r]+"? yes
expect: set expect_out(0,string) "=== Received trap ===\r\n"
expect: set expect_out(1,string) "Received trap"
expect: set expect_out(spawn_id) "4"
expect: set expect_out(buffer) "\r\n=== Received trap ===\r\n"
===== Received trap =====
expect: does "" (spawn_id 4) match regular expression "^toolname@4840_27_28> "? no
"([^\n\r]*)[\n\r][\n\r]"? no
expect: does "toolname@4840_27_28> \r\n=== Sending set ===\r\n" (spawn_id 4) match regular expression "^toolname@4840_27_28> "? yes
expect: set expect_out(0,string) "toolname@4840_27_28> "
expect: set expect_out(spawn_id) "4"
expect: set expect_out(buffer) "toolname@4840_27_28> "
invalid command name "^C"
while executing
"^A"
invoked from within
"expect_user -nobrace -re "^ *#\[^\n\r]*\[\n\r]+" {
send_log $expect_out(buffer)
} -re "^ *auto-journaling +(on|off) *\[\n\r]+" {
..."
invoked from within
"expect_user {
-re "^ *#\[^\n\r]*\[\n\r]+" {
send_log $expect_out(buffer)
}
-re "^ *auto-journaling +(on|off) *\[\n\r]+" {
se..."
("while" body line 3)
invoked from within
"while { 1 } {
send_user $tool_prompt
expect_user {
-re "^ *#\[^\n\r]*\[\n\r]+" {
send_log $expect_out(buffer)
}
-re "^ *auto-j..."
(file "/usr/local/bin/cneomi" line 1583)
----------------------------------------
What it's attempting to do
First, it matches "===== Received trap =====" via the second regexp in this pattern:
expect_before {
-re "=+ +(Journaled Event \[(]C\[^:]*: +(${num_pat}), +S\[^:]*: +(${num_pat})\[)]) +=+ *\[\n\r]+" {
send_user "\n===== $expect_out(1,string) =====\n"
dump_output
send_special_set $expect_out(2,string) $expect_out(3,string)
}
-re "=+ +(Received trap) +=+ *\[\n\r]+" {
send_user "\n===== $expect_out(1,string) =====\n"
dump_output
}
-re "=+ +(Discarded trap from \"\[0-9.]+\") +=+ *\[\n\r]+" {
send_user "\n===== $expect_out(1,string) =====\n"
dump_output
}
-re "=+ +(Sending set) +=+ *\[\n\r]+" {
send_user "\n===== $expect_out(1,string) =====\n"
dump_output
}
}
Then, it runs dump_output to dump the output from the spawned process
until the tool prompt is encountered. The expect script dies after
matching the prompt string regexp:
proc dump_output {} {
global prompt
set old_before [ expect_before -info ]
set old_after [ expect_after -info ]
expect_before
expect_after
expect {
-re "^${prompt}" {}
-re "(\[^\n\r]*)\[\n\r]\[\n\r]" {
send_user " $expect_out(1,string)\n"
exp_continue
}
}
expect_before -brace $old_before
expect_after -brace $old_after
}
----------------------------------------
Here's what it looks like when it works with version 20010117-1:
expect: does "\r\n=== Received trap ===\r\n" (spawn_id 4) match regular expression "=+ +(Journaled Event [(]C[^:]*: +([0-9]+|0x[0-9A-Fa-f]+), +S[^:]*: +([0-9]+|0x[0-9A-Fa-f]+)[)]) +=+ *[\n\r]+"? no
"=+ +(Received trap) +=+ *[\n\r]+"? yes
expect: set expect_out(0,string) "=== Received trap ===\r\n"
expect: set expect_out(1,string) "Received trap"
expect: set expect_out(spawn_id) "4"
expect: set expect_out(buffer) "\r\n=== Received trap ===\r\n"
===== Received trap =====
expect: does "" (spawn_id 4) match regular expression "^toolname@4840_27_28> "? no
"([^\n\r]*)[\n\r][\n\r]"? no
expect: does "toolname@4840_27_28> \r\n=== Sending set ===\r\n" (spawn_id 4) match regular expression "^toolname@4840_27_28> "? yes
expect: set expect_out(0,string) "toolname@4840_27_28> "
expect: set expect_out(spawn_id) "4"
expect: set expect_out(buffer) "toolname@4840_27_28> "
CNEOMI>
expect: does "\r\n=== Sending set ===\r\n" (spawn_id 4) match regular expression "=+ +(Journaled Event [(]C[^:]*: +([0-9]+|0x[0-9A-Fa-f]+), +S[^:]*: +([0-9]+|0x[0-9A-Fa-f]+)[)]) +=+ *[\n\r]+"? no
"=+ +(Received trap) +=+ *[\n\r]+"? no
"=+ +(Discarded trap from "[0-9.]+") +=+ *[\n\r]+"? no
"=+ +(Sending set) +=+ *[\n\r]+"? yes
expect: set expect_out(0,string) "=== Sending set ===\r\n"
expect: set expect_out(1,string) "Sending set"
expect: set expect_out(spawn_id) "4"
expect: set expect_out(buffer) "\r\n=== Sending set ===\r\n"
===== Sending set =====
----------------------------------------
--
Bradley Holdridge
Attachment:
cygcheck.txt
Description: cygcheck dump
-- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Bug reporting: http://cygwin.com/bugs.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/
| Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
|---|---|---|
| Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |