From patchwork Wed May 1 11:29:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13650481 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9ECBF6518F; Wed, 1 May 2024 11:30:15 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714563017; cv=none; b=sdlM5wCb4Jl50TUdlX8mD15oWok4+NKdoiY3Xha78hdnXIRL+jW2W4DYoC1wvVOOs0gJBZsX2BI5rS2F72lLBOC+VX20y9+RSHWudbsvXWpsaccPCfpOiJnZLGdViiPPb/HjldgdFbQumAySCWMdiFqzFEWZNnKLQZD6MILgrJA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714563017; c=relaxed/simple; bh=aNQlpbX1V+40h70SYPNqIDOQATiZuD+yGYyg//lfbPo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=qZF0xw3SwvufN3NT1gCIAqYJ/XqNcANYBp7WCX+51wfm4ghqpkMaX8Hh3rL4lOgcGiIGY0iBb5p1ZOLt17XY6EKBXTgE9pQptZSY1gpD7qckJGCu2qc1DE9W0VUyEIvlv+bXAisAN2UiBHU7ewD+VNFF9oMv/V4DxXY6M+GYjgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=fG7Gkkh2; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="fG7Gkkh2" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1ec69e3dbe5so11248665ad.0; Wed, 01 May 2024 04:30:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714563015; x=1715167815; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qEezwiCyGwOZD1+v35KdQzu2KwTw4n21wPX8WyrxUmo=; b=fG7Gkkh2MAMKUjzdo0yklZe33C9QuScqB6mTWjdJi9NJJg1/jYRGLpDFs1MnUSsuXO rAgqZCgz0zAKXmbgF0yOgeja4TmXYPx/q2NycgXwyrTJaSSo6jQoZFV24VMdiFL9jUKR MSFN7VcU+lGRI3qDMOFUUDl+HzubTrlpd4YFomSbg79yLuPbHfbVR2D7atnqJENJvAae govlEQU4eQ39/UhJ6vWmNQJokggc7NxmFPtYEFIozSXg1SyoINDTRXAxQo+KlX/QKSH3 OGyQ7nfIs7AKhPqKharfUMf+uND4BH4/Z9AoViQMMWTHf8vWfzq1Vs2maXiZ9pcrH1S3 5m7g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714563015; x=1715167815; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qEezwiCyGwOZD1+v35KdQzu2KwTw4n21wPX8WyrxUmo=; b=ut6VXJzluqISoXP5gORguqBXpZyWF3q2YJBXuKbsfmohYXfUg4hGBBIaBVoSPjv783 FRRfp2ZL+pNiURTxvl854AbXI1EixBTE+oUSMlLUjTItJcRMaDf893Y6ZwvODqms8nRS yelVnHwxj+TDt6w0QeGQQThQMZySNljZzgxe1qYR0N3BV5s2AZZjTuOLBtoTg+558XSZ 5DyId+3naBZ6aGUykdganFaK/UWaqaDEpK4RCQED47By1q4SAgYdCZQ1c0OGAOSbXXqA zStkJ/kZXbBN18NfDayoQnhSrlc8i5PuPNLfelZTFs+yOF5LZfs1/JFE6Jvruhg/aJPV OUZQ== X-Forwarded-Encrypted: i=1; AJvYcCWmeG3LrX/4QOSpwrMStZLKg7C1RNyD1xvyOWR2+xAnRLDFFceg0ZzGt2EooAzt4TTl9XprBFjyhjQ9kYi56aY3697ZAt7GosMJIw+qlAjV5g/ak/UxbUJtNXgpJKcRyw== X-Gm-Message-State: AOJu0YxtSL1+Stno7ShGMwwNLEuvIR6h4zLF1qDTvr4r3AjvUTb11ENq HlShIp7Xl0bKtGK/mPIflNuSH0JJW+3lrff+pdu95+VTZYwyTifZ X-Google-Smtp-Source: AGHT+IEFPYODr4TyreDdFCG6z01houFeGcrnNZN3iQCpjD0ek1ej4HVV0Wcok3E4Ojsg5zSqMK/UaA== X-Received: by 2002:a17:902:a383:b0:1e2:96d3:1bc1 with SMTP id x3-20020a170902a38300b001e296d31bc1mr2081748pla.1.1714563014788; Wed, 01 May 2024 04:30:14 -0700 (PDT) Received: from wheely.local0.net ([1.146.40.196]) by smtp.gmail.com with ESMTPSA id y22-20020a17090264d600b001ec64b128dasm2267150pli.129.2024.05.01.04.30.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 04:30:14 -0700 (PDT) From: Nicholas Piggin To: Andrew Jones Cc: Nicholas Piggin , Paolo Bonzini , Thomas Huth , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , =?utf-8?q?Nico_B=C3=B6hr?= , David Hildenbrand , Shaoqin Huang , Nikos Nikoleris , David Woodhouse , Ricardo Koller , rminmin , Gavin Shan , Nina Schoetterl-Glausch , Sean Christopherson , kvm@vger.kernel.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org Subject: [kvm-unit-tests PATCH v3 1/5] Add initial shellcheck checking Date: Wed, 1 May 2024 21:29:30 +1000 Message-ID: <20240501112938.931452-2-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240501112938.931452-1-npiggin@gmail.com> References: <20240501112938.931452-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 This adds a basic shellcheck style file, some directives to help find scripts, and a make shellcheck target. When changes settle down this could be made part of the standard build / CI flow. Suggested-by: Andrew Jones Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- .shellcheckrc | 30 ++++++++++++++++++++++++++++++ Makefile | 4 ++++ README.md | 3 +++ scripts/common.bash | 5 ++++- 4 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 .shellcheckrc diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 000000000..491af18bd --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,30 @@ +# shellcheck configuration file +external-sources=true + +# Optional extras -- https://www.shellcheck.net/wiki/Optional +# Possibilities, e.g., - +# quote‐safe‐variables +# require-double-brackets +# require-variable-braces +# add-default-case + +# Disable SC2004 style? I.e., +# In run_tests.sh line 67: +# if (( $unittest_run_queues <= 0 )); then +# ^------------------^ SC2004 (style): $/${} is unnecessary on arithmetic variables. +disable=SC2004 + +# Disable SC2086 for now, double quote to prevent globbing and word +# splitting. There are lots of places that use it for word splitting +# (e.g., invoking commands with arguments) that break. Should have a +# more consistent approach for this (perhaps use arrays for such cases) +# but for now disable. +# SC2086 (info): Double quote to prevent globbing and word splitting. +disable=SC2086 + +# Disable SC2235. Most developers are used to seeing expressions +# like a || (b && c), not a || { b && c ; }. The subshell overhead in +# kvm-unit-tests is negligible as it's not shell-heavy in the first +# place (time is dominated by qemu startup/shutdown and test execution) +# SC2235 (style): Use { ..; } instead of (..) to avoid subshell overhead. +disable=SC2235 diff --git a/Makefile b/Makefile index 4f35fffc6..6240d8dfa 100644 --- a/Makefile +++ b/Makefile @@ -141,6 +141,10 @@ cscope: -name '*.[chsS]' -exec realpath --relative-base=$(CURDIR) {} \; | sort -u > ./cscope.files cscope -bk +.PHONY: shellcheck +shellcheck: + shellcheck -a run_tests.sh */run */efi/run scripts/mkstandalone.sh + .PHONY: tags tags: ctags -R diff --git a/README.md b/README.md index 6e82dc225..2d6f7db56 100644 --- a/README.md +++ b/README.md @@ -193,3 +193,6 @@ with `git config diff.orderFile scripts/git.difforder` enables it. We strive to follow the Linux kernels coding style so it's recommended to run the kernel's ./scripts/checkpatch.pl on new patches. + +Also run `make shellcheck` before submitting a patch which touches bash +scripts. diff --git a/scripts/common.bash b/scripts/common.bash index b9413d683..5e9ad53e2 100644 --- a/scripts/common.bash +++ b/scripts/common.bash @@ -78,8 +78,11 @@ function arch_cmd() } # The current file has to be the only file sourcing the arch helper -# file +# file. Shellcheck can't follow this so help it out. There doesn't appear to be a +# way to specify multiple alternatives, so we will have to rethink this if things +# get more complicated. ARCH_FUNC=scripts/${ARCH}/func.bash if [ -f "${ARCH_FUNC}" ]; then +# shellcheck source=scripts/s390x/func.bash source "${ARCH_FUNC}" fi From patchwork Wed May 1 11:29:31 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13650482 Received: from mail-pl1-f171.google.com (mail-pl1-f171.google.com [209.85.214.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D690A6F067; Wed, 1 May 2024 11:30:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714563026; cv=none; b=DlcSlxQm6g1jFKuavC2beD/9GqD2a6tEIf+qwhIG4rBWvEBpb5qZqAX406ReAaJM8GNsJPbtmg89rCYFxqFpkN6/2eVIFIxwl1g2QKe9QvImVYdaxKa8zGpSR5K15LQnZ/ja91XyICZ2OiWqbZid94kr9SL6cCdHqN/Rt8CGGG0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714563026; c=relaxed/simple; bh=8rPXa8viuRgylwUaKzJXXgmN4UO7CSiJaIGOKnKmXkk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=BwHl4uYOZqcwipcITWMitWRd+vqP8315Vecqv+vT1+l0H/BipZzssikDCpWtYzqREEDQs0yNWmeIsKc49IQ9IYbI062TZMyco9s2Cslf2k+i7s7WLtnmv7KoR09S3c2l8Mhcnrzf+ZGAJDoBB/Ic6zCJSGA7CWEemzp5VeBsh9M= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=QZDtpXPV; arc=none smtp.client-ip=209.85.214.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="QZDtpXPV" Received: by mail-pl1-f171.google.com with SMTP id d9443c01a7336-1ec44cf691aso4785295ad.0; Wed, 01 May 2024 04:30:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714563024; x=1715167824; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=1mJOZjxszbvpsd8NIswtou8sxuQs1WjsSOCG5FXC6/w=; b=QZDtpXPVHCem2S68AxBwrvhwUi4s1E75yh4oXXLKSjI+kD6CfZOFLjSo+zD2waKubd GKKFI7Hr30LW/wg4x/vi7VwbfSLU5/EoPDV8HStWV0vx0a7w5/k4sDf+PqqvTgwcggOs P0y3e6DuK9qdEemTDgWI+AgzYXGh8WuzNZvVhDHi/W8+Y9ju32N5VPqa5e3NzW24hlgD kcGWlF5UEpq+5plQNtQoZLEKb+6Jg7pg66d9036pdrSBnAvMADoVHoIC5gCJoKqIwUtm ix+hW9VnsuVnFLrjQ6gedUbSZMrX9/lyAYraucrjkNvo2plUzkvDGrA1+e4S8K0BBT6j AriA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714563024; x=1715167824; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=1mJOZjxszbvpsd8NIswtou8sxuQs1WjsSOCG5FXC6/w=; b=tT9MlcJj44qT5npXGX+bj2k64vIYmgGfGlCVtULPzrsHNuCYXcbjNQBoFOVxR1PPPC tKrz2DtOVSH4TCWnjpuZvufMftkg+67yTRc7cIShsv6N06ZRRbKtuYYmsdYqTOmsXBtP IoJhQTrsIwVHq3KQs3cT/RtlErfVyTUoL9DcTVl+xaiLLWoALB6TPp7kD8D0cPhoOcmo ogvykbklmnDqefLa5wUCSdzeu6O7m5xe1Gh9HqgobQX/lyc/pW9W+Cign9PceWroX+Kh tI6bk2j7XfZ9I8aG6n0gwtbeZd4Y29/WGu6zNwpGlNnXi77DJIX6faCNRY/BmVKCDlhO Io7Q== X-Forwarded-Encrypted: i=1; AJvYcCWWV8Zn0NFB5P9OxeD/QBQBk6HCCVBR1MOXvhQjNmah2w0nGq7CUwIbsCuOh0tvPbO1/dgmLJsORrdoA7ffL/lC/p3fNp2t1Ow3/4lkNjoB2pr/W4MjSxX5Q39SxnuObQ== X-Gm-Message-State: AOJu0YwNfcXNyjiwMT28/yEQo4vmvTEO2i9lRpdcMUTmLyVQ9cRrix7q qiPFVWd0jUomY68IVn9ntmlAaJowDrESTWZ6Pw293uVDr+t287MP X-Google-Smtp-Source: AGHT+IGXK6+KiFLFpugRbIQcKHRuDTSsHf1UqbW1yDelUvCorCI+dmN8AqtsodexPzQQ7lw0BtUoig== X-Received: by 2002:a17:902:e812:b0:1e8:682b:7f67 with SMTP id u18-20020a170902e81200b001e8682b7f67mr3475208plg.29.1714563024087; Wed, 01 May 2024 04:30:24 -0700 (PDT) Received: from wheely.local0.net ([1.146.40.196]) by smtp.gmail.com with ESMTPSA id y22-20020a17090264d600b001ec64b128dasm2267150pli.129.2024.05.01.04.30.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 04:30:23 -0700 (PDT) From: Nicholas Piggin To: Andrew Jones Cc: Nicholas Piggin , Paolo Bonzini , Thomas Huth , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , =?utf-8?q?Nico_B=C3=B6hr?= , David Hildenbrand , Shaoqin Huang , Nikos Nikoleris , David Woodhouse , Ricardo Koller , rminmin , Gavin Shan , Nina Schoetterl-Glausch , Sean Christopherson , kvm@vger.kernel.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org Subject: [kvm-unit-tests PATCH v3 2/5] shellcheck: Fix SC2155 Date: Wed, 1 May 2024 21:29:31 +1000 Message-ID: <20240501112938.931452-3-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240501112938.931452-1-npiggin@gmail.com> References: <20240501112938.931452-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 SC2155 (warning): Declare and assign separately to avoid masking return values. No bug identified. Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 10 +++++++--- scripts/runtime.bash | 4 +++- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 2ac7b0b84..45ec8f57d 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -415,7 +415,8 @@ initrd_cleanup () { rm -f $KVM_UNIT_TESTS_ENV if [ "$KVM_UNIT_TESTS_ENV_OLD" ]; then - export KVM_UNIT_TESTS_ENV="$KVM_UNIT_TESTS_ENV_OLD" + export KVM_UNIT_TESTS_ENV + KVM_UNIT_TESTS_ENV="$KVM_UNIT_TESTS_ENV_OLD" else unset KVM_UNIT_TESTS_ENV fi @@ -427,7 +428,8 @@ initrd_create () if [ "$ENVIRON_DEFAULT" = "yes" ]; then trap_exit_push 'initrd_cleanup' [ -f "$KVM_UNIT_TESTS_ENV" ] && export KVM_UNIT_TESTS_ENV_OLD="$KVM_UNIT_TESTS_ENV" - export KVM_UNIT_TESTS_ENV=$(mktemp) + export KVM_UNIT_TESTS_ENV + KVM_UNIT_TESTS_ENV=$(mktemp) env_params env_file env_errata || return $? @@ -570,7 +572,9 @@ env_generate_errata () trap_exit_push () { - local old_exit=$(trap -p EXIT | sed "s/^[^']*'//;s/'[^']*$//") + local old_exit + + old_exit=$(trap -p EXIT | sed "s/^[^']*'//;s/'[^']*$//") trap -- "$1; $old_exit" EXIT } diff --git a/scripts/runtime.bash b/scripts/runtime.bash index e7af9bda9..597c90991 100644 --- a/scripts/runtime.bash +++ b/scripts/runtime.bash @@ -15,7 +15,9 @@ extract_summary() # We assume that QEMU is going to work if it tried to load the kernel premature_failure() { - local log="$(eval "$(get_cmdline _NO_FILE_4Uhere_)" 2>&1)" + local log + + log="$(eval "$(get_cmdline _NO_FILE_4Uhere_)" 2>&1)" echo "$log" | grep "_NO_FILE_4Uhere_" | grep -q -e "could not \(load\|open\) kernel" -e "error loading" -e "failed to load" && From patchwork Wed May 1 11:29:32 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13650483 Received: from mail-pl1-f172.google.com (mail-pl1-f172.google.com [209.85.214.172]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 420746166E; Wed, 1 May 2024 11:30:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714563035; cv=none; b=lN1RT678tM8lhTA8wkcvTJoI6l1rR6I4EEd8+r6GylgMjNqiAlitnrqY6YLhTwnqnrEbqjQhmnpYwp6/86mie4Ge6H3vJ8Qt3tHd+/G9tSOPev4vsKZGGI7ag+vBQA3IKBO4iIjOkDOMErLkhy75xMnNiKKl1VOcdNrg7OXq96Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714563035; c=relaxed/simple; bh=SBC9goY0qyeWaqVZEk5sqx6PBhg4VTZbRSRTA2YHwJw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=uOC//BPcu/9H/9h+ld1Oa6PbhtW78cPvspo6NoRfUpPTXtN+b8UEZIS3ClXrQ7tj2OlaTSiTHHa02ObY/RVQ0hO3NTnIUK/wtDf3Z9uzmfLEHuac0/f7fzA26dTGuEQ/d+3JbxxL9a54D0/QRAH/w2JXep5vvLgpSk4wpu3c3Ik= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=VWRKFavB; arc=none smtp.client-ip=209.85.214.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="VWRKFavB" Received: by mail-pl1-f172.google.com with SMTP id d9443c01a7336-1e3c9300c65so56767145ad.0; Wed, 01 May 2024 04:30:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714563033; x=1715167833; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=CWoWbY1l8dnEVRR/nSiK5WHJ8+U9imW08rrrMnGNnqQ=; b=VWRKFavB5dkeQM9sGYc8qQydIPSW3V0HZy04vbukNEfDc2Z/zEiaP7Gn/XUcd4RZzL 4keJuCghEhbT5LyrmRFLKDBylZKU58jyzYNqrqt3QBJ+d30gi9GVww9hUnxtLiWTt+nV vaLshWJWcui6Tt/Z9HoCi82olKdPH1rV0MVWHnOePNhBYLTiGaidox4ooh+3s0d+Ajv5 Ylc4iI378ZhzWtRO/vg9iFTSIgRKCpaoO3YyekjDzQrhVO+36DdcoeNy1Q654wRvdY+t YUFeXjeID6fzCVpjWtnC7Y+83zZuW5M3mBdrypIzziXM9j6i5BuGv4UWlpNkseYpSriC 9aaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714563033; x=1715167833; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=CWoWbY1l8dnEVRR/nSiK5WHJ8+U9imW08rrrMnGNnqQ=; b=rvyQWBHjgBaKxYWznBdq/xhU6NvA0eRbWhAh8KP/AjODfhuvj1B1TOFbh5D7cxJmyA iZb8T5fid0rgS5OMeYvFYmbWVchZKqzjiQqiMAolAuzFYp2+PeVmdsRvIzk+c1eNNBf5 ykCwZypemlWS9EhbEV121JkPQnq1SUEf9EPAstX6HiljOyikL4Ds1lIa2dFxLzoPLOsh DdS5wWmpSamedjX71hCd3k4Iycd7HfSP1U/oxyejOkOLEb8wSg4zJJU4ceaitFBlUxZh ZtocB0dZgDGuCyBUuhfL3qMkd7ihDvUUr2J/9zSbZhMdDPw6pI1GSiUrQysv3CbwLx19 99pA== X-Forwarded-Encrypted: i=1; AJvYcCXXCp9U8pR5tu4wiMg07n5djGUFYUKhO23orQsaCGib9s/iCNJ25A5BxyZ2jNqPcNIfelVh/mfXL7PKjgi2jXm33tQWMUzG7fuEnANZSwgIqURrhPh4RZxiE9kaZ4sjJQ== X-Gm-Message-State: AOJu0Yx7yH5bW+Dz6sVb1mOyB/tCLzvEQShCBAlmt18EtJO4L38nRQKD TgJiTHk6CKt2K6bRpV/jyhJtw5BR1WqwmeeLRYO8ve+EAts+1Zj+ X-Google-Smtp-Source: AGHT+IE/3oHUP9voRIWXFZ6/QeBPDdS7lxxGgAJLR6S836NkCuvxR5ksBSEvpkvI+bsO729JuO1Kyg== X-Received: by 2002:a17:902:b497:b0:1e8:9f46:c1af with SMTP id y23-20020a170902b49700b001e89f46c1afmr1887171plr.63.1714563033464; Wed, 01 May 2024 04:30:33 -0700 (PDT) Received: from wheely.local0.net ([1.146.40.196]) by smtp.gmail.com with ESMTPSA id y22-20020a17090264d600b001ec64b128dasm2267150pli.129.2024.05.01.04.30.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 04:30:33 -0700 (PDT) From: Nicholas Piggin To: Andrew Jones Cc: Nicholas Piggin , Paolo Bonzini , Thomas Huth , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , =?utf-8?q?Nico_B=C3=B6hr?= , David Hildenbrand , Shaoqin Huang , Nikos Nikoleris , David Woodhouse , Ricardo Koller , rminmin , Gavin Shan , Nina Schoetterl-Glausch , Sean Christopherson , kvm@vger.kernel.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org Subject: [kvm-unit-tests PATCH v3 3/5] shellcheck: Fix SC2124 Date: Wed, 1 May 2024 21:29:32 +1000 Message-ID: <20240501112938.931452-4-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240501112938.931452-1-npiggin@gmail.com> References: <20240501112938.931452-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 SC2124 (warning): Assigning an array to a string! Assign as array, or use * instead of @ to concatenate. Shouldn't be a bug since bash concatenates with space and eval is used on the result. Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 45ec8f57d..95b6fa64d 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -150,7 +150,7 @@ run_migration () return 77 fi - migcmdline=$@ + migcmdline=("$@") trap 'trap - TERM ; kill 0 ; exit 2' INT TERM trap 'rm -f ${src_out} ${dst_out} ${src_outfifo} ${dst_outfifo} ${dst_incoming} ${src_qmp} ${dst_qmp} ${src_infifo} ${dst_infifo}' RETURN EXIT @@ -179,7 +179,7 @@ run_migration () exec {src_infifo_fd}<>${src_infifo} exec {dst_infifo_fd}<>${dst_infifo} - eval "$migcmdline" \ + eval "${migcmdline[@]}" \ -chardev socket,id=mon,path=${src_qmp},server=on,wait=off \ -mon chardev=mon,mode=control \ < ${src_infifo} > ${src_outfifo} & @@ -219,7 +219,7 @@ run_migration () do_migration () { - eval "$migcmdline" \ + eval "${migcmdline[@]}" \ -chardev socket,id=mon,path=${dst_qmp},server=on,wait=off \ -mon chardev=mon,mode=control -incoming unix:${dst_incoming} \ < ${dst_infifo} > ${dst_outfifo} & From patchwork Wed May 1 11:29:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13650484 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CEF1764A98; Wed, 1 May 2024 11:30:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714563045; cv=none; b=MvrgpKpx4rEmSTRvH29ifE66QuoasA3SPXxVArUdTpFmfYneQYBeZd5Z+8Yklwb8Fm6koNzrUxpKN6c+d1HZLM9R12dBeCRKeGisdBqurHkWallVb3/ssO7BOfwEDZt8ZUiDLUrzfQZOYu8rBSNuKZ9VgaNmPf0KpyYDwOact+I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714563045; c=relaxed/simple; bh=FFft7ygHb4sNew26D/dJgFST62xDvyHht1DMBSvtx6w=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=s3UlJPmt+g6g/Omzq/VP5OwVll6OkWBVRpSee0xown0rVUtBJ/H1EpV2wdva/X8XqznqaRAXh3u1piLdLZ9PSOCbXWNgpPHDLF/w66VhSXttXyxkLDElBGeY9NDulInmNw9wloqlMxnoNY/eEngdEy7RQKrEP4V+uKIs6SBcMUo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=gwQrTu3S; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="gwQrTu3S" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1e4bf0b3e06so66450745ad.1; Wed, 01 May 2024 04:30:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714563043; x=1715167843; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=DtN3qRr/BJ5ghrfuBVmkjt4OGFVHY6H/GotGGIKP5Pw=; b=gwQrTu3SxETFCZdPQURwWuhGq6AOx0NvqKW1yEeBoF3RuPjKnxuL9ZuSu1zR9cQfjz grxf377hjZ55FoBm/fI8hDTqoqSidq013gzvq2UACtdAvcGYRglEmmKt0kd3ZNwZfc4J t4gF//8GBZU9m7wvcTqNRdRWs6+evc360Cbs9jKEUYVY2/G87yd5g2szuigf13r7z24C vUagjdWGpusPdVIyG46SXuek1Kqd8MIpGHXC/Ie4nygCOHVHkIKvKHpd9RCuW3p805sl lRh1luIoiujdyy7nntx5E7mZsR7lekTOBL+bhOJIGZoyhbdW2Tg6aQ+rRJ/bAkxPB8IO cIpw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714563043; x=1715167843; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DtN3qRr/BJ5ghrfuBVmkjt4OGFVHY6H/GotGGIKP5Pw=; b=hQKcfW39f9fuhn8Wx/kUkFDtSMoB7ivqi35NYCr6KPX/wJnakBptwd0LkTAVWZcBQF ZCfmWS35fT7NNQSIc7Zzc+SOS+X3CvI7FBVIQjCcia17tvHyRsaGpUp9GYJScel7WxDi IFlTVGtdSNXMproS8VSKxf/pCx4d94rg/zykcZkffrZSLlqO6WgS3oLg2ilOTnC6sOd+ ALSh4dgPWfmISuS1YNBWNAmq8rAn03NdwfTQvphMVvcsCLRq3CF2wsXgdyGsHG12r9kv KCmN153p9CAqHlh3RJgr6GsjRWA/SX+EXj0g1njQ3A/4YT65sofjaxXodEMpRTnVOM3F 1o9Q== X-Forwarded-Encrypted: i=1; AJvYcCWfAtXfaZSUXtOldV2jeuHTADwIOxI0lHCzwR2p7O7t9PE1mA9fZIOzeY0RemO1NbUrYzQzPPdJpXwlgfvJGENaE65LOuzpIIDTJz9G124yLL3ojXNFwGpthqQMTcXYIw== X-Gm-Message-State: AOJu0YyJDUbMPWIoSm3NaVxcNVWEBg7SUm65QaoJI2fWEFUBrpE2hlrv BNSxsCTx8VYf2tdQjAkTwcEG54n4Fa7PdEi/id32SG0Tc4MZeWWJ X-Google-Smtp-Source: AGHT+IHV5oYZmLZqhk7vquCKub62gii9ohDvIT5N0GBLR7bQIFTMvArnXy34z/49jHpv24YnONJaaw== X-Received: by 2002:a17:902:d506:b0:1eb:2fa0:c56f with SMTP id b6-20020a170902d50600b001eb2fa0c56fmr2440147plg.35.1714563043212; Wed, 01 May 2024 04:30:43 -0700 (PDT) Received: from wheely.local0.net ([1.146.40.196]) by smtp.gmail.com with ESMTPSA id y22-20020a17090264d600b001ec64b128dasm2267150pli.129.2024.05.01.04.30.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 04:30:42 -0700 (PDT) From: Nicholas Piggin To: Andrew Jones Cc: Nicholas Piggin , Paolo Bonzini , Thomas Huth , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , =?utf-8?q?Nico_B=C3=B6hr?= , David Hildenbrand , Shaoqin Huang , Nikos Nikoleris , David Woodhouse , Ricardo Koller , rminmin , Gavin Shan , Nina Schoetterl-Glausch , Sean Christopherson , kvm@vger.kernel.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org Subject: [kvm-unit-tests PATCH v3 4/5] shellcheck: Fix SC2294 Date: Wed, 1 May 2024 21:29:33 +1000 Message-ID: <20240501112938.931452-5-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240501112938.931452-1-npiggin@gmail.com> References: <20240501112938.931452-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 SC2294 (warning): eval negates the benefit of arrays. Drop eval to preserve whitespace/symbols (or eval as string). No bug identified. Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- scripts/arch-run.bash | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 95b6fa64d..98d29b671 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -179,7 +179,7 @@ run_migration () exec {src_infifo_fd}<>${src_infifo} exec {dst_infifo_fd}<>${dst_infifo} - eval "${migcmdline[@]}" \ + "${migcmdline[@]}" \ -chardev socket,id=mon,path=${src_qmp},server=on,wait=off \ -mon chardev=mon,mode=control \ < ${src_infifo} > ${src_outfifo} & @@ -219,7 +219,7 @@ run_migration () do_migration () { - eval "${migcmdline[@]}" \ + "${migcmdline[@]}" \ -chardev socket,id=mon,path=${dst_qmp},server=on,wait=off \ -mon chardev=mon,mode=control -incoming unix:${dst_incoming} \ < ${dst_infifo} > ${dst_outfifo} & @@ -357,7 +357,7 @@ run_panic () qmp=$(mktemp -u -t panic-qmp.XXXXXXXXXX) # start VM stopped so we don't miss any events - eval "$@" -chardev socket,id=mon,path=${qmp},server=on,wait=off \ + "$@" -chardev socket,id=mon,path=${qmp},server=on,wait=off \ -mon chardev=mon,mode=control -S & panic_event_count=$(qmp_events ${qmp} | jq -c 'select(.event == "GUEST_PANICKED")' | wc -l) From patchwork Wed May 1 11:29:34 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicholas Piggin X-Patchwork-Id: 13650490 Received: from mail-pl1-f174.google.com (mail-pl1-f174.google.com [209.85.214.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D258D6166E; Wed, 1 May 2024 11:30:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714563055; cv=none; b=nXshrzuvQVSHvvdmS6cpB+Rqj1LKj2RFxr6R+jn3InboYmMguuC0SMmIdhGU+3uFkcF144ah34yT1zk4F3mRbdmmRN67DF7C/vKHGgYOhpTFBgMWQgRdMQO0YQ76yoIq/QKIABzxBc72E47bW6lRZypxqeD8gJSqwxxUA+OOUuw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714563055; c=relaxed/simple; bh=ZPWgrXuqWYUuAjdqFkmq3oOnUFlf/K4b5/Gpn5LRl04=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Jz4XbD+GS2tSBKh8P2Pumgmk8DQ585AMTLT8LV7Zgi71/KMPVFWn+tdHhFOqlrdMBXaQQZOl58FdWzuvCykHsgMmGdgl36HoeiknZN7iHAi4kzmtl6r04gPoQbaedFbydHalGrFAvPjydirJxCP5lRJmtF9ZyFeIvYJuL7PU0Vw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=RegDcHoz; arc=none smtp.client-ip=209.85.214.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="RegDcHoz" Received: by mail-pl1-f174.google.com with SMTP id d9443c01a7336-1eca195a7c8so2501245ad.2; Wed, 01 May 2024 04:30:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1714563053; x=1715167853; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aYhyM+QV5csxpHLgX/7kmJ/huORg40mwGJt/SbZ3cb0=; b=RegDcHoz8Gqa4ARc1L4RJeE6brXz9oV3AbeO0KIiktNnroO83lVk+ekDj1zC4fxC4h 40DvTE6XHOnk6sNeQqqPycZeQHwM0r4lnRBg+tPlC0ubb+jx4m59sQsEzfw5PDtdNl8H bXkPakZ+vqDlQmXhk9FZGhRjU0vcCT6KBPYHgrvBseWkmO284Hjo08uycOfl/U9ioD7h /RNatWObfh8L06MVRrfBaQy6ID4xuqvf9APCb3yWL2LchLnvZgfsbM/39M5trzLcs0NM 6xqbfGghmpMtkFDApeF1DepcJ94OoY1/yMJsd+a5mlQmgzpNDiQTv439+HuyNziLFcHA U36w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1714563053; x=1715167853; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aYhyM+QV5csxpHLgX/7kmJ/huORg40mwGJt/SbZ3cb0=; b=X9/8RNrK2zw7mXgGbywpWG7F+6i0zhRwAFHC070Ai6sjCF3jDLtlKQvUPDIP0jlpr5 V1Ygje7F8ePQb+wQyYtQFK2sQmzY2Y2RILUAPUciErChB670pnBeIn7P75Yt5w6Mr4XK wljKuJDLM95GcL2r3fMc4IwGyiu4whdNjYijUk2tJfNQwdCKHUxE0gRsxvCGHJxcnWy/ TzJbVy2TzZgzhuKBp/k76nd6c1ICNImGVKQjxIgaKAVEVnKfLkR3oWvqsTi5ctwteGzP PVcCF0z+q4Gpx1/eQL/tL0dqNSvvra8OA+g2MxmDCxd2s8+4EpbZTmx0xXQvHD6i7eVB ZIPA== X-Forwarded-Encrypted: i=1; AJvYcCWeQkImYtLwA5QxHkiBNwo3+tvk1bLsoumyjBIvOZQxKFOZ6Bzyfr93BrBtOyF30PBhb7eQtmx0plnVI2jyy0g7pz/wnINByNVTFv85ZRb5nv0XcD8qgoI+8RwUNxaZIQ== X-Gm-Message-State: AOJu0YyJ6ia9lyq7BDUIg5gXxhbcvFIq3itSJZylycP0dsWU+d0ccL7F jAuCWW1xT+xAeqdWGt9y0P8faS0wN7bGAYwGtpwrXW3X+wUti4to X-Google-Smtp-Source: AGHT+IFRvIa3dx8kGf4HFdIIro2Yu2MuudVt1JrMdj5z3e4X6RY0JLVjSEleK/CrHZosrlvZp4Yc8g== X-Received: by 2002:a17:902:bc45:b0:1e2:bc3c:bef6 with SMTP id t5-20020a170902bc4500b001e2bc3cbef6mr1904842plz.37.1714563053087; Wed, 01 May 2024 04:30:53 -0700 (PDT) Received: from wheely.local0.net ([1.146.40.196]) by smtp.gmail.com with ESMTPSA id y22-20020a17090264d600b001ec64b128dasm2267150pli.129.2024.05.01.04.30.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 01 May 2024 04:30:52 -0700 (PDT) From: Nicholas Piggin To: Andrew Jones Cc: Nicholas Piggin , Paolo Bonzini , Thomas Huth , Alexandru Elisei , Eric Auger , Janosch Frank , Claudio Imbrenda , =?utf-8?q?Nico_B=C3=B6hr?= , David Hildenbrand , Shaoqin Huang , Nikos Nikoleris , David Woodhouse , Ricardo Koller , rminmin , Gavin Shan , Nina Schoetterl-Glausch , Sean Christopherson , kvm@vger.kernel.org, kvmarm@lists.linux.dev, kvm-riscv@lists.infradead.org, linux-s390@vger.kernel.org Subject: [kvm-unit-tests PATCH v3 5/5] shellcheck: Suppress various messages Date: Wed, 1 May 2024 21:29:34 +1000 Message-ID: <20240501112938.931452-6-npiggin@gmail.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240501112938.931452-1-npiggin@gmail.com> References: <20240501112938.931452-1-npiggin@gmail.com> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Various info and warnings are suppressed here, where circumstances (commented) warrant. Reviewed-by: Andrew Jones Signed-off-by: Nicholas Piggin --- configure | 2 ++ run_tests.sh | 3 +++ scripts/arch-run.bash | 15 +++++++++++++++ scripts/mkstandalone.sh | 2 ++ scripts/runtime.bash | 2 ++ 5 files changed, 24 insertions(+) diff --git a/configure b/configure index 49f047cb2..e13a346d3 100755 --- a/configure +++ b/configure @@ -422,6 +422,8 @@ ln -sf "$asm" lib/asm # create the config cat < config.mak +# Shellcheck does not see these are used +# shellcheck disable=SC2034 SRCDIR=$srcdir PREFIX=$prefix HOST=$host diff --git a/run_tests.sh b/run_tests.sh index 938bb8edf..152323ffc 100755 --- a/run_tests.sh +++ b/run_tests.sh @@ -45,6 +45,9 @@ fi only_tests="" list_tests="" args=$(getopt -u -o ag:htj:vl -l all,group:,help,tap13,parallel:,verbose,list,probe-maxsmp -- "$@") +# Shellcheck likes to test commands directly rather than with $? but sometimes they +# are too long to put in the same test. +# shellcheck disable=SC2181 [ $? -ne 0 ] && exit 2; set -- $args; while [ $# -gt 0 ]; do diff --git a/scripts/arch-run.bash b/scripts/arch-run.bash index 98d29b671..8643bab3b 100644 --- a/scripts/arch-run.bash +++ b/scripts/arch-run.bash @@ -44,6 +44,8 @@ run_qemu () if [ "$errors" ]; then sig=$(grep 'terminating on signal' <<<"$errors") if [ "$sig" ]; then + # This is too complex for ${var/search/replace} + # shellcheck disable=SC2001 sig=$(sed 's/.*terminating on signal \([0-9][0-9]*\).*/\1/' <<<"$sig") fi fi @@ -174,9 +176,12 @@ run_migration () # Holding both ends of the input fifo open prevents opens from # blocking and readers getting EOF when a writer closes it. + # These fds appear to be unused to shellcheck so quieten the warning. mkfifo ${src_infifo} mkfifo ${dst_infifo} + # shellcheck disable=SC2034 exec {src_infifo_fd}<>${src_infifo} + # shellcheck disable=SC2034 exec {dst_infifo_fd}<>${dst_infifo} "${migcmdline[@]}" \ @@ -184,6 +189,9 @@ run_migration () -mon chardev=mon,mode=control \ < ${src_infifo} > ${src_outfifo} & live_pid=$! + # Shellcheck complains about useless cat but it is clearer than a + # redirect in this case. + # shellcheck disable=SC2002 cat ${src_outfifo} | tee ${src_out} | filter_quiet_msgs & # Start the first destination QEMU machine in advance of the test @@ -224,6 +232,9 @@ do_migration () -mon chardev=mon,mode=control -incoming unix:${dst_incoming} \ < ${dst_infifo} > ${dst_outfifo} & incoming_pid=$! + # Shellcheck complains about useless cat but it is clearer than a + # redirect in this case. + # shellcheck disable=SC2002 cat ${dst_outfifo} | tee ${dst_out} | filter_quiet_msgs & # The test must prompt the user to migrate, so wait for the @@ -467,6 +478,8 @@ env_params () [ -n "$ACCEL" ] && QEMU_ACCEL=$ACCEL fi QEMU_VERSION_STRING="$($qemu -h | head -1)" + # Shellcheck does not see QEMU_MAJOR|MINOR|MICRO are used + # shellcheck disable=SC2034 IFS='[ .]' read -r _ _ _ QEMU_MAJOR QEMU_MINOR QEMU_MICRO rest <<<"$QEMU_VERSION_STRING" fi env_add_params QEMU_ACCEL QEMU_VERSION_STRING QEMU_MAJOR QEMU_MINOR QEMU_MICRO @@ -597,6 +610,8 @@ hvf_available () set_qemu_accelerator () { + # Shellcheck does not see ACCEL_PROPS is used + # shellcheck disable=SC2034 ACCEL_PROPS=${ACCEL#"${ACCEL%%,*}"} ACCEL=${ACCEL%%,*} diff --git a/scripts/mkstandalone.sh b/scripts/mkstandalone.sh index 756647f29..2318a85f0 100755 --- a/scripts/mkstandalone.sh +++ b/scripts/mkstandalone.sh @@ -65,6 +65,8 @@ generate_test () fi temp_file bin "$kernel" + # Don't want to expand $bin but print it as-is. + # shellcheck disable=SC2016 args[3]='$bin' (echo "#!/usr/bin/env bash" diff --git a/scripts/runtime.bash b/scripts/runtime.bash index 597c90991..fb7c83a25 100644 --- a/scripts/runtime.bash +++ b/scripts/runtime.bash @@ -127,6 +127,8 @@ function run() # the check line can contain multiple files to check separated by a space # but each check parameter needs to be of the form = if [ "$check" ]; then + # There is no globbing or whitespace allowed in check parameters. + # shellcheck disable=SC2206 check=($check) for check_param in "${check[@]}"; do path=${check_param%%=*}