[binutils-gdb] binutils: don't abort debuginfod.exp when the server cleanup kill fails

Sam James sjames@sourceware.org
Sat Sep 5 08:35:34 GMT 2026


https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=678e0116c60344c85c976d76e9b9f1dca16803fb

commit 678e0116c60344c85c976d76e9b9f1dca16803fb
Author: Matt Turner <mattst88@gmail.com>
Date:   Tue Aug 11 21:33:30 2026 -0400

    binutils: don't abort debuginfod.exp when the server cleanup kill fails
    
    Both debuginfod.exp cleanup paths call
    
      exec kill -INT -[exp_pid]
    
    uncaught, unlike the catch{}-wrapped close/wait that immediately
    follows.  Tcl's exec raises an error when the child exits non-zero, so
    if the kill fails the error propagates out of the testcase and DejaGnu
    aborts the whole file:
    
      ERROR: tcl error sourcing .../debuginfod.exp.
      ERROR: tcl error code CHILDSTATUS 76409 1
      ERROR: child process exited abnormally
      UNRESOLVED: testcase '.../debuginfod.exp' aborted due to Tcl error
    
    That turns a single FAIL into an aborted testcase, so the objdump and
    readelf debuginfod tests that follow never run at all and the failure
    is reported as UNRESOLVED rather than as the plain FAIL it is.
    
    This is latent on hosts where the server starts and initialises
    normally, since neither path is taken there.  It reproduces on a native
    alpha-linux-gnu host, where debuginfod never publishes the
    
      thread_work_pending{role="scan"} 0
    
    metric the test waits for, so the metric poll times out and the server
    init failure path runs.
    
    Wrap both kills in catch, matching the adjacent cleanup calls.  The
    FAIL is still reported; only the spurious abort goes away.
    
    While here, kill and reap the server on the port-scan timeout path too,
    which returned without any cleanup at all.

Diff:
---
 binutils/testsuite/binutils-all/debuginfod.exp | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/binutils/testsuite/binutils-all/debuginfod.exp b/binutils/testsuite/binutils-all/debuginfod.exp
index 3abacf69832..9df419c468e 100644
--- a/binutils/testsuite/binutils-all/debuginfod.exp
+++ b/binutils/testsuite/binutils-all/debuginfod.exp
@@ -113,11 +113,13 @@ while { ! $found } {
       set found 1
     }
     "Failed to bind to port" {
-      exec kill -INT -[exp_pid]
+      catch {exec kill -INT -[exp_pid]}
       catch {close}; catch {wait -i $spawn_id}
     }
     timeout {
       fail "$test (find port timeout)"
+      catch {exec kill -INT -[exp_pid]}
+      catch {close}; catch {wait -i $spawn_id}
       return
     }
   }
@@ -145,7 +147,7 @@ foreach m $metrics {
 
   if { $timelim == 0 } {
     fail "$test (server init timeout)"
-    exec kill -INT -[exp_pid]
+    catch {exec kill -INT -[exp_pid]}
     catch {close}; catch {wait -i $spawn_id}
     return
   }


More information about the Binutils-cvs mailing list