-
Notifications
You must be signed in to change notification settings - Fork 791
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
fix: Better handling with paths that include spaces #1485
Conversation
b0ca66c
to
9415a81
Compare
9415a81
to
2216154
Compare
The changes I requested seemed to have introduced a bunch of shellcheck issues we would need to ignore. Are you able to resolve them @hyperupcall ? |
This reverts commit 2216154.
I wish I mentioned this earlier, but the reason why the Bats test fails is because the newer changes moves the |
I reverted those changes, and the My first thought would be to move the invocation of I also tried re-calling |
It is a shame we cannot opt-out of using the setup for a single test in the file. The most clean alternative I can think of is having a separate test file for these specific tests. If someone thinks of something better, we can discuss then, in the meantime we will merge this. |
local is_nullglob_disabled= | ||
shopt -q nullglob || is_nullglob_disabled=yes | ||
shopt -s nullglob | ||
for f in "$(asdf_data_dir)"/shims/*; do | ||
if grep -q "asdf-plugin: ${plugin_name}" "$f"; then | ||
rm -f "$f" | ||
fi | ||
done | ||
[ "$is_nullglob_disabled" = 'yes' ] && shopt -u nullglob | ||
unset -v is_nullglob_disabled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there really not a better way of doing this? This seems like quite a bit of code just to find and delete shims containing a certain line.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was, https://github.com/hyperupcall/asdf/blob/82b9ef01e26f39b375c1b462979aa7ffd069df8a/lib/commands/command-plugin-remove.bash#L24 but it didn't work on Alpine.
I suppose I could have replaced the nullglob stuff with a [ -f "$f" ]
in the loop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I'd prefer [ -f "$f" ]
in the loop as it feels harder to get wrong - it's easy for someone to forget to unset an option or reset it to the wrong value. In this case it looks correct so not an issue.
Summary
I saw that there was a
ASDF_BATS_SPACE_IN_PATH
variable, which seemed to be part of a gradual transition to make the tests work better with whitespace stuff. Probably with help from #1433, it was somewhat trivial to make the proper fixes and remove this variable entirely.One test was left out because it seems that change requires a fix in the
.tool-versions
parser (related to thepath:~/src/elixir
feature)