[Bash-completion-devel] Expect buffering fixes

Freddy Vulto fvulto at gmail.com
Sun Feb 28 22:24:27 UTC 2010


On 100226 00:49, Crestez Dan Leonard wrote:
> I pushed a new attempt at this in the expect-fixes branch. It first
> matches a random string then the new prompt as distinct stages. This
> seems to avoid races. Link to code: http://alturl.com/tf7u
> 
> Please test this; it was broken before.

Hmm, still getting errors, e.g.:

    $ ./run completion/awk.exp --debug
    Running ./completion/awk.exp ...
    FAIL: Sync after INT at timeout
    ...

File dbg.log contains this:

---8<-------------------------------------------------------------------
...
expect: does "sync361" (spawn_id exp9) match regular expression ".*sync361$"? yes^M
expect: set expect_out(0,string) "sync361"^M
expect: set expect_out(spawn_id) "exp9"^M
expect: set expect_out(buffer) "sync361"^M
send: sending "\u0019\u0003" to { exp9 }^M
^M
expect: does "" (spawn_id exp9) match regular expression "^(\^C)?\r\n/@$"? no^M
1^H1^M
expect: does "1\u00081" (spawn_id exp9) match regular expression "^(\^C)?\r\n/@$"? no^M
^M
^M
expect: does "1\u00081\r\n" (spawn_id exp9) match regular expression "^(\^C)?\r\n/@$"? no^M
/@^M
expect: does "1\u00081\r\n/@" (spawn_id exp9) match regular expression "^(\^C)?\r\n/@$"? no^M
expect: timed out^M
FAIL: Sync after INT at timeout
...
---8<-------------------------------------------------------------------

Something fishy is going on: from "1^H1^M" it looks like an additional "1" is
inserted, then backspaced ("^H") and then inserted again. At other FAILs this
"1" character is always the last character of the random sync string...?

The problem goes away on bash-3 if I add a tiny `sleep' again just before
sending QUIT/INT:

    sleep .001
    send \031\003;

Then things run ok on both bash-3.2:

    $ time ./runCompletion
            === completion Summary ===

    # of expected passes        351
    # of expected failures      1
    # of unsupported tests      191
    ..., bash-3.2.39(1)-release

    real    1m17.044s
    user    0m10.125s
    sys 0m15.029s

and bash-4:

    $ time ./runCompletion --tool_exec /opt/bash-4.0/bin/bash
            === completion Summary ===

    # of expected passes        350
    # of expected failures      2
    # of unsupported tests      191
    ..., bash-4.0.28(1)-release

    real    1m15.654s
    user    0m9.761s
    sys 0m12.065s


Freddy Vulto
http://fvue.nl



More information about the Bash-completion-devel mailing list