All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nicholas Piggin <npiggin@gmail.com>
To: kvm-riscv@lists.infradead.org
Subject: [RFC kvm-unit-tests PATCH v2 04/14] shellcheck: Fix SC2094
Date: Sat,  6 Apr 2024 22:38:13 +1000	[thread overview]
Message-ID: <20240406123833.406488-5-npiggin@gmail.com> (raw)
In-Reply-To: <20240406123833.406488-1-npiggin@gmail.com>

  SC2094 (info): Make sure not to read and write the same file in the same
  pipeline.

This is not as clearly bad as overwriting an input file with >, but
could appended characters possibly be read in from the input
redirection?

Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 scripts/arch-run.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 1901a929f..472c31b08 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -492,6 +492,8 @@ env_file ()
 
 env_errata ()
 {
+	local new_env
+
 	if [ "$ACCEL" = "tcg" ]; then
 		export "ERRATA_FORCE=y"
 	elif [ "$ERRATATXT" ] && [ ! -f "$ERRATATXT" ]; then
@@ -500,7 +502,8 @@ env_errata ()
 	elif [ "$ERRATATXT" ]; then
 		env_generate_errata
 	fi
-	sort <(env | grep '^ERRATA_') <(grep '^ERRATA_' $KVM_UNIT_TESTS_ENV) | uniq -u >>$KVM_UNIT_TESTS_ENV
+	new_env=$(sort <(env | grep '^ERRATA_') <(grep '^ERRATA_' $KVM_UNIT_TESTS_ENV) | uniq -u)
+	echo "$new_env" >>$KVM_UNIT_TESTS_ENV
 }
 
 env_generate_errata ()
-- 
2.43.0



WARNING: multiple messages have this Message-ID (diff)
From: Nicholas Piggin <npiggin@gmail.com>
To: Andrew Jones <andrew.jones@linux.dev>
Cc: "Nicholas Piggin" <npiggin@gmail.com>,
	"Paolo Bonzini" <pbonzini@redhat.com>,
	"Thomas Huth" <thuth@redhat.com>,
	"Alexandru Elisei" <alexandru.elisei@arm.com>,
	"Eric Auger" <eric.auger@redhat.com>,
	"Janosch Frank" <frankja@linux.ibm.com>,
	"Claudio Imbrenda" <imbrenda@linux.ibm.com>,
	"Nico Böhr" <nrb@linux.ibm.com>,
	"David Hildenbrand" <david@redhat.com>,
	"Shaoqin Huang" <shahuang@redhat.com>,
	"Nikos Nikoleris" <nikos.nikoleris@arm.com>,
	"David Woodhouse" <dwmw@amazon.co.uk>,
	"Ricardo Koller" <ricarkol@google.com>,
	rminmin <renmm6@chinaunicom.cn>, "Gavin Shan" <gshan@redhat.com>,
	"Nina Schoetterl-Glausch" <nsg@linux.ibm.com>,
	"Sean Christopherson" <seanjc@google.com>,
	kvm@vger.kernel.org, kvmarm@lists.linux.dev,
	kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org
Subject: [RFC kvm-unit-tests PATCH v2 04/14] shellcheck: Fix SC2094
Date: Sat,  6 Apr 2024 22:38:13 +1000	[thread overview]
Message-ID: <20240406123833.406488-5-npiggin@gmail.com> (raw)
In-Reply-To: <20240406123833.406488-1-npiggin@gmail.com>

  SC2094 (info): Make sure not to read and write the same file in the same
  pipeline.

This is not as clearly bad as overwriting an input file with >, but
could appended characters possibly be read in from the input
redirection?

Reviewed-by: Andrew Jones <andrew.jones@linux.dev>
Signed-off-by: Nicholas Piggin <npiggin@gmail.com>
---
 scripts/arch-run.bash | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash
index 1901a929f..472c31b08 100644
--- a/scripts/arch-run.bash
+++ b/scripts/arch-run.bash
@@ -492,6 +492,8 @@ env_file ()
 
 env_errata ()
 {
+	local new_env
+
 	if [ "$ACCEL" = "tcg" ]; then
 		export "ERRATA_FORCE=y"
 	elif [ "$ERRATATXT" ] && [ ! -f "$ERRATATXT" ]; then
@@ -500,7 +502,8 @@ env_errata ()
 	elif [ "$ERRATATXT" ]; then
 		env_generate_errata
 	fi
-	sort <(env | grep '^ERRATA_') <(grep '^ERRATA_' $KVM_UNIT_TESTS_ENV) | uniq -u >>$KVM_UNIT_TESTS_ENV
+	new_env=$(sort <(env | grep '^ERRATA_') <(grep '^ERRATA_' $KVM_UNIT_TESTS_ENV) | uniq -u)
+	echo "$new_env" >>$KVM_UNIT_TESTS_ENV
 }
 
 env_generate_errata ()
-- 
2.43.0


  parent reply	other threads:[~2024-04-06 12:38 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-06 12:38 [RFC kvm-unit-tests PATCH v2 00/14] add shellcheck support Nicholas Piggin
2024-04-06 12:38 ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 01/14] Add initial shellcheck checking Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-11  7:03   ` Thomas Huth
2024-04-11  7:03     ` Thomas Huth
2024-04-16  4:35     ` Nicholas Piggin
2024-04-16  4:35       ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 02/14] shellcheck: Fix SC2223 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 03/14] shellcheck: Fix SC2295 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-06 12:38 ` Nicholas Piggin [this message]
2024-04-06 12:38   ` [RFC kvm-unit-tests PATCH v2 04/14] shellcheck: Fix SC2094 Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 05/14] shellcheck: Fix SC2006 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 06/14] shellcheck: Fix SC2155 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 07/14] shellcheck: Fix SC2143 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 08/14] shellcheck: Fix SC2013 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-08  7:34   ` Andrew Jones
2024-04-08  7:34     ` Andrew Jones
2024-04-10  4:29     ` Nicholas Piggin
2024-04-10  4:29       ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 09/14] shellcheck: Fix SC2145 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 10/14] shellcheck: Fix SC2124 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 11/14] shellcheck: Fix SC2294 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 12/14] shellcheck: Fix SC2178 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 13/14] shellcheck: Fix SC2048 Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-06 12:38 ` [RFC kvm-unit-tests PATCH v2 14/14] shellcheck: Suppress various messages Nicholas Piggin
2024-04-06 12:38   ` Nicholas Piggin
2024-04-08  7:37   ` Andrew Jones
2024-04-08  7:37     ` Andrew Jones
2024-04-15 11:59 ` [RFC kvm-unit-tests PATCH v2 00/14] add shellcheck support Thomas Huth
2024-04-15 11:59   ` Thomas Huth
2024-04-16  3:26   ` Nicholas Piggin
2024-04-16  3:26     ` Nicholas Piggin
2024-04-16  4:46     ` Thomas Huth
2024-04-16  4:46       ` Thomas Huth
2024-04-17  1:40       ` Nicholas Piggin
2024-04-17  1:40         ` Nicholas Piggin

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=20240406123833.406488-5-npiggin@gmail.com \
    --to=npiggin@gmail.com \
    --cc=kvm-riscv@lists.infradead.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.