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

Fix rm asking to remove file on some zsh #851

Merged
merged 2 commits into from
Feb 3, 2021
Merged

Fix rm asking to remove file on some zsh #851

merged 2 commits into from
Feb 3, 2021

Conversation

felipecrs
Copy link
Contributor

I'm trying to fix the following:

sdk install java
==== BROADCAST =================================================================
* 2021-01-07: mvnd 0.3.0 available on SDKMAN! https://git.io/JLxCq
* 2021-01-06: micronaut 2.2.3 available on SDKMAN!
* 2021-01-04: gradle 6.8-rc-5 available on SDKMAN!
================================================================================

Downloading: java 11.0.9.hs-adpt

In progress...

################################################################################################################################ 100.0%################################################################################################################################ 100.0%

Repackaging Java 11.0.9.hs-adpt...

Done repackaging...
rm: remove regular file '/home/vscode/.sdkman/tmp/java-11.0.9.hs-adpt.bin'? y

Installing: java 11.0.9.hs-adpt
Done installing!


Setting java 11.0.9.hs-adpt as default.

But I think this might actually be part of the package hook script rather than the sdk cli. Anyway, I believe adding -f to the rm is always good to prevent such thing.

@marc0der
Copy link
Member

marc0der commented Jan 7, 2021

What you are seeing here is the effect of a hook served by the sdkman-hooks service. Please feel free to check that out and raise a PR there.

It would be super helpful to know why it is failing in the first place. Could you please provide your system details, like OS, shell version, and any zsh framework that you are using? My suspicion is that you are using a zsh framework that is messing with the default zsh settings, as an rm without -f should never be blocked from deleting something under normal condidtions.

@felipecrs
Copy link
Contributor Author

felipecrs commented Jan 7, 2021

command -v rm
alias rm='rm -i'

It's not set in my dotfiles, so it must come from some of the extensions, such as OhMyZsh. But it does not matter, the thing is: always use rm -f in scripts to make sure it will work for everyone.

@felipecrs
Copy link
Contributor Author

felipecrs commented Jan 7, 2021

@smola
Copy link

smola commented Feb 3, 2021

This is also a common alias in bash. Amazon Linux 2 comes with it by default for the root user.

@marc0der marc0der merged commit 7f177bc into sdkman:master Feb 3, 2021
@marc0der
Copy link
Member

marc0der commented Feb 3, 2021

@felipecrs thanks for contributing!

@felipecrs felipecrs deleted the fix-rm branch February 3, 2021 22:58
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.

None yet

3 participants