From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp-out1.suse.de (smtp-out1.suse.de [195.135.223.130]) by sourceware.org (Postfix) with ESMTPS id 5285B3882066 for ; Thu, 13 Jun 2024 15:11:59 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5285B3882066 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 5285B3882066 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=195.135.223.130 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718291521; cv=none; b=eGPlfYL3ayuwELWBtuDe/aFvnF/rmGHD5d8yisnkk8+iUXjN3yVZhVmrz0Xleaq53WmqQU7UYI1kAkPx+App/WvNVoxbUGFiG4g7NOnbk1Yj8S1AeanuObgGFdMGXRh4wuuXN3Kl0JkMpzqSlPOxbPMu1+Eg8QxLB4aP9vzSx3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718291521; c=relaxed/simple; bh=ZPiIXz9Bq+v0QR+5Bq9U9moa+9hy3vtqV24UAAx8xTE=; h=DKIM-Signature:DKIM-Signature:DKIM-Signature:DKIM-Signature:From: To:Subject:Date:Message-Id:MIME-Version; b=kH/z1DFcJUZUnyQUsmmUYTO6yK3zlNGzf96TnyneMOWzI62slwZYqWVVun9Q+RcHVPwGhfc0ChjZYjsHKt0tIVxysqKZ00N6Yxpd49hqz3K7ZPHpvqegAIdtaxpZclAsZM2nFBHWOYZvpKCFOMjiPkokyMzgfjOnRzXcELY6d5I= ARC-Authentication-Results: i=1; server2.sourceware.org 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-out1.suse.de (Postfix) with ESMTPS id 0A1F0372F8 for ; Thu, 13 Jun 2024 15:11:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718291518; 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=tHf0ZVhDFeSc6Hbi/EOl2PUVczNCx15ALcGBPjbR6d0=; b=gVrdpnhgEhRaDKYqS6HGb4hIbt8xPMEs0+GlU47Z1E3//LvAlFoZaEXcc9pSmVKJK/htoQ yD+qGHi1TzBU215Fy6OhdDKre51tk4emvN9y4rGGalkj2JOHPDYEeLAAsghUdGM6tu7J+j MjJp4/lbMoByvCT50sifZCPBo7gsykg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718291518; 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=tHf0ZVhDFeSc6Hbi/EOl2PUVczNCx15ALcGBPjbR6d0=; b=STpfOfhkOBlrlyblOCK+4+xOKRAJvEmqWCtpajnwhW4OvHIBmaS1NHAuYczwCnf+2E3Fka UQFJ15maeEkCR2BA== Authentication-Results: smtp-out1.suse.de; dkim=pass header.d=suse.de header.s=susede2_rsa header.b=gVrdpnhg; dkim=pass header.d=suse.de header.s=susede2_ed25519 header.b=STpfOfhk DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_rsa; t=1718291518; 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=tHf0ZVhDFeSc6Hbi/EOl2PUVczNCx15ALcGBPjbR6d0=; b=gVrdpnhgEhRaDKYqS6HGb4hIbt8xPMEs0+GlU47Z1E3//LvAlFoZaEXcc9pSmVKJK/htoQ yD+qGHi1TzBU215Fy6OhdDKre51tk4emvN9y4rGGalkj2JOHPDYEeLAAsghUdGM6tu7J+j MjJp4/lbMoByvCT50sifZCPBo7gsykg= DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=suse.de; s=susede2_ed25519; t=1718291518; 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=tHf0ZVhDFeSc6Hbi/EOl2PUVczNCx15ALcGBPjbR6d0=; b=STpfOfhkOBlrlyblOCK+4+xOKRAJvEmqWCtpajnwhW4OvHIBmaS1NHAuYczwCnf+2E3Fka UQFJ15maeEkCR2BA== 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 D8F8613AA0 for ; Thu, 13 Jun 2024 15:11:57 +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 sPCjMz0Ma2ZUXQAAD6G6ig (envelope-from ) for ; Thu, 13 Jun 2024 15:11:57 +0000 From: Tom de Vries To: gdb-patches@sourceware.org Subject: [PATCH v2 2/5] [gdb/testsuite] Clean up gdb/contrib/cc-with-tweaks.sh Date: Thu, 13 Jun 2024 17:12:38 +0200 Message-Id: <20240613151241.8144-2-tdevries@suse.de> X-Mailer: git-send-email 2.35.3 In-Reply-To: <20240613151241.8144-1-tdevries@suse.de> References: <20240613151241.8144-1-tdevries@suse.de> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 0A1F0372F8 X-Spam-Score: -3.01 X-Spam-Level: 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)[-1.000]; MIME_GOOD(-0.10)[text/plain]; MX_GOOD(-0.01)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; FROM_EQ_ENVFROM(0.00)[]; ARC_NA(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; PREVIOUSLY_DELIVERED(0.00)[gdb-patches@sourceware.org]; RCVD_TLS_ALL(0.00)[]; DBL_BLOCKED_OPENRESOLVER(0.00)[suse.de:dkim]; DKIM_SIGNED(0.00)[suse.de:s=susede2_rsa,suse.de:s=susede2_ed25519]; FUZZY_BLOCKED(0.00)[rspamd.com]; TO_DN_NONE(0.00)[]; RCVD_COUNT_TWO(0.00)[2]; MIME_TRACE(0.00)[0:+]; DKIM_TRACE(0.00)[suse.de:+] X-Rspamd-Action: no action X-Rspamd-Server: rspamd1.dmz-prg2.suse.org X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Fix shellcheck warnings in script gdb/contrib/cc-with-tweaks.sh. Tested on x86_64-linux. --- gdb/contrib/cc-with-tweaks.sh | 33 +++++++++++++++++++-------------- 1 file changed, 19 insertions(+), 14 deletions(-) diff --git a/gdb/contrib/cc-with-tweaks.sh b/gdb/contrib/cc-with-tweaks.sh index f760bd7c0a1..9d9c19c4430 100755 --- a/gdb/contrib/cc-with-tweaks.sh +++ b/gdb/contrib/cc-with-tweaks.sh @@ -50,7 +50,7 @@ # If nothing is given, no changes are made myname=cc-with-tweaks.sh -mydir=`dirname "$0"` +mydir=$(dirname "$0") if [ -z "$GDB" ] then @@ -112,7 +112,7 @@ if [ "$want_index" = true ] then if [ -z "$GDB_ADD_INDEX" ] then - if [ -f $mydir/gdb-add-index.sh ] + if [ -f "$mydir/gdb-add-index.sh" ] then GDB_ADD_INDEX="$mydir/gdb-add-index.sh" else @@ -200,7 +200,7 @@ if [ "$want_index" = true ]; then cp "$f" "$tmpdir" done - tmpfile="$tmpdir/$(basename $output_file)" + tmpfile=$tmpdir/$(basename "$output_file") # Filter out these messages which would stop dejagnu testcase run: # echo "$myname: No index was created for $file" 1>&2 # echo "$myname: [Was there no debuginfo? Was there already an index?]" 1>&2 @@ -209,7 +209,7 @@ if [ "$want_index" = true ]; then rc=${PIPESTATUS[0]} mv "$tmpfile" "$output_file" rm -f "$tmpdir"/*.dwo - [ $rc != 0 ] && exit $rc + [ "$rc" != 0 ] && exit "$rc" fi if [ "$want_index_cache" = true ]; then @@ -268,9 +268,9 @@ elif [ "$want_multi" = true ]; then # new file in case dwz fails. rm -f "$dwz_file" - cp $output_file ${output_file}.alt - $DWZ -m "$dwz_file" "$output_file" ${output_file}.alt > /dev/null - rm -f ${output_file}.alt + cp "$output_file" "${output_file}.alt" + $DWZ -m "$dwz_file" "$output_file" "${output_file}.alt" > /dev/null + rm -f "${output_file}.alt" # Validate dwz's work by checking if the expected output file exists. if [ ! -f "$dwz_file" ]; then @@ -280,14 +280,19 @@ elif [ "$want_multi" = true ]; then fi if [ "$want_dwp" = true ]; then - dwo_files=$($READELF -wi "${output_file}" | grep _dwo_name | \ - sed -e 's/^.*: //' | sort | uniq) + mapfile -t dwo_files \ + < \ + <($READELF -wi "${output_file}" \ + | grep _dwo_name \ + | sed -e 's/^.*: //' \ + | sort \ + | uniq) rc=0 - if [ -n "$dwo_files" ]; then - $DWP -o "${output_file}.dwp" ${dwo_files} > /dev/null + if [ ${#dwo_files[@]} -ne 0 ]; then + $DWP -o "${output_file}.dwp" "${dwo_files[@]}" > /dev/null rc=$? [ $rc != 0 ] && exit $rc - rm -f ${dwo_files} + rm -f "${dwo_files[@]}" fi fi @@ -322,9 +327,9 @@ if [ "$want_gnu_debuglink" = true ]; then # .gnu_debuglink to debug_file. $OBJCOPY --add-gnu-debuglink="$link" "${stripped_file}" \ "${output_file}" - rc=$? - [ $rc != 0 ] && exit $rc ) + rc=$? + [ $rc != 0 ] && exit $rc fi exit $rc -- 2.35.3