From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id 0LerK03f6meyfiEAWB0awg (envelope-from ) for ; Mon, 31 Mar 2025 14:30:37 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1743445837; bh=t7bxBXYIL/uv5vNqDS443RbX1cVOpTo2/qZr2yEGOXM=; h=Date:Subject:To:References:From:In-Reply-To:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=OTdLN0/OxOGXjSfmlB0dfxo9SXW1pQDnY5oDLdLelrcyS0zOB19dw2Q/ig4RZaiNZ ZbUH4PBH1b3hIRrMoEwxDwKpUhDju2czVyk1ndkemeQLR1qXEiwDElfxqFQdkkdnKS /mq4A21fDWXD0LhYcDcBNUFBnqqboeKYdjiQdThw= Received: by simark.ca (Postfix, from userid 112) id AF5E81E0C3; Mon, 31 Mar 2025 14:30:37 -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=unavailable 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=lKesW7hJ; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=cwdblQph; dkim-atps=neutral Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (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 434FE1E0C0 for ; Mon, 31 Mar 2025 14:30:37 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id D83F2385696F for ; Mon, 31 Mar 2025 18:30:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D83F2385696F 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=lKesW7hJ; dkim=pass (1024-bit key) header.d=simark.ca header.i=@simark.ca header.a=rsa-sha256 header.s=mail header.b=cwdblQph Received: from simark.ca (simark.ca [158.69.221.121]) by sourceware.org (Postfix) with ESMTPS id 62962385695B for ; Mon, 31 Mar 2025 18:30:05 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 62962385695B 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 62962385695B Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=158.69.221.121 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743445805; cv=none; b=lWmY2wQfGaSvTjO9YHZHRdD4Yat0QHcVePyOTQN+x2vPAMZW5pEDY0jHc97DO4hS/cVwfK85ynKbTbjHRaG9a/bTpIJU/4WFpvbYd5ehFMvZBiCYAzNIdSwYQQ7Def3uMEcjMmCH97ytf2NqtSZNdIM4A96XNsZVOWN3HX/c34Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1743445805; c=relaxed/simple; bh=t7bxBXYIL/uv5vNqDS443RbX1cVOpTo2/qZr2yEGOXM=; h=DKIM-Signature:DKIM-Signature:Message-ID:Date:MIME-Version: Subject:To:From; b=UtP+eEE9dMNjRjQA/OFG3Vi3PzRokkkTfW6tvaJI3yXd8lJl/FXJl0hlFAekjAYar2DE66RTS2/F8gZnbRhXJ+iBEWHc5vbSeZ5cnwFP6NfxxfpkiYa4Gd2VoGCKrItbZ33vJ3SWmktNOxNvESF62n1PG8/unnFq57+tgsV41G4= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 62962385695B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1743445805; bh=t7bxBXYIL/uv5vNqDS443RbX1cVOpTo2/qZr2yEGOXM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=lKesW7hJh5nnbPnHfUVckLzOxeLXFaqF0HYBSDFnjgS0ChKhVPZn4xilitFDqVyt7 x3JKztIm0lP7V2BR0RnJcnL3yvsO3gb9q+mqEYVK4VJnXa4hZPi9a+b/GYutGowtda xbyTyneTQC8YxqSx5kHGXPrQZoq3lUsa9Fm9+/fw= Received: by simark.ca (Postfix, from userid 112) id 1A8A31E100; Mon, 31 Mar 2025 14:30:05 -0400 (EDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=simark.ca; s=mail; t=1743445803; bh=t7bxBXYIL/uv5vNqDS443RbX1cVOpTo2/qZr2yEGOXM=; h=Date:Subject:To:References:From:In-Reply-To:From; b=cwdblQph+FmeoY3CcSo/OmsKH7Hiod/jozB0PbfigiTGcjypdYWt08eryEB/pup8s YP+uBvwBsVAXqdHaFzRhwtMqS2Eu/n5mf/RS6fb+jJGEvkf4w/ja1pZPZ1gBvCW/NK zpJrNkB2zojnMlr9rNnL8gmA2/mnwrSFzuudo34I= Received: from [172.16.0.192] (96-127-217-162.qc.cable.ebox.net [96.127.217.162]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPSA id CE1E61E0C0; Mon, 31 Mar 2025 14:30:03 -0400 (EDT) Message-ID: <25aa2a34-24ff-4707-919a-3c76ae0a519a@simark.ca> Date: Mon, 31 Mar 2025 14:30:03 -0400 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH 2/2] gdb-add-index: fix shellcheck warnings To: Keith Seitz , Sam James , gdb-patches@sourceware.org References: <0fa2e0d207eef78dc6a4305ee28588676932753e.1743188332.git.sam@gentoo.org> <2aef1e6c-ab5d-4884-8de2-0073ace3e194@redhat.com> Content-Language: fr From: Simon Marchi In-Reply-To: <2aef1e6c-ab5d-4884-8de2-0073ace3e194@redhat.com> 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 3/29/25 7:42 PM, Keith Seitz wrote: > Hi, > > On 3/28/25 11:58 AM, Sam James wrote: >> * Drop useless echo >> * Add missing quoting to rm argument (and use -- to delimit options) >> * Fix quoting w/ trap to avoid expanding $tmp_files immediately > > Again, thank you for doing this. > >> --- >> 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 >> @@ -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" > > By preventing expansion, wouldn't this be attempting to > erase a single file whose name is a concatenation of all the > temporary files? > > That is, > $ touch a b c > $ tmp="a b c" > $ rm -- "$tmp" > rm: cannot remove 'a b c': No such file or directory > > Keith > Indeed, this looks wrong. But not quoting it is also a problem if there are spaces in the paths. I think a sane way to handle this would be to require bash and use arrays [1]. Simon [1] https://www.gnu.org/software/bash/manual/html_node/Arrays.html