[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[bug-mailutils] Re: Tracking down EIO problem when invoking external com

From: Ben Elliston
Subject: [bug-mailutils] Re: Tracking down EIO problem when invoking external commands via dejagnu
Date: Tue, 15 Mar 2011 10:07:48 +1100
User-agent: Mutt/1.5.20 (2009-06-14)

On Sat, Aug 23, 2008 at 01:55:30PM +0200, Simon Josefsson wrote:

> This may be a tcl or expect bug, but I suspect 'local_exec' in
> DejaGnu's remote.exp is the problem.  I've created a small snippet
> that reproduce the problem.  It contains a stripped down copy of
> local_exec.  Here's the output:

It turns out that HJ Lu supplied a patch way back, but it fell through
the cracks (it seems it has been patched into the Fedora DejaGNU
package, though).

Here is the patch that I am committing now.  Sorry, HJ.

2011-03-15  H.J. Lu  <address@hidden>

        * lib/remote.exp (local_exec): Ignore SIGHUP.

diff --git a/lib/remote.exp b/lib/remote.exp
index f0bf269..e270f85 100644
--- a/lib/remote.exp
+++ b/lib/remote.exp
@@ -86,11 +86,15 @@ proc local_exec { commandline inp outp timeout } {
     # doesn't assign process groups correctly and we can't reliably kill
     # programs that bear children. We can't use tcl's exec because it has
     # no way to timeout programs that hang. *sigh*
+    #
+    # The expect command will close the connection when it sees
+    # EOF. Closing the connection may send SIGHUP to the child and
+    # cause it to exit before it can exit normally.  The child should
+    # ignore SIGHUP.
     global errorInfo
     if { "$inp" == "" && "$outp" == "" } {
        set id -1
-       set result [catch "eval spawn \{${commandline}\}" pid]
+       set result [catch "eval spawn -ignore SIGHUP \{${commandline}\}" pid]
        if { $result == 0 } {
            set result2 0
        } else {
@@ -130,7 +134,7 @@ proc local_exec { commandline inp outp timeout } {
            return [list -1 "open of $commandline $inp $outp failed: 
        set pid [pid $id]
-       set result [catch "spawn -leaveopen $id" result2]
+       set result [catch "spawn -ignore SIGHUP -leaveopen $id" result2]
     # Prepend "-" to each pid, to generate the "process group IDs" needed by
     # kill.

Attachment: signature.asc
Description: Digital signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]