From patchwork Tue Jul 4 08:25:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Juerg Haefliger X-Patchwork-Id: 1803096 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=canonical.com header.i=@canonical.com header.a=rsa-sha256 header.s=20210705 header.b=XRyOQxmx; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QwG8M5dnCz20bK for ; Tue, 4 Jul 2023 18:25:55 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1qGbM6-00024A-KV; Tue, 04 Jul 2023 08:25:50 +0000 Received: from smtp-relay-internal-1.internal ([10.131.114.114] helo=smtp-relay-internal-1.canonical.com) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1qGbM3-00021U-CO for kernel-team@lists.ubuntu.com; Tue, 04 Jul 2023 08:25:47 +0000 Received: from mail-ej1-f71.google.com (mail-ej1-f71.google.com [209.85.218.71]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-internal-1.canonical.com (Postfix) with ESMTPS id 0AF103F133 for ; Tue, 4 Jul 2023 08:25:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1688459147; bh=gPqq21c1U3bkVRTUxSgCglTrwGtWsJMlYqx0pRJw2Nc=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=XRyOQxmxTW0K+H/fmsZuM5COV/kOP5WoMagxll18YsJ9GuDk7XD2xwHBLoWvEHl4C pFaW0Iyw5W8QEvEKjrUUjXNfbWzxPmdpWvsRygp4eoZTMHuYAba7phNqcvkaqQ1lg5 MFhsR17AvRuTX/VJOUGpZc7jNhwswR9aItZo6wImUqJyCAIytpArLnkBArHt/6U3PC K1BuKc6t5g7px1dGq4sxdaftN1uZ1O2aS/VUmlikki/HrSitzBVnLakB/Vwfsr4bq4 rfQ+1ta8uzB9ZmtlLgBcnze49xcBnJzLxXNjqBwaKzuWy/BJFruffjQNKPpW3ieRcB lqSC+EtCB8z5Q== Received: by mail-ej1-f71.google.com with SMTP id a640c23a62f3a-9879d2fc970so380218466b.0 for ; Tue, 04 Jul 2023 01:25:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688459146; x=1691051146; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=gPqq21c1U3bkVRTUxSgCglTrwGtWsJMlYqx0pRJw2Nc=; b=QSP4DMOG5xAypMXVRvQ5IVQsDrq8Y5vaKpSYoXQhrsU2AHr17n4y2L5PyGkxL+zjD2 9Yri2wItJFUOVQhELdcyVL6CxJ1vMtO/jYRAwEzHfior0pZx2aQb/T9jh55RINOoYVHh 8F7hdq3bHS+FzZBywaRHD1P89pVjCsVUmlZL0vpKUekzWDWy+HqH62PTHkNDkqipK6Sp //XqvLIaxJ1Y2ajxq76ikYylV8Rv/SC0SnTgONAY6WEtGK+o29kBHh+KSTaQDI10WunH +obKW2FDXGpYhDid9hJbCWzgTiBUTmJuqJUZEjImz/LCynvxq6boSTlOFxkcxx1IdxvH y7cw== X-Gm-Message-State: ABy/qLYZ7TBqmJQe7nnkMgSXN9yUJYQ2/kCYjbOOxbMJ8Pv8t5/54+ra ZdomakjMln1IXosjuwEQRGxeWwcUUF0oPBep0ghFQrUJKipBUgFkGe1Q6+NLDSXpLDTmKdl3AU+ e1Lc7thIP0zxJzfgUwNI0ztObjDJVyR3HswBLMZLZO5OdW92k5g== X-Received: by 2002:a17:906:748:b0:98d:cacb:888f with SMTP id z8-20020a170906074800b0098dcacb888fmr9895266ejb.49.1688459146700; Tue, 04 Jul 2023 01:25:46 -0700 (PDT) X-Google-Smtp-Source: APBJJlH82kEMDnis8diiW7/DHx7HFpZFO7+a4UTVoGAOyObn68s2FuH8Plkb152TLmfnLYd5erUfvg== X-Received: by 2002:a17:906:748:b0:98d:cacb:888f with SMTP id z8-20020a170906074800b0098dcacb888fmr9895248ejb.49.1688459146413; Tue, 04 Jul 2023 01:25:46 -0700 (PDT) Received: from localhost ([194.191.244.86]) by smtp.gmail.com with ESMTPSA id d10-20020a056402078a00b0051de38eb925sm6127822edy.93.2023.07.04.01.25.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Jul 2023 01:25:46 -0700 (PDT) From: Juerg Haefliger To: kernel-team@lists.ubuntu.com Subject: [Unstable/Mantic][PATCH 3/3] UBUNTU: [Packaging] checks/final-checks: Fix shellcheck issues Date: Tue, 4 Jul 2023 10:25:40 +0200 Message-Id: <20230704082540.14960-4-juerg.haefliger@canonical.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230704082540.14960-1-juerg.haefliger@canonical.com> References: <20230704082540.14960-1-juerg.haefliger@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" Fix the following shellcheck reported issues: - SC2145 (error): Argument mixes string and array. Use * or separate argument. - SC2166 (warning): Prefer [ p ] && [ q ] as [ p -a q ] is not well defined. - SC2086 (info): Double quote to prevent globbing and word splitting. - SC2140 (warning): Word is of the form "A"B"C" (B indicated). Did you mean "ABC" or "A\"B\"C"? - SC2181 (style): Check exit code directly with e.g. 'if ! mycmd;', not indirectly with $?. - SC2001 (style): See if you can use ${variable//search/replace} instead. Signed-off-by: Juerg Haefliger --- debian/scripts/checks/final-checks | 33 ++++++++++++++---------------- 1 file changed, 15 insertions(+), 18 deletions(-) diff --git a/debian/scripts/checks/final-checks b/debian/scripts/checks/final-checks index 2c03c47d0321..37067f90be3a 100755 --- a/debian/scripts/checks/final-checks +++ b/debian/scripts/checks/final-checks @@ -15,7 +15,7 @@ fail=0 failure() { - echo "EE: $@" 1>&2 + echo "EE: $*" 1>&2 fail=1 } @@ -27,23 +27,23 @@ abi_check() local abidir="$abidir/$arch" - if [ ! -f "$abidir/$flavour" -a \ - ! -f "$abidir/$flavour.ignore" -a \ - ! -f "$abidir/ignore" ] + if [ ! -f "$abidir/$flavour" ] && \ + [ ! -f "$abidir/$flavour.ignore" ] && \ + [ ! -f "$abidir/ignore" ] then failure "$arch/$flavour ABI symbol file missing" fi - if [ ! -f "$abidir/$flavour.modules" -a \ - ! -f "$abidir/$flavour.ignore.modules" -a \ - ! -f "$abidir/ignore.modules" ] + if [ ! -f "$abidir/$flavour.modules" ] && \ + [ ! -f "$abidir/$flavour.ignore.modules" ] && \ + [ ! -f "$abidir/ignore.modules" ] then failure "$arch/$flavour ABI modules file missing" fi - if [ ! -f "$abidir/$flavour.retpoline" -a \ - ! -f "$abidir/$flavour.ignore.retpoline" -a \ - ! -f "$abidir/ignore.retpoline" ] + if [ ! -f "$abidir/$flavour.retpoline" ] && \ + [ ! -f "$abidir/$flavour.ignore.retpoline" ] && \ + [ ! -f "$abidir/ignore.retpoline" ] then failure "$arch/$flavour ABI retpoline file missing" fi @@ -67,7 +67,7 @@ do continue fi - image_pkg=$(awk -F '\\s*=\\s*' '$1 == "do_flavour_image_package" { print $2 }' $debian/rules.d/$arch.mk) + image_pkg=$(awk -F '\\s*=\\s*' '$1 == "do_flavour_image_package" { print $2 }' "$debian/rules.d/$arch.mk") if [ "$image_pkg" = "false" ]; then continue fi @@ -79,17 +79,14 @@ do }' "$debian/rules.d/$arch.mk") for flavour in $flavours do - flavour=$(echo "$flavour" | sed -e 's@.*/config.flavour.@@') if [ -d debian/certs ]; then - python3 debian/scripts/misc/annotations --export -c CONFIG_SYSTEM_TRUSTED_KEYS --arch $arch --flavour $flavour | grep -q '^CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"$' - if [ $? -ne 0 ]; then - failure "'CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"' is required" + if ! python3 debian/scripts/misc/annotations --export -c CONFIG_SYSTEM_TRUSTED_KEYS --arch "$arch" --flavour "$flavour" | grep -q '^CONFIG_SYSTEM_TRUSTED_KEYS="debian/canonical-certs.pem"$' ; then + failure "'CONFIG_SYSTEM_TRUSTED_KEYS=\"debian/canonical-certs.pem\"' is required" fi fi if [ -d debian/revoked-certs ]; then - python3 debian/scripts/misc/annotations --export -c CONFIG_SYSTEM_REVOCATION_KEYS --arch $arch --flavour $flavour | grep -q '^CONFIG_SYSTEM_REVOCATION_KEYS="debian/canonical-revoked-certs.pem"$' - if [ $? -ne 0 ]; then - failure "'CONFIG_SYSTEM_REVOCATION_KEYS="debian/canonical-revoked-certs.pem"' is required" + if ! python3 debian/scripts/misc/annotations --export -c CONFIG_SYSTEM_REVOCATION_KEYS --arch "$arch" --flavour "$flavour" | grep -q '^CONFIG_SYSTEM_REVOCATION_KEYS="debian/canonical-revoked-certs.pem"$' ; then + failure "'CONFIG_SYSTEM_REVOCATION_KEYS=\"debian/canonical-revoked-certs.pem\"' is required" fi fi if [ "${skipabi}" = "false" ] ; then