From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id GsaeOgbF12oa4TsAWB0awg (envelope-from ) for ; Tue, 20 Oct 2026 15:46:14 -0400 Authentication-Results: simark.ca; dkim=pass (2048-bit key; unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=nt4JQod7; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id DAF781E04D; Tue, 20 Oct 2026 15:46:14 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-2.4 required=5.0 tests=ARC_SIGNED,ARC_VALID,BAYES_00, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED,RCVD_IN_VALIDITY_CERTIFIED_BLOCKED, RCVD_IN_VALIDITY_RPBL_BLOCKED,RCVD_IN_VALIDITY_SAFE_BLOCKED autolearn=ham autolearn_force=no version=4.0.1 Received: from vm01.sourceware.org (vm01.sourceware.org [38.145.34.32]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange x25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id 16F471E04D for ; Tue, 20 Oct 2026 15:46:14 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 297AE4AA3958 for ; Tue, 20 Oct 2026 19:46:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 297AE4AA3958 Authentication-Results: sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=nt4JQod7 Received: from smtp.polymtl.ca (smtp.polymtl.ca [132.207.4.11]) by sourceware.org (Postfix) with ESMTPS id E321B4AA5189 for ; Tue, 20 Oct 2026 19:45:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E321B4AA5189 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=polymtl.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=polymtl.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E321B4AA5189 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=132.207.4.11 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792525548; cv=none; b=HGdyHcMENqRdXbWLrLalE0hsOnAMsq5ZK7A3/pCQHpbpq/F+uxrwlvuIy2cqVCsiKtL9JY6DM9r8/oWDf7asMctG0r35l+UTT+DTG+1c6yuuIEEjcIVlhJEiZ1HTglOgDaUSiu/nvecBkpbDLvRlTBL43fyBh7aA1SUxbGUSmmk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1792525548; c=relaxed/simple; bh=V5vk4XL9geyaXOaeYqTBDljfjQmhUSAxv8Jtjo95H0U=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=CN9TZ7GVj/1qBJVHvTL5fFvB+y+K7jpLU10T32OTQlLhviaDMX6ZZyxGs4T8nNZdgNPpPXvWOqcEEfHTUCz7oLVEkfWzO8bDMLyf38YlRsE7VrX/GEXHk97h97HEDXE2VSMcGId40KT1lOTPdCmCKVG+YyFzot032E+/WwDQE+s= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (2048-bit key, unprotected) header.d=polymtl.ca header.i=@polymtl.ca header.a=rsa-sha256 header.s=oct2025 header.b=nt4JQod7 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E321B4AA5189 Received: from simark.ca (simark.ca [158.69.221.121]) (authenticated bits=0) by smtp.polymtl.ca (8.14.7/8.14.7) with ESMTP id 69KJjcaA118511 (version=TLSv1/SSLv3 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Oct 2026 15:45:43 -0400 DKIM-Filter: OpenDKIM Filter v2.11.0 smtp.polymtl.ca 69KJjcaA118511 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=polymtl.ca; s=oct2025; t=1792525544; bh=R9cNmlPcAujwO930i46Ept9WSDeJsHmJVsvb+FF8diY=; h=Date:Subject:To:Cc:From:In-Reply-To:From; b=nt4JQod7c53KzDCo8+ot5RhJkG1n4tOzlOFs3xKiIGyUh48ty+qOCWho40a71cS5+ 4s05+CryclSsfpcYfAQ5KqMDReN5HPlxVLKubuSeWiAWyugXaG1LOUQlYb2CmsKseZ fLJ8+4QnyPQazFVmX/9gfDcque4k30ET69htQq4sxmD0dV/Lr3j31PvVkovOtNR5gP brP7PSRnNDobms0Lkp+RYJ35t32bLhLgHopSgAfMxT6Ib1Bs9X74CVl8Wtw5fZ9wT9 8pJlZdwszLtYuUgXHuISt2gjOV8sQ2aY3nMe00BoYeOl7IMOgT5lZD5QsPnnEtX6H+ ul6euIfr2PU7w== Received: by simark.ca (Postfix) id BFCA91E04D; Tue, 20 Oct 2026 15:45:36 -0400 (EDT) Message-ID: Date: Tue, 20 Oct 2026 15:45:36 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] Accept ksh88 exit status for SIGINT in shell.exp To: Aditya Vidyadhar Kamath , ulrich.weigand@de.ibm.com, tom@tromey.com Cc: gdb-patches@sourceware.org, Aditya.Kamath1@ibm.com, sangamesh.swamy@in.ibm.com References: <20261015134604.81658-2-akamath996@gmail.com> Content-Language: fr From: Simon Marchi In-Reply-To: <20261015134604.81658-2-akamath996@gmail.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Poly-FromMTA: (simark.ca [158.69.221.121]) at Tue, 20 Oct 2026 19:45:38 +0000 X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gdb-patches-bounces~public-inbox=simark.ca@sourceware.org On 10/15/26 9:46 AM, Aditya Vidyadhar Kamath wrote: > From: Aditya Vidyadhar Kamath > > This patch is in continuation to Simon's patch [1]. > > gdb.base/shell.exp runs "kill -2 $$" under the shell, through both > "shell" ("!") and "pipe" ("|"), and expects $_shell_exitsignal to be 2 > and $_shell_exitcode to be void, that is, a shell that dies from the > signal. > > On AIX, /bin/sh and /usr/bin/ksh are ksh88. ksh88 catches SIGINT and > calls exit (130) (128 + SIGINT) instead of dying from the signal. GDB > therefore sees a normal exit, sets $_shell_exitcode to 130 and leaves > $_shell_exitsignal void. This is correct reporting by GDB; the test > assumes a shell that is killed by the signal. The raw wait status of > the shells on AIX 7.3 is: > > /usr/bin/ksh exited, code 130 > /usr/bin/ksh93 killed by signal 2 > /usr/bin/bash killed by signal 2 > > As a result these four tests failed on AIX: > > shell interrupt exitcode > shell interrupt exitsignal > pipe interrupt exitcode > pipe interrupt exitsignal > > Add check_shell_interrupt_status, which replaces the duplicated checks. > On AIX it also accepts $_shell_exitcode = 130 together with > $_shell_exitsignal = void. > > Tested on AIX 7.3 with a 64-bit GDB: gdb.base/shell.exp now gives > 125 passes and no failures. The four tests above failed before. > > [1] https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=bf842a2e8d6e9eb7429444904b1b31c8b85d5fb2 > --- > gdb/testsuite/gdb.base/shell.exp | 49 +++++++++++++++++++++++++++++--- > 1 file changed, 45 insertions(+), 4 deletions(-) > > diff --git a/gdb/testsuite/gdb.base/shell.exp b/gdb/testsuite/gdb.base/shell.exp > index 2e6c63585eb..e0f9b9fb1f2 100644 > --- a/gdb/testsuite/gdb.base/shell.exp > +++ b/gdb/testsuite/gdb.base/shell.exp > @@ -17,6 +17,49 @@ > > load_lib completion-support.exp > > +# Check the convenience variables after a shell command that ran > +# "kill -2 $$". PREFIX is "shell" or "pipe", and is used to name the > +# tests. > +# > +# Usually the shell dies from SIGINT, so $_shell_exitcode is void and > +# $_shell_exitsignal is 2. > +# > +# On AIX, /bin/sh and /usr/bin/ksh are ksh88. ksh88 catches SIGINT and > +# calls exit (130) (128 + SIGINT) instead of dying from the signal. GDB > +# then sees a normal exit and correctly sets $_shell_exitcode to 130 and > +# leaves $_shell_exitsignal void. Accept that outcome on AIX. Shells > +# that do die from the signal (e.g. ksh93 or bash) still give the usual > +# result, and are accepted as well. > + > +proc check_shell_interrupt_status { prefix } { > + global gdb_prompt > + > + set signaled 1 > + > + if { [istarget "*-*-aix*"] } { > + set test "$prefix interrupt exitcode" > + gdb_test_multiple "p \$_shell_exitcode" $test { > + -re " = void\r\n$gdb_prompt $" { > + pass $test > + } > + -re " = 130\r\n$gdb_prompt $" { > + # Expected for ksh88, see the comment above. > + set signaled 0 > + pass $test > + } > + } > + } else { > + gdb_test "p \$_shell_exitcode" " = void" "$prefix interrupt exitcode" > + } What is the value of the SHELL env var with ksh88? Instead of doing an "aix" check, would you be able to tell from that variable that the shell is ksh88, and update expectations accordingly? Simon