Skip to content

GROOVY-9018: fix shellcheck warnings for bin scripts#896

Closed
calid wants to merge 1 commit intoapache:masterfrom
calid:fix-shellcheck-warnings
Closed

GROOVY-9018: fix shellcheck warnings for bin scripts#896
calid wants to merge 1 commit intoapache:masterfrom
calid:fix-shellcheck-warnings

Conversation

@calid
Copy link
Copy Markdown
Contributor

@calid calid commented Mar 12, 2019

No description provided.

@calid calid force-pushed the fix-shellcheck-warnings branch from a2340ba to 753eb40 Compare March 12, 2019 21:12
@paulk-asert
Copy link
Copy Markdown
Contributor

I changed the .gitignore separately, so you can remove that commit.

Also, the completion script are generated by picocli, so we wouldn't apply that here since it would be overwritten the next time they are generated. Instead, if you have the time, it would be great if you approached that project and had them update their templates/code which are used when generating those files.

But the bootstrap changes look good to me. I'll see if anyone else comments.

most are common gotchas like lack of variable quoting, using deprecated
constructs like '``' instead of '$()', not exporting env vars used in
child scripts, and using non-portable operators like '-a' and '-o' in
conditionals

some specific items to note in startGroovy:
  * ulimit -H -n is technically not portable as POSIX ulimit only
    supports -f.  however there is no clean POSIX-y alternative and after
    researching pretty much every shell on every *nix implements these
    options, so I've simply added a comment that suppresses this warning

  * the logic to munge arguments on cygwin was unecessarily commplex
    (and not portable). i've replaced this with a far simpler solution
    that builds up the munged arguments string dynamically then uses eval
    to invoke set and override the positional parameters

  * the final java invocation did 'eval exec' which is unecessary and a
    little nonsensical. directly using exec along with standard variable
    interpolation should suffice. however since we _do_ want word
    splitting on the JAVA_OPTS argument we disable the double quote
    warning here

a complete dump of all the warnings shellcheck reported can be found
here: https://gist.github.com/calid/634258c25f9d4aa0c1327eff1c5b16e1
@calid calid force-pushed the fix-shellcheck-warnings branch from 753eb40 to b00dc95 Compare March 13, 2019 13:19
@calid
Copy link
Copy Markdown
Contributor Author

calid commented Mar 13, 2019

ok sounds good, updated the PR accordingly

@asfgit asfgit closed this in cdf3585 Mar 18, 2019
asfgit pushed a commit that referenced this pull request Mar 18, 2019
most are common gotchas like lack of variable quoting, using deprecated
constructs like '``' instead of '$()', not exporting env vars used in
child scripts, and using non-portable operators like '-a' and '-o' in
conditionals

some specific items to note in startGroovy:
  * ulimit -H -n is technically not portable as POSIX ulimit only
    supports -f.  however there is no clean POSIX-y alternative and after
    researching pretty much every shell on every *nix implements these
    options, so I've simply added a comment that suppresses this warning

  * the logic to munge arguments on cygwin was unecessarily commplex
    (and not portable). i've replaced this with a far simpler solution
    that builds up the munged arguments string dynamically then uses eval
    to invoke set and override the positional parameters

  * the final java invocation did 'eval exec' which is unecessary and a
    little nonsensical. directly using exec along with standard variable
    interpolation should suffice. however since we _do_ want word
    splitting on the JAVA_OPTS argument we disable the double quote
    warning here

a complete dump of all the warnings shellcheck reported can be found
here: https://gist.github.com/calid/634258c25f9d4aa0c1327eff1c5b16e1
@paulk-asert
Copy link
Copy Markdown
Contributor

Merged, thanks!

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

Successfully merging this pull request may close these issues.

2 participants