Skip to content

Commit c5712d1

Browse files
committed
Merge bitcoin/bitcoin#23506: test: Make more shell scripts verifiable by the shellcheck tool
a3f6167 test: Make more shell scripts verifiable by the `shellcheck` tool (Hennadii Stepanov) Pull request description: Some shell scripts from `contrib/guix` and `contrib/shell` are not verifiable by the `shellcheck` tool for the following reasons: - they have no extension (see bitcoin/bitcoin@4eccf06 from bitcoin/bitcoin#21375) - they have the `.bash` extension while `.sh` is expected This PR adds these scripts to the input for the `shellcheck` tool, and it fixes discovered `shellcheck` warnings. ACKs for top commit: dongcarl: Code Review ACK a3f6167, this is a good robustness improvement for our shell scripts. jamesob: crACK bitcoin/bitcoin@a3f6167 Tree-SHA512: 6703f5369d9c04c1a174491f381afa5ec2cc4d37321c1b93615abcdde4dfd3caae82868b699c25b72132d8c8c6f2e9cf24d38eb180ed4d0f0584d8c282e58935
2 parents 63c0d0e + a3f6167 commit c5712d1

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

contrib/guix/libexec/prelude.bash

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
export LC_ALL=C
33
set -e -o pipefail
44

5-
# shellcheck source=../../shell/realpath.bash
5+
# shellcheck source=contrib/shell/realpath.bash
66
source contrib/shell/realpath.bash
77

8-
# shellcheck source=../../shell/git-utils.bash
8+
# shellcheck source=contrib/shell/git-utils.bash
99
source contrib/shell/git-utils.bash
1010

1111
################

test/lint/lint-shell.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,13 @@ if ! command -v shellcheck > /dev/null; then
2020
exit $EXIT_CODE
2121
fi
2222

23-
SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced)
23+
SHELLCHECK_CMD=(shellcheck --external-sources --check-sourced --source-path=SCRIPTDIR)
2424
EXCLUDE="--exclude=$(IFS=','; echo "${disabled[*]}")"
2525
# Check shellcheck directive used for sourced files
2626
mapfile -t SOURCED_FILES < <(git ls-files | xargs gawk '/^# shellcheck shell=/ {print FILENAME} {nextfile}')
27+
mapfile -t GUIX_FILES < <(git ls-files contrib/guix contrib/shell | xargs gawk '/^#!\/usr\/bin\/env bash/ {print FILENAME} {nextfile}')
2728
mapfile -t FILES < <(git ls-files -- '*.sh' | grep -vE 'src/(leveldb|secp256k1|minisketch|univalue)/')
28-
if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" "${SOURCED_FILES[@]}" "${FILES[@]}"; then
29+
if ! "${SHELLCHECK_CMD[@]}" "$EXCLUDE" "${SOURCED_FILES[@]}" "${GUIX_FILES[@]}" "${FILES[@]}"; then
2930
EXIT_CODE=1
3031
fi
3132

0 commit comments

Comments
 (0)