diff --git a/debian/update-dch-from-git b/debian/update-dch-from-git index 93d8fb5297f..e5af4fae85b 100755 --- a/debian/update-dch-from-git +++ b/debian/update-dch-from-git @@ -9,6 +9,8 @@ source scripts/githelper.sh githelper "$1" GIT_VERSION=$(scripts/get-version-from-git "$GIT_BRANCH") +# Need to use $? because we need the output capture +# shellcheck disable=SC2181 if [ $? -ne 0 ]; then echo "error determining version!" exit 1 diff --git a/docs/src/asciideps b/docs/src/asciideps index af1d19ab7d9..b1bd54dcd85 100755 --- a/docs/src/asciideps +++ b/docs/src/asciideps @@ -1,14 +1,16 @@ -#!/bin/sh +#!/bin/bash set -e test -z "$1" && exit 0 test -f "$1" || exit 1 +includestack=( ) + includes () { DIR=$(dirname "$1") - for f in $(sed -ne "s|^include::\(.*\)\[\]$|$DIR/\1|p" "$1"); do + while IFS= read -r f; do # components_gen.adoc will contain only generated content case "$f" in */components_gen.adoc) @@ -16,8 +18,15 @@ includes () { ;; esac echo "$f" + ff=$(realpath "$f") + if [[ " ${includestack[*]} " =~ [[:space:]]${ff}[[:space:]] ]]; then + echo "Include file recursion detected on '$f'. Skipped." >&2 + continue + fi + includestack+=("$ff") includes "$f" - done + unset 'includestack[${#includestack[@]}-1]' + done < <(sed -ne "s|^include::\(.*\)\[\]$|$DIR/\1|p" "$1") } images() { diff --git a/scripts/linuxcnc_info.in b/scripts/linuxcnc_info.in index cba739765ed..324ad0564f5 100755 --- a/scripts/linuxcnc_info.in +++ b/scripts/linuxcnc_info.in @@ -90,7 +90,7 @@ function parse_after_colon () { function tryversion () { prog="$1" - if [ $(command -v "$prog") ] ; then + if [ "$(command -v "$prog")" ] ; then ans=$($prog --version 2>/dev/null) if [ -z "$ans" ] ; then echo "?" @@ -165,9 +165,14 @@ for n in $(linuxcnc_var all) ; do show "${n%%=*}" "${n##*=}" done +# Not everybody runs Debian based distros echo -echo "dpkg -l '*linuxcnc*':" -dpkg -l '*linuxcnc*' +if command -v dpkg > /dev/null; then + echo "dpkg -l '*linuxcnc*':" + dpkg -l '*linuxcnc*' +else + echo "No 'dpkg' available, different distro, probably." +fi echo [ -n "$VIEWER" ] && $VIEWER "$ofile" diff --git a/scripts/rip-environment.in b/scripts/rip-environment.in index 13da69e22e8..9ef885a6ab1 100644 --- a/scripts/rip-environment.in +++ b/scripts/rip-environment.in @@ -118,8 +118,8 @@ if ! $as_command; then else _iningc () { case "$3" in - *.ini) COMPREPLY=($(compgen -o plusdirs -f -X '!*.ngc' -- "$2")) ;; - *) COMPREPLY=($(compgen -o plusdirs -f -X '!*.ini' -- "$2")) + *.ini) mapfile -t COMPREPLY < <(compgen -o plusdirs -f -X '!*.ngc' -- "$2") ;; + *) mapfile -t COMPREPLY < <(compgen -o plusdirs -f -X '!*.ini' -- "$2") esac } complete -o plusdirs -F _iningc emc axis