Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Run shellcheck on jbang script #419

Open
alblue opened this issue Oct 10, 2020 · 2 comments
Open

Run shellcheck on jbang script #419

alblue opened this issue Oct 10, 2020 · 2 comments

Comments

@alblue
Copy link
Contributor

alblue commented Oct 10, 2020

Running shellcheck on jbang results in a number of warnings/errors. It would be benefiical if you could run shellcheck on jbang and/or have it run as part of a GitHub action.

@alblue
Copy link
Contributor Author

alblue commented Oct 10, 2020

shellcheck jbang

In jbang line 20:
sym_resolved=$(readlink ${minusFarg} $1)
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 23:
echo $sym_resolved
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 25:
echo $1
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 31:
curl -sLf -H "Accept: application/gzip, application/octet-stream" -o "$2" $1
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 34:
wget -q --header="Accept: application/gzip, application/octet-stream" -O "$2" $1
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 42:
abs_jbang_path=$(resolve_symlink $(absolute_path $0))
^-- SC2046: Quote this to prevent word splitting.
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 46:
$(dirname $abs_jbang_path)/jbang.cmd $*
^-- SC2046: Quote this to prevent word splitting.
^-- SC2086: Double quote to prevent globbing and word splitting.
^-- SC2048: Use "$@" (with quotes) to prevent whitespace problems.
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 54:
if [ -f "$(dirname $abs_jbang_path)/jbang.jar" ]; then
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 55:
jarPath=$(dirname $abs_jbang_path)/jbang.jar
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 56:
elif [ -f "$(dirname $abs_jbang_path)/.jbang/jbang.jar" ]; then
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 57:
jarPath=$(dirname $abs_jbang_path)/.jbang/jbang.jar
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 69:
rm -rf "$JBDIR/bin"
^-- SC2115: Use "${var:?}" to ensure this never expands to /bin .

In jbang line 100:
if [ -x "$(command -v $JAVA_HOME/bin/javac)" ]; then
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 122:
download $jdkurl "$TDIR/bootstrap-jdk.tgz"
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 142:
${JAVA_EXEC} -classpath ${jarPath} dev.jbang.Main jdk default $javaVersion
^-- SC2086: Double quote to prevent globbing and word splitting.
^-- SC2086: Double quote to prevent globbing and word splitting.

In jbang line 151:
output=$(CLICOLOR_FORCE=1 ${JAVA_EXEC} ${JBANG_JAVA_OPTIONS} -classpath ${jarPath} dev.jbang.Main "$@")
^-- SC2086: Double quote to prevent globbing and word splitting.
^-- SC2086: Double quote to prevent globbing and word splitting.

@maxandersen
Copy link
Collaborator

Maan - could have used that some months ago :)

Now I wonder if some of our quoting assumptions will fix or break things.

maxandersen added a commit to maxandersen/jbang that referenced this issue Oct 11, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants