From 96cad8291000f4a866d26a62cc08d342ed9c65fb Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Fri, 30 Oct 2020 12:12:10 +0100 Subject: [PATCH 1/2] dist/tools: Use bash instead of sh where needed A number of scripts use features from bash such as `local` which are not in the POSIX spec. This breaks on systems where sh is not symlinked to bash. This patch changes the interpreter indicated by the hashbang to bash for those scripts --- dist/tools/ci/print_toolchain_versions.sh | 2 +- dist/tools/coccinelle/check.sh | 2 +- dist/tools/dlcache/dlcache.sh | 2 +- dist/tools/git/git-cache | 2 +- dist/tools/licenses/check.sh | 2 +- 5 files changed, 5 insertions(+), 5 deletions(-) diff --git a/dist/tools/ci/print_toolchain_versions.sh b/dist/tools/ci/print_toolchain_versions.sh index 49abec1f07..c3e6444387 100755 --- a/dist/tools/ci/print_toolchain_versions.sh +++ b/dist/tools/ci/print_toolchain_versions.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash MAKE=${MAKE:-make} diff --git a/dist/tools/coccinelle/check.sh b/dist/tools/coccinelle/check.sh index 73b7bd533c..8aa2310c24 100755 --- a/dist/tools/coccinelle/check.sh +++ b/dist/tools/coccinelle/check.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright 2017 Kaspar Schleiser # diff --git a/dist/tools/dlcache/dlcache.sh b/dist/tools/dlcache/dlcache.sh index 08cf7d6de4..dfcdd5e04d 100755 --- a/dist/tools/dlcache/dlcache.sh +++ b/dist/tools/dlcache/dlcache.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash DLCACHE_DIR=${DLCACHE_DIR:-~/.dlcache} diff --git a/dist/tools/git/git-cache b/dist/tools/git/git-cache index 24e4de4ffd..7534396937 100755 --- a/dist/tools/git/git-cache +++ b/dist/tools/git/git-cache @@ -1,4 +1,4 @@ -#!/bin/sh -e +#!/bin/bash -e [ "$GIT_CACHE_VERBOSE" != "1" ] && Q=-q diff --git a/dist/tools/licenses/check.sh b/dist/tools/licenses/check.sh index 92bab9798a..203a99e748 100755 --- a/dist/tools/licenses/check.sh +++ b/dist/tools/licenses/check.sh @@ -1,4 +1,4 @@ -#!/bin/sh +#!/bin/bash # Copyright 2017 Kaspar Schleiser # Copyright 2014 Ludwig Knüpfer From c5b2ded055672def0eee0b8b666cd1ec9c2985be Mon Sep 17 00:00:00 2001 From: Koen Zandberg Date: Fri, 30 Oct 2020 13:12:35 +0100 Subject: [PATCH 2/2] dist/tools: Use `/usr/bin/env bash` for bash scripts --- dist/tools/ci/print_toolchain_versions.sh | 2 +- dist/tools/coccinelle/check.sh | 2 +- dist/tools/dlcache/dlcache.sh | 2 +- dist/tools/git/git-cache | 4 +++- .../insufficient_memory/add_insufficient_memory_board.sh | 2 +- dist/tools/licenses/check.sh | 2 +- dist/tools/uncrustify/uncrustify.sh | 2 +- dist/tools/vera++/check.sh | 2 +- 8 files changed, 10 insertions(+), 8 deletions(-) diff --git a/dist/tools/ci/print_toolchain_versions.sh b/dist/tools/ci/print_toolchain_versions.sh index c3e6444387..e2dd6c2d0b 100755 --- a/dist/tools/ci/print_toolchain_versions.sh +++ b/dist/tools/ci/print_toolchain_versions.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash MAKE=${MAKE:-make} diff --git a/dist/tools/coccinelle/check.sh b/dist/tools/coccinelle/check.sh index 8aa2310c24..7ab1a0277c 100755 --- a/dist/tools/coccinelle/check.sh +++ b/dist/tools/coccinelle/check.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2017 Kaspar Schleiser # diff --git a/dist/tools/dlcache/dlcache.sh b/dist/tools/dlcache/dlcache.sh index dfcdd5e04d..1585f9751b 100755 --- a/dist/tools/dlcache/dlcache.sh +++ b/dist/tools/dlcache/dlcache.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash DLCACHE_DIR=${DLCACHE_DIR:-~/.dlcache} diff --git a/dist/tools/git/git-cache b/dist/tools/git/git-cache index 7534396937..6d9ecb0aff 100755 --- a/dist/tools/git/git-cache +++ b/dist/tools/git/git-cache @@ -1,4 +1,6 @@ -#!/bin/bash -e +#!/usr/bin/env bash + +set -e [ "$GIT_CACHE_VERBOSE" != "1" ] && Q=-q diff --git a/dist/tools/insufficient_memory/add_insufficient_memory_board.sh b/dist/tools/insufficient_memory/add_insufficient_memory_board.sh index 557afebccb..12091c5494 100755 --- a/dist/tools/insufficient_memory/add_insufficient_memory_board.sh +++ b/dist/tools/insufficient_memory/add_insufficient_memory_board.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # # Copyright (C) 2019 Benjamin Valentin # diff --git a/dist/tools/licenses/check.sh b/dist/tools/licenses/check.sh index 203a99e748..8bebb0303b 100755 --- a/dist/tools/licenses/check.sh +++ b/dist/tools/licenses/check.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2017 Kaspar Schleiser # Copyright 2014 Ludwig Knüpfer diff --git a/dist/tools/uncrustify/uncrustify.sh b/dist/tools/uncrustify/uncrustify.sh index 0cf6891550..bdc5a2c419 100755 --- a/dist/tools/uncrustify/uncrustify.sh +++ b/dist/tools/uncrustify/uncrustify.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash RIOTBASE=$(git rev-parse --show-toplevel) CURDIR=$(cd "$(dirname "$0")" && pwd) UNCRUSTIFY_CFG="$RIOTBASE"/uncrustify-riot.cfg diff --git a/dist/tools/vera++/check.sh b/dist/tools/vera++/check.sh index cc97476a35..65356accaa 100755 --- a/dist/tools/vera++/check.sh +++ b/dist/tools/vera++/check.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash # Copyright 2018 Jose Ignacio Alamos #