Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Sam James <sam@gentoo.org>
To: gdb-patches@sourceware.org
Cc: Simon Marchi <simark@simark.ca>, Sam James <sam@gentoo.org>
Subject: [PATCH 2/2] gdb-add-index: fix shellcheck warnings
Date: Fri, 28 Mar 2025 18:58:52 +0000	[thread overview]
Message-ID: <0fa2e0d207eef78dc6a4305ee28588676932753e.1743188332.git.sam@gentoo.org> (raw)
In-Reply-To: <cover.1743188332.git.sam@gentoo.org>

* Drop useless echo
* Add missing quoting to rm argument (and use -- to delimit options)
* Fix quoting w/ trap to avoid expanding $tmp_files immediately
---
 gdb/contrib/gdb-add-index.sh | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/gdb/contrib/gdb-add-index.sh b/gdb/contrib/gdb-add-index.sh
index b299f830373..f727d28aac7 100755
--- a/gdb/contrib/gdb-add-index.sh
+++ b/gdb/contrib/gdb-add-index.sh
@@ -2,7 +2,7 @@
 
 # Add a .gdb_index section to a file.
 
-# Copyright (C) 2010-2024 Free Software Foundation, Inc.
+# Copyright (C) 2010-2025 Free Software Foundation, Inc.
 # This program is free software; you can redistribute it and/or modify
 # it under the terms of the GNU General Public License as published by
 # the Free Software Foundation; either version 3 of the License, or
@@ -136,7 +136,6 @@ if $READELF -S "$file" | grep -q " \.gnu_debugaltlink "; then
 		   | grep -A1  "'\.gnu_debugaltlink':" \
 		   | tail -n +2 \
 		   | sed 's/.*]//')
-    dwz_file=$(echo $dwz_file)
     if $READELF -S "$dwz_file" | grep -E -q " \.(gdb_index|debug_names) "; then
 	# Already has an index, skip it.
 	dwz_file=""
@@ -163,10 +162,10 @@ for f in "$file" "$dwz_file"; do
     tmp_files="$tmp_files $index4 $index5 $debugstr $debugstrmerge $debugstrerr"
 done
 
-rm -f $tmp_files
+rm -f -- "$tmp_files"
 
 # Ensure intermediate index file is removed when we exit.
-trap "rm -f $tmp_files" 0
+trap 'rm -f $tmp_files' 0
 
 $GDB --batch -nx -iex 'set auto-load no' \
     -iex 'set debuginfod enabled off' \
-- 
2.49.0


  parent reply	other threads:[~2025-03-28 18:59 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-03-28 18:58 [PATCH 0/2] shell fixes for gcore, gdb-add-index Sam James
2025-03-28 18:58 ` [PATCH 1/2] gcore: improve shell use Sam James
2025-03-29 23:42   ` Keith Seitz
2025-03-31 18:26     ` Simon Marchi
2025-03-31 18:44       ` Andreas Schwab
2025-03-31 18:54         ` Simon Marchi
2025-04-02 16:08           ` Keith Seitz
2025-04-01 13:39   ` Tom Tromey
2025-04-02 16:15     ` Simon Marchi
2025-04-02 20:31       ` Tom Tromey
2025-03-28 18:58 ` Sam James [this message]
2025-03-29 23:42   ` [PATCH 2/2] gdb-add-index: fix shellcheck warnings Keith Seitz
2025-03-31 18:30     ` Simon Marchi

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=0fa2e0d207eef78dc6a4305ee28588676932753e.1743188332.git.sam@gentoo.org \
    --to=sam@gentoo.org \
    --cc=gdb-patches@sourceware.org \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox