From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id iU/QL0iDkWqxXgsAWB0awg (envelope-from ) for ; Fri, 28 Aug 2026 08:47:04 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1787921224; bh=3gd61wOhZTXKPNoacYrHLn+Eiw7nJcVWzlFbT4Aqnxs=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ao5spDdcKe4q3ag/HRP1mm1Ew4O72htW5QuZQ8qaD5/r5YwafJSEOuSW6mi1vM8e0 n6X41mhczV96yMiWEms/mNkr3H87aqFC5lNnQV68R4jqrRojqkF1ptOOGkEhHE6F8I zrwpyBVpb9HemhDWmLk7G5Kni3foK1JyoXtgokWo= Received: by simark.ca (Postfix, from userid 112) id BB83C1E033; Fri, 28 Aug 2026 08:47:04 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-25) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-5.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 autolearn=ham autolearn_force=no version=4.0.1 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=X2N3XI4L; dkim-atps=neutral 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 2A7F41E033 for ; Fri, 28 Aug 2026 08:47:03 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E88674BA901A for ; Fri, 28 Aug 2026 12:47:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E88674BA901A Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=X2N3XI4L Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 397624BA2E28 for ; Fri, 28 Aug 2026 12:46:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 397624BA2E28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=simark.ca Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=simark.ca ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 397624BA2E28 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787921198; cv=none; b=YDXioZ3d0WABfHp4AO7GJe4TZnxH4U5TdKdv8j156ggB//bkWUfDCUlFD+OByrODG4Bkmj9fGPNls25GoYSey6xwo4e6oBg0OFI1jHuhbio4C1YaCDr9MocxwMHvUSubWOzTfUPTB5VYR4QpXyZ/IacH/CQ7IkEeM4oiwN8EFtM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1787921198; c=relaxed/simple; bh=3gd61wOhZTXKPNoacYrHLn+Eiw7nJcVWzlFbT4Aqnxs=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=WTzsE3JazxWYmwTrHYdp3lbygWhqSORs1WyfVT0MMtCHphIPnY8mJQ8Hr6KjvZuMOE2jTfTbGGMTNExMbHOY/CVX1OW1lS7jMEgdeJt/3YpoPbusm+s5ICco7W59ZwHNGqqYKpjRymVG9cdoMvSzkc2ervSj+51xH5vA9/TjrkM= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=X2N3XI4L DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 397624BA2E28 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1787921197; bh=3gd61wOhZTXKPNoacYrHLn+Eiw7nJcVWzlFbT4Aqnxs=; h=Date:Subject:To:References:From:In-Reply-To:From; b=X2N3XI4Ljccin3z7W6s4Xm4LETVmgBTELY8uiCF3ylBeGvzrnjfNy4cREXy8MMP9J xUDwXR/Bn92mlqs6H9ZS2hlddCbC1pcEf/v85oUo9RS7HphbOY9KMxMTbEeOVDLbc5 4VWJUEGKFvBX/vKn8S73JNnKegzJosA2DRCF4mtg= Received: by simark.ca (Postfix) id 7796A1E033; Fri, 28 Aug 2026 08:46:35 -0400 (EDT) Message-ID: <987c9664-c0ed-4052-be6c-cb80eec17dff@simark.ca> Date: Fri, 28 Aug 2026 08:46:35 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] [gdb] Fix unbound variable in regformats/regdat.sh To: Tom de Vries , gdb-patches@sourceware.org References: <20260828120439.3857602-1-tdevries@suse.de> <20260828120439.3857602-3-tdevries@suse.de> Content-Language: en-US From: Simon Marchi In-Reply-To: <20260828120439.3857602-3-tdevries@suse.de> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit 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 2026-08-28 08:04, Tom de Vries wrote: > While testing the previous patch, I noticed the following difference: > ... > $ sh ./gdb/regformats/regdat.sh \ > gdb/regformats/rs6000/powerpc-isa205-ppr-dscr-vsx64l.dat \ > gdbsupport/osabi.def \ > tmp.txt > $ ./gdb/regformats/regdat.sh \ > gdb/regformats/rs6000/powerpc-isa205-ppr-dscr-vsx64l.dat \ > gdbsupport/osabi.def \ > tmp.txt > ./gdb/regformats/regdat.sh: line 33: comment: unbound variable > ... > > The difference is due to the start of regdat.sh: > ... > #!/bin/sh -u > ... > where -u is enabling the unbound variable check. > > In the first variant, this setting is ignored. > > Fix this by using "set -u" instead, making sure that the unbound variable > check is done for both variants. > > The comment variable is not used in a meaningful way, so fix the unbound > variable error by removing it. > > Tested in the same way as the preceding patch. LGTM, thanks. Approved-By: Simon Marchi > --- > gdb/regformats/regdat.sh | 10 ++++------ > 1 file changed, 4 insertions(+), 6 deletions(-) > > diff --git a/gdb/regformats/regdat.sh b/gdb/regformats/regdat.sh > index 01f2dabe459..f93270ba0ca 100755 > --- a/gdb/regformats/regdat.sh > +++ b/gdb/regformats/regdat.sh > @@ -1,4 +1,4 @@ > -#!/bin/sh -u > +#!/bin/sh > > # Register protocol definitions for GDB, the GNU debugger. > # Copyright (C) 2001-2026 Free Software Foundation, Inc. > @@ -18,6 +18,8 @@ > # You should have received a copy of the GNU General Public License > # along with this program. If not, see . > > +set -u > + > # Format of the input files > read="type entry" > > @@ -28,15 +30,11 @@ do_read () > while read -r line > do > if test "${line}" = "" > - then > - continue > - elif test "${line}" = "#" -a "${comment}" = "" > then > continue > elif expr "${line}" : "#" > /dev/null > then > - comment="${comment} Unrelated comment: I'd like if we could standardize on if ...; then for ... in ...; do while ...; do instead of if ... then for ... in ... do while ... do I think it's more common, easier to read and takes less unnecessary lines. Simon