From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 58MxG9pylGq86xQAWB0awg (envelope-from ) for ; Sun, 30 Aug 2026 14:13:46 -0400 Authentication-Results: simark.ca; dkim=pass (1024-bit key; unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=p44l23Pt; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pACWaMih; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=ZZHRJ4Ed; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=uNUXc0E5; dkim-atps=neutral Received: by simark.ca (Postfix, from userid 112) id 3F8861E167; Sun, 30 Aug 2026 14:13:46 -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 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 DF0BB1E033 for ; Sun, 30 Aug 2026 14:13:42 -0400 (EDT) Received: from vm01.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id E6A594BA23DE for ; Sun, 30 Aug 2026 18:13:35 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E6A594BA23DE Authentication-Results: sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=p44l23Pt; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pACWaMih; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=ZZHRJ4Ed; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=uNUXc0E5 Received: from smtp-out2.suse.de (smtp-out2.suse.de [IPv6:2a07:de40:b251:101:10:150:64:2]) by sourceware.org (Postfix) with ESMTPS id 7F4484BA2E33 for ; Sun, 30 Aug 2026 18:12:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 7F4484BA2E33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=suse.de Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=suse.de ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 7F4484BA2E33 Authentication-Results: sourceware.org; arc=none smtp.remote-ip=2a07:de40:b251:101:10:150:64:2 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788113579; cv=none; b=lEdsUwcZ6Cx/iYpnsGktW9umr/pJ4bwGUBkxaIEaiAsc1eY/uoKCyv0ohnRS4/YggLLNMscrMlamxLtvV1KAlBnqIJMVim8nb3RUL/0wYbNf61hJIq/7kpiezbJdv9CArutIFbzu5DKTs4Jf/zftIaoOKecdnHLvdxFQN/UhJjA= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1788113579; c=relaxed/simple; bh=fyBDQQe9mTjTcns9gYWvqW5Iy2upxO4ek0zcAIACTNI=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-ID:MIME-Version; b=s20PmVWIL5cZQcbqhVT2jkS01TaWVVvL9Pans3drNNs6ZFe3s6qectLtdj08SrCT2mzMnIxMaJOk9Xem0OAZlycxEG4z+9NBNR8Da8DUTpDBseC3PNZNaUTF4pBv0Hl/w8Fl72AIYue5S61yqBm3LUWMGo0K9DUkoKz0OKFeqTI= ARC-Authentication-Results: i=1; sourceware.org; dkim=pass (1024-bit key, unprotected) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=p44l23Pt; dkim=pass header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=pACWaMih; dkim=pass (1024-bit key) header.d=suse.de header.i=@suse.de header.a=rsa-sha256 header.s=susede2_rsa header.b=ZZHRJ4Ed; dkim=neutral header.d=suse.de header.i=@suse.de header.a=ed25519-sha256 header.s=susede2_ed25519 header.b=uNUXc0E5 DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7F4484BA2E33 Received: from imap1.dmz-prg2.suse.org (imap1.dmz-prg2.suse.org [IPv6:2a07:de40:b281:104:10:150:64:97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by smtp-out2.suse.de (Postfix) with ESMTPS id 4D2B81FE3D for ; Sun, 30 Aug 2026 18:12:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788113574; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ojzYm+zt5EphQ+OFgNTJ9dQQKFYITCKb0ot4kHNQWV4=; b=p44l23PtChmRv3wiyHed2SPlX+BhvPQzNvTGkgJH+uTPc+TFMpk4jUIsABZmqzvFkAfQa3 GxsitLjUINRITJYxY5T3XsV4iL3W9HU5TV3nrYPmllkRlE2++XwdxzegrAWTGRIhbpiTJq YSH2Y9BdW5JmHo+bC0YO4X8DPgSjZWw= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788113574; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ojzYm+zt5EphQ+OFgNTJ9dQQKFYITCKb0ot4kHNQWV4=; b=pACWaMih2BZmyre48etCGXPPIemN/lsAe0wQNMQK3b5vfa0rJI75fhOnN+VvsovvtGs6jD PXcGJI2/Oy4SsyDA== Authentication-Results: smtp-out2.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=ZZHRJ4Ed; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=uNUXc0E5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1788113570; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ojzYm+zt5EphQ+OFgNTJ9dQQKFYITCKb0ot4kHNQWV4=; b=ZZHRJ4Edeyr4YMYIqKsoPB37Y6TD9NylD+mDDKs6cwiGDIZMDaQMW2RINT5T8C44e9aBTq UFJo1m9TiOEWJXnIb+khLAHZOOjxH8KJ2xVTS6BxJeGBOShNJymHzKo82vPT+7/YQJTIlP juEnb1ZBHrYkUbLrt+J6S8HTzdXV4sg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1788113570; h=from:from:reply-to:date:date:message-id:message-id:to:to:cc: mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=ojzYm+zt5EphQ+OFgNTJ9dQQKFYITCKb0ot4kHNQWV4=; b=uNUXc0E5aB3rE+KF4Xt8/eveP4TEelCzSRIgTqlXVznMWkGOUoMovQtwxmjgUyaSdwc1eB SCjXTu/KDOVAhzDw== Received: from imap1.dmz-prg2.suse.org (localhost [127.0.0.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by imap1.dmz-prg2.suse.org (Postfix) with ESMTPS id DF54113688 for ; Sun, 30 Aug 2026 18:12:49 +0000 (UTC) Received: from dovecot-director2.suse.de ([2a07:de40:b281:106:10:150:64:167]) by imap1.dmz-prg2.suse.org with ESMTPSA id YM0pNaFylGptdgAAD6G6ig (envelope-from ) for ; Sun, 30 Aug 2026 18:12:49 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH 3/3] [gdb] Make gdb_buildall.sh shellcheck-clean Date: Sun, 30 Aug 2026 20:12:49 +0200 Message-ID: <20260830181249.1492948-4-tdevries@suse.de> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260830181249.1492948-1-tdevries@suse.de> References: <20260830181249.1492948-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4D2B81FE3D X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Rspamd-Action: no action X-Spamd-Result: default: False [-3.01 / 50.00]; BAYES_HAM(-3.00)[100.00%]; NEURAL_HAM_LONG(-1.00)[-1.000]; MID_CONTAINS_FROM(1.00)[]; R_MISSING_CHARSET(0.50)[]; R_DKIM_ALLOW(-0.20)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; NEURAL_HAM_SHORT(-0.20)[-0.999]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; MIME_TRACE(0.00)[0:+]; FROM_HAS_DN(0.00)[]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; FROM_EQ_ENVFROM(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[imap1.dmz-prg2.suse.org:helo,imap1.dmz-prg2.suse.org:rdns,suse.de:dkim,suse.de:mid]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; RCVD_TLS_ALL(0.00)[]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; SPAMHAUS_XBL(0.00)[2a07:de40:b281:104:10:150:64:97:from]; DKIM_TRACE(0.00)[suse.de:+] 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 Make gdb_buildall.sh shellcheck-clean: - add missing quoting - use $() - use bash instead of sh to allow non-POSIX features - use makejobs="$1" instead of makejobs="-j $1" - use read -r - add missing definition of gdbopts and simopts - use '' for trap argument --- gdb/contrib/shellcheck.sh | 1 - gdb/gdb_buildall.sh | 76 +++++++++++++++++++++------------------ 2 files changed, 41 insertions(+), 36 deletions(-) diff --git a/gdb/contrib/shellcheck.sh b/gdb/contrib/shellcheck.sh index a3e80a553f4..7dd896218f3 100755 --- a/gdb/contrib/shellcheck.sh +++ b/gdb/contrib/shellcheck.sh @@ -45,7 +45,6 @@ for f in "$@"; do | gdb/config/djgpp/djconfig.sh \ | gdb/contrib/cc-with-tweaks.sh \ | gdb/contrib/gdb-add-index.sh \ - | gdb/gdb_buildall.sh \ | gdb/gdb_mbuild.sh \ | gdb/testsuite/lib/pdtrace.in) # Skip unclean files. diff --git a/gdb/gdb_buildall.sh b/gdb/gdb_buildall.sh index 57211ca887a..7de2c2e8fa0 100644 --- a/gdb/gdb_buildall.sh +++ b/gdb/gdb_buildall.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Build script to build GDB with all targets enabled. @@ -63,7 +63,7 @@ do # Number of parallel make jobs. shift test $# -ge 1 || usage - makejobs="-j $1" + makejobs="$1" ;; --clean ) # Shall the build directory be deleted after processing? @@ -97,8 +97,8 @@ fi ### Environment. # Convert these to absolute directory paths. -srcdir=`cd $1 && /bin/pwd` || exit 1 -builddir=`cd $2 && /bin/pwd` || exit 1 +srcdir=$(cd "$1" && /bin/pwd) || exit 1 +builddir=$(cd "$2" && /bin/pwd) || exit 1 # Version of make to use make=${MAKE:-make} MAKE=${make} @@ -108,9 +108,9 @@ ulimit -c 0 # Just make sure we're in the right directory. maintainers=${srcdir}/gdb/MAINTAINERS -if [ ! -r ${maintainers} ] +if [ ! -r "${maintainers}" ] then - echo Maintainers file ${maintainers} not found + echo "Maintainers file ${maintainers} not found" exit 1 fi @@ -125,15 +125,15 @@ dir=${builddir}/ALL if ${force} then echo ... forcing rebuild - rm -rf ${dir} + rm -rf "${dir}" fi # Did the previous configure attempt fail? If it did restart from scratch -if test -d ${dir} -a ! -r ${dir}/Makefile +if test -d "${dir}" -a ! -r "${dir}/Makefile" then echo ... removing partially configured - rm -rf ${dir} - if test -d ${dir} + rm -rf "${dir}" + if test -d "${dir}" then echo "... ERROR: Unable to remove directory ${dir}" exit 1 @@ -141,27 +141,33 @@ then fi # Create build directory. -mkdir -p ${dir} -cd ${dir} || exit 1 +mkdir -p "${dir}" +cd "${dir}" || exit 1 # Configure GDB. if test ! -r Makefile then + # Set custom gdb/sim build warnings here. The code using these two vars + # seems be copied from gdb_mbuild.sh, where they are set from --target lines + # in MAINTAINERS. + gdbopts="" + simopts="" + # Default SIMOPTS to GDBOPTS. test -z "${simopts}" && simopts="${gdbopts}" # The config options. __build="--enable-targets=all" - __enable_gdb_build_warnings=`test -z "${gdbopts}" \ - || echo "--enable-gdb-build-warnings=${gdbopts}"` - __enable_sim_build_warnings=`test -z "${simopts}" \ - || echo "--enable-sim-build-warnings=${simopts}"` + __enable_gdb_build_warnings=$(test -z "${gdbopts}" \ + || echo "--enable-gdb-build-warnings=${gdbopts}") + __enable_sim_build_warnings=$(test -z "${simopts}" \ + || echo "--enable-sim-build-warnings=${simopts}") __configure="${srcdir}/configure \ ${__build} ${bfd_flag}\ ${__enable_gdb_build_warnings} \ ${__enable_sim_build_warnings}" - echo ... ${__configure} - trap "echo Removing partially configured ${dir} directory ...; rm -rf ${dir}; exit 1" 1 2 15 + echo "... ${__configure}" + trap 'echo Removing partially configured ${dir} directory ...; rm -rf ${dir}; exit 1' 1 2 15 ${__configure} > Config.log 2>&1 trap "exit 1" 1 2 15 @@ -178,8 +184,8 @@ fi gdb_bin="gdb/gdb" if test ! -x gdb/gdb -a ! -x gdb/gdb.exe then - echo ... ${make} ${makejobs} - ( ${make} ${makejobs} all-gdb || rm -f gdb/gdb gdb/gdb.exe + echo "... ${make} ${makejobs:+-j $makejobs}" + ( "${make}" ${makejobs:+-j $makejobs} all-gdb || rm -f gdb/gdb gdb/gdb.exe ) > Build.log 2>&1 # If the build fails, exit. @@ -208,15 +214,15 @@ mv arch gdb_archs if test "${targexp}" != "" then - alltarg=`cat gdb_archs | grep ${targexp}` + alltarg=$(cat gdb_archs | grep "${targexp}") else - alltarg=`cat gdb_archs` + alltarg=$(cat gdb_archs) fi rm -f gdb_archs # Test all architectures available in ALLTARG echo "maint print architecture for" -echo "$alltarg" | while read target +echo "$alltarg" | while read -r target do cat < x set architecture ${target} @@ -226,14 +232,14 @@ EOF log_file=$target.log log_file=${log_file//:/_} echo -n "... ${target}" - ./gdb/gdb --data-directory gdb/data-directory -batch -nx -x x 2>&1 | cat > $log_file + ./gdb/gdb --data-directory gdb/data-directory -batch -nx -x x 2>&1 | cat > "$log_file" # Check GDBs results - if test ! -s $log_file + if test ! -s "$log_file" then - echo " ERR: gdb printed no output" | tee -a $log_file - elif test `grep -o internal-error $log_file | tail -n 1` + echo " ERR: gdb printed no output" | tee -a "$log_file" + elif test "$(grep -o internal-error "$log_file" | tail -n 1)" then - echo " ERR: gdb panic" | tee -a $log_file + echo " ERR: gdb panic" | tee -a "$log_file" else echo " OK" fi @@ -241,20 +247,20 @@ EOF # Create a sed script that cleans up the output from GDB. rm -f mbuild.sed # Rules to replace <0xNNNN> with the corresponding function's name. - sed -n -e '/<0x0*>/d' -e 's/^.*<0x\([0-9a-f]*\)>.*$/0x\1/p' $log_file \ + sed -n -e '/<0x0*>/d' -e 's/^.*<0x\([0-9a-f]*\)>.*$/0x\1/p' "$log_file" \ | sort -u \ - | while read addr + | while read -r addr do - func="`addr2line -f -e ./$gdb_bin -s ${addr} | sed -n -e 1p`" + func="$(addr2line -f -e ./$gdb_bin -s "${addr}" | sed -n -e 1p)" echo "s/<${addr}>/<${func}>/g" done >> mbuild.sed # Rules to strip the leading paths off of file names. echo 's/"\/.*\/gdb\//"gdb\//g' >> mbuild.sed # Run the script. - sed -f mbuild.sed $log_file > Mbuild.log + sed -f mbuild.sed "$log_file" > Mbuild.log - mv Mbuild.log ${builddir}/$log_file - rm -rf $log_file x mbuild.sed + mv Mbuild.log "${builddir}/$log_file" + rm -rf "$log_file" x mbuild.sed done echo "done." @@ -262,7 +268,7 @@ echo "done." if ${clean} then echo "cleaning up $dir" - rm -rf ${dir} + rm -rf "${dir}" fi exit 0 -- 2.51.0