#31 broken pipe with more introduced in expect-5.43, 5.41 works.

open
None
5
2005-09-20
2005-09-01
No

Hello,
there seems to be a bug introduced in expect-5.43,
where standard output can not be piped to more anymore.

Here is my test and the answer on my system (GNU/Linux
Slackware 10.1, customized, Kernel 2.6.12 on Intel P4):

--------test.tcl--------
set biglist [list somestring somethingelse]

for { set i 0 } { $i < 50 } { incr i } {
lappend biglist more_stuff
}

foreach element $biglist {
puts $element
}
-------------------------

# now use expect 5.41 as interpreter and pipe output
through more

$ /usr/bin/expect
expect1.1> exp_version
5.41.0
expect1.2> exit

$ /usr/bin/expect test.tcl | more

somestring
somethingelse
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
--More--
...

# now test using expect-5.43 as interpreter and pipe
through more

$ /home/claudio/usr/bin/expect
expect1.1> exp_version
5.43.0
expect1.2> exit

$ /home/claudio/usr/bin/expect test.tcl | more
...
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
more_stuff
error writing "stdout": broken pipe
while executing
"puts $element"
("foreach" body line 2)
invoked from within
"foreach element $biglist {
puts $element
}"
(file "test.tcl" line 7)

----------------------------------------------------
This error does not always happen, sometimes I get five
or more clean runs before getting the broken pipe.

Repeated runs with expect-5.41 never show the error.

Discussion

  • Anonymous - 2005-09-05

    Logged In: YES
    user_id=790036

    ERRATA: add

    "package require Expect"

    at the beginning of the script to obtain the error described.

     
  • Jeffrey Hobbs

    Jeffrey Hobbs - 2005-09-05
    • priority: 5 --> 7
    • assigned_to: nobody --> andreas_kupries
     
  • Nobody/Anonymous

    Logged In: NO

    requiring package Expect is not necessary to reproduce the
    error if you use the expect binary as the interpreter.
    If you run the tclsh interpreter, instead, the require
    package Expect line is necessary.

     
  • Hemang Lavana

    Hemang Lavana - 2005-09-17

    Logged In: YES
    user_id=81875

    Hi,

    We are also seeing the same problem on solaris8, expect5.43
    version. Here's a simplied version of the script to
    consistently reproduce this problem:

    godel:153> cat stdout-bug.tcl
    package require Expect
    puts exp_version=[package provide Expect]

    set biglist [string repeat [list somestring somethingelse]
    10000]
    while {1} {
    puts $biglist
    }
    godel:154> /tmp/hlavana/ActiveTcl/bin/tclsh stdout-bug.tcl |
    more
    exp_version=5.43.0
    somestring somethingelsesomestring somethingelsesomestring
    somethingelsesomestri
    ng somethingelsesomestring somet...
    ng somethingelsesomestring somethingelsesomestring
    somethingelsesomestring somet
    error writing "stdout": broken pipe
    while executing
    "puts $biglist"
    ("while" body line 2)
    invoked from within
    "while {1} {
    puts $biglist
    }"
    (file "stdout-bug.tcl" line 5)
    godel:155>

    Hemang.

     
  • Andreas Kupries

    Andreas Kupries - 2005-09-19

    Logged In: YES
    user_id=75003

    Hi Claudio.

    First. I see that you provide me with a version number. Can
    you please provide me with a bit more detail ? I.e. the
    revision number of the Expect sources you retrieved from the
    Expect CVS here at SourceForge (Date).

    Second. I am unable to reproduce the problem on my Llinux
    system and using the CVS Head of Expect here at SF. Neither
    with your script, nor Hemang's. does the message 'broken
    pipe' appear when quit "more" ? Or when "more" is running,
    without you doing anything ? Or do you have to scroll in the
    output of "more" ? (If your big list is not long to require
    scrolling you might extend it to 500 elements). With
    Hemang's script I was able to get the message when I exit
    "more", and Expect is still writing. In that situation I
    actually expect the message, because then the pipe is broken
    and Expect notified of the fact. So that would not be a bug
    IMHO. Hence my questions regarding the detailed timing of
    the message.

     
  • Hemang Lavana

    Hemang Lavana - 2005-09-19

    Logged In: YES
    user_id=81875

    Update: the problem occured as sooned as the output was
    piped to more cmd. I didn't have to press any keys.

    As per Andreas suggestion, I compiled expect from CVS head
    and the problem does NOT occur anymore. This bug can be
    marked as resolved from my side.

    Hemang.

     
  • Anonymous - 2005-09-19

    Logged In: YES
    user_id=790036

    >Hi Claudio.

    Hello,

    >First. I see that you provide me with a version number. Can
    >you please provide me with a bit more detail ? I.e. the
    >revision number of the Expect sources you retrieved from the
    >Expect CVS here at SourceForge (Date).

    I just report a problem in the official 5.43 file release.
    I am distributing my software with the expect source, among
    other packages, with an installer, and I cannot expect(1)
    all users to be able to update the expect version in the
    fullpack release from CVS. I also have to consider package
    dependencies, so I need to rely on a specific offical file
    release.

    >Second. I am unable to reproduce the problem on my Llinux
    >system and using the CVS Head of Expect here at SF.
    >[cut]

    Neither can I. The latest CVS seems to contain a fix already.
    For me, the problem is solved as soon as a new source
    release of expect is available.

    Thanks

    Claudio

     
  • Andreas Kupries

    Andreas Kupries - 2005-09-19

    Logged In: YES
    user_id=75003

    Ok, it was not clear from the bug report that you were using
    Don Libes sources. The Expect sources here in SF may and
    currently do diverge from the official sources, having a
    number of fixes and things which are not in Don's source
    tree yet.

    Note that the problem is solved for you when a new source
    release of expect is available __to which Don has added
    fixes for the problems as well__. While we do send Don the
    fixes we put into the SF CVS, that does not mean that he
    will accept them into his sources. He may do nothing. Or he
    may choose to write his own fixes.

     
  • Anonymous - 2005-09-20

    Logged In: YES
    user_id=790036

    I didn't know that the sf expect project and Don Libes
    releases diverged. But Don Libes appears as a project admin;
    that's a bit confusing.

    I already sent the bug report to Don Libes mail address at
    nist dot gov some eons ago, but he did not answer.

     
  • Andreas Kupries

    Andreas Kupries - 2005-09-20

    Logged In: YES
    user_id=75003

    Note: We do _not_ see ourselves as a fork. More of a branch
    were bugfixes can be added quickly as we need them. Whenever
    a new offficial release comes out it is integrated here.
    That is also why see keep Don as maintainer. He can get the
    code from here, and update stuff here. However he is not so
    fond of CVS and does not like working with it.

     
  • Andreas Kupries

    Andreas Kupries - 2005-09-20
    • priority: 7 --> 5
     

Log in to post a comment.