-
-
Notifications
You must be signed in to change notification settings - Fork 634
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
SDK issues with 'set -eu' #597
Comments
I've personally never used the
This is not default shell behaviour and something that we rely on heavily when passing function parameters. In the context of our CLI, I am not really comfortable building in such defensive code, especially since this should never happen under normal circumstances. Hope this makes sense to you. Regarding the tests, we have a mixture of cucumber specifications (which has step defs acting upon a small bash environment), as well as some Spock specifications for more fine-grained testing. It's quite complex, so I suggest working your way through the test code from the top down. |
Not heard anything back after my previous reply so closing this issue for now. If further discussion is required, please raise it in our Gitter user-issues chat room. |
@marc0der I am also encountering this problem. In my particular example I am encountering this trying to use SDKMAN with direnv. I know SDKMAN has the The solution seems rather straightforward, replace |
Yes, PRs are always welcome. We just need to make sure that it doesn't trip up shellcheck. |
Any shell, not just zsh, can have a variable named A better heuristic would be seeing if bash recognizes a certain command as a builtin, but zsh doesn’t. If so, then it’s bash; if not, it’s zsh, since those are the only supported shells for now. I have a commit to change the sdkman shell detection heuristic to using My queue also contains fixes for types of issues other people have been reporting recently, too. |
Do not fail when parent script has `set -u` option. See * https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html * https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html * http://mywiki.wooledge.org/BashFAQ/112 Fixes sdkman#597
Do not fail when parent script has `set -u` option. See * https://www.gnu.org/software/bash/manual/html_node/The-Set-Builtin.html * https://www.gnu.org/software/bash/manual/html_node/Shell-Parameter-Expansion.html * http://mywiki.wooledge.org/BashFAQ/112 Fixes sdkman#597
Hi!
At my job I am maintaining several shell scripts created to help software developers to be more productive and I was evaluating the use of SDKMAN to save some work. In order to clean up those scripts, I am using set -eu (and other flags that are not relevant at the moment) to be sure that the scripts have all variables it uses and avoid problems with outdated variables being called in some old scripts that might do something unexpected. However, I am facing some difficulties in using sdk commands because they rely on unbound variables. For example:
Now, let us try installing Kotlin:
PS: I am working on this fix, as this commit in my fork https://github.com/andretadeu/sdkman-cli/commit/fd26629e2135c55facc2d31f60f7b9ad64809151 shows. However I need to ensure that the tests are correct. If I don't set set -eu, all the tests passes, however if I do so, I get some errors and some skipped tests, therefore I am not confident about creating a Pull Request.
PS2: If you have time, could you give an explanation on how these tests works?
Thanks in advance,
André Tadeu de Carvalho
The text was updated successfully, but these errors were encountered: