From 836c0677748bfded842a65dc6e81d72f6423157c Mon Sep 17 00:00:00 2001 From: orbea Date: Thu, 26 Apr 2018 21:55:15 -0700 Subject: [PATCH] Fix parsing errors with shellcheck. Fixes shellcheck parsing errors by using safer quoting practices with eval. Line 217: for FILE in $SBOPKG_REPOS_D/*.repo; do ^-- SC1009: The mentioned syntax error was in this for loop. Line 219: while read LINE; do ^-- SC1073: Couldn't parse this while loop. Fix to allow more checks. ^-- SC1061: Couldn't find 'done' for this 'do'. Line 221: eval TMPARRAY=( "$LINE" ) ^-- SC1036: '(' is invalid here. Did you forget to escape it? ^-- SC1062: Expected 'done' matching previously mentioned 'do'. ^-- SC1072: Expected 'done'. Fix any mentioned problems and try again. ^-- SC1098: Quote/escape special characters when using eval, e.g. eval "a=(b)". Line 3054: for i in ${!MD5SUM[@]}; do ^-- SC1009: The mentioned syntax error was in this for loop. Line 3056: while :; do ^-- SC1073: Couldn't parse this while loop. Fix to allow more checks. ^-- SC1061: Couldn't find 'done' for this 'do'. Line 3065: eval SRCNAME=( $( ^-- SC1036: '(' is invalid here. Did you forget to escape it? ^-- SC1062: Expected 'done' matching previously mentioned 'do'. ^-- SC1072: Expected 'done'. Fix any mentioned problems and try again. ^-- SC1098: Quote/escape special characters when using eval, e.g. eval "a=(b)". Signed-off-by: Willy Sudiarto Raharjo --- src/usr/doc/THANKS | 1 + src/usr/sbin/sbopkg | 10 +++++----- tools/ChangeLog-latest.txt | 4 +++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/src/usr/doc/THANKS b/src/usr/doc/THANKS index 5b51f00..aa43f0c 100644 --- a/src/usr/doc/THANKS +++ b/src/usr/doc/THANKS @@ -93,3 +93,4 @@ We moved to github, so revision number no longer used Alan Erich Ritz arcctgx + orbea diff --git a/src/usr/sbin/sbopkg b/src/usr/sbin/sbopkg index fab4922..c59bb7b 100755 --- a/src/usr/sbin/sbopkg +++ b/src/usr/sbin/sbopkg @@ -218,7 +218,7 @@ load_repositories() { # Reading from $FILE... while read LINE; do grep -q '#' <<< "$LINE" && continue - eval TMPARRAY=( "$LINE" ) + eval "TMPARRAY=( $LINE )" [[ ${#TMPARRAY[@]} -eq 0 ]] && continue; # Sanity checks # these two assignments work around a bash3-4 incompatibility @@ -3062,11 +3062,11 @@ get_source() { # inside file names. # We know that we could obtain the same result faster by mangling # with IFS, but the resulting code was a bit too hacky. - eval SRCNAME=( $( + eval "SRCNAME=( $( while read LINE; do - printf '%q ' "$LINE" - done <<< "$SRCNAME" - ) ) + printf '%q ' $LINE + done <<< $SRCNAME + ) )" check_source $PKG ${MD5SUM[$i]} "${SRCNAME[$i]}" case $? in diff --git a/tools/ChangeLog-latest.txt b/tools/ChangeLog-latest.txt index 8886e5c..fedf7bd 100644 --- a/tools/ChangeLog-latest.txt +++ b/tools/ChangeLog-latest.txt @@ -1,6 +1,6 @@ SBOPKG NEWS -sbopkg-dev (2018-04-26 00:253:36 UTC) +sbopkg-dev (2018-04-27 15:36:23 UTC) FEATURES * sqg: Parallelize building of single and all packages by option -j. Patch by Marcel Saegebarth. @@ -37,6 +37,8 @@ sbopkg-dev (2018-04-26 00:253:36 UTC) Patch by Erich Ritz * Fix bug in updates_compare_versions() Patch by arcctgx (#41) + * Fix parsing errors with shellcheck. + Patch by orbea (#42) sbopkg 0.38.1 (2016-09-01 13:42 UTC) FEATURES