From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id AD65C15810F for ; Sat, 10 Jun 2023 04:22:06 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id EF81EE0943; Sat, 10 Jun 2023 04:22:05 +0000 (UTC) Received: from smtp.gentoo.org (dev.gentoo.org [IPv6:2001:470:ea4a:1:5054:ff:fec7:86e4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id CDA29E0943 for ; Sat, 10 Jun 2023 04:22:05 +0000 (UTC) Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 2410833FECD for ; Sat, 10 Jun 2023 04:22:05 +0000 (UTC) Received: from localhost.localdomain (localhost [IPv6:::1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 7BBE4A93 for ; Sat, 10 Jun 2023 04:22:02 +0000 (UTC) From: "Sam James" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Sam James" Message-ID: <1686350869.6dea8b6b960b3370461a1b42c05f101bf42c89a4.sam@gentoo> Subject: [gentoo-commits] proj/gentoo-functions:master commit in: / X-VCS-Repository: proj/gentoo-functions X-VCS-Files: functions.sh.in test-functions X-VCS-Directories: / X-VCS-Committer: sam X-VCS-Committer-Name: Sam James X-VCS-Revision: 6dea8b6b960b3370461a1b42c05f101bf42c89a4 X-VCS-Branch: master Date: Sat, 10 Jun 2023 04:22:02 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Auto-Response-Suppress: DR, RN, NRN, OOF, AutoReply X-Archives-Salt: e0b92dff-f13c-420a-93a4-296a0cf83e2c X-Archives-Hash: 2a08ee02e173c76e7ba9aaf2888a3ad1 commit: 6dea8b6b960b3370461a1b42c05f101bf42c89a4 Author: Kerin Millar plushkava net> AuthorDate: Fri Jun 9 22:44:10 2023 +0000 Commit: Sam James gentoo org> CommitDate: Fri Jun 9 22:47:49 2023 +0000 URL: https://gitweb.gentoo.org/proj/gentoo-functions.git/commit/?id=6dea8b6b Address a slew of shellcheck warnings False-positives galore. It's getting out of hand for test-functions, so I disabled several more tests in its global scope. It was correct to point out that "${PWD}" should be quoted, however. Bash doesn't mind but other sh implementations might. Signed-off-by: Kerin Millar plushkava.net> functions.sh.in | 4 +++- test-functions | 18 ++++++++++-------- 2 files changed, 13 insertions(+), 9 deletions(-) diff --git a/functions.sh.in b/functions.sh.in index d4becf8..76f1ad4 100644 --- a/functions.sh.in +++ b/functions.sh.in @@ -547,11 +547,13 @@ is_int() { # chdir() { if [ "$BASH" ]; then + # shellcheck disable=3044 shopt -u cdable_vars fi if [ "$1" = - ]; then set -- ./- fi + # shellcheck disable=1007,2164 CDPATH= cd -- "$@" } @@ -648,7 +650,7 @@ _update_cursor_coords() { } _ecma48_cpr() { - @GENTOO_LIBEXEC_DIR@/ecma48-cpr "$@" + @GENTOO_LIBEXEC_DIR@/ecma48-cpr } # This is the main script, please add all functions above this point! diff --git a/test-functions b/test-functions index 9f87e98..34dc8b8 100755 --- a/test-functions +++ b/test-functions @@ -1,5 +1,5 @@ #!/bin/sh -# shellcheck disable=2015 +# shellcheck disable=2015,2154,2164,2181,2317 # Requires mktemp(1), which is not a standard utility, but is commonly # available. The implementations provided by GNU coreutils, busybox and toybox @@ -43,9 +43,10 @@ test_chdir() { shift test_description="chdir $(print_args "$@")" if [ "$BASH" ]; then + # shellcheck disable=3044 shopt -s cdable_vars fi - CDPATH=child var=$CDPATH chdir "$@" \ + CDPATH=child var=child chdir "$@" \ && test "$PWD" != "$OLDPWD" \ && cd - >/dev/null } @@ -221,8 +222,8 @@ test_is_identifier() { 1 [Z \ 1 '`a' \ 1 '`Z' \ - 1 {a \ - 1 {Z \ + 1 '{a' \ + 1 '{Z' \ 1 '|a' \ 1 '|Z' \ 1 a/ \ @@ -233,8 +234,8 @@ test_is_identifier() { 1 Z[ \ 1 'a`' \ 1 'Z`' \ - 1 a{ \ - 1 Z{ \ + 1 'a{' \ + 1 'Z{' \ 1 'a|' \ 1 'Z|' \ 0 a \ @@ -351,6 +352,7 @@ test_yesno() { 1 '_"; set -- yes # code injection' \ 0 truthful_nameref + # shellcheck disable=2034 truthful_nameref=yes callback() { @@ -433,8 +435,8 @@ fi # ecma48-cpr utility will not yet have been installed. Account for that by # redeclaring its shim function. if [ "${EBUILD_PHASE}" = test ]; then - export BUILD_DIR=${PWD} - _ecma48_cpr() { "${BUILD_DIR}"/ecma48-cpr "$@"; } + export BUILD_DIR="${PWD}" + _ecma48_cpr() { "${BUILD_DIR}"/ecma48-cpr; } fi assign_tmpdir