Open JohnLBergqvist opened 2 years ago
Hi @JohnLBergqvist, it seems very odd that you get a permission denied error as the script should always be run as a standard user. Could it be that you have some antivirus software running that prevents bash from moving the files?
As a sidenote, I currently have a fix out on the beta channel that will prevent install and selfupdate scripts from continuing when an error occurred. Would you be able to test that to see if it solves that problem?
@marc0der I don't have any anti-virus software running (It's running on an Azure VM). I'm not sure how easily i'll be able to verify your changes though, as the problem doesn't always occur.
@JohnLBergqvist, the bug that you reported above (script keeps running after error condition) was fixed by this commit and released on 1 April 2022. After this fix, the bug you reported can technically not happen anymore. Have you seen this occur since that date?
As for the permissions issue, this is beyond our control and is specific to your operating system. Please let me know if you experience any further occurrences of the error trapping issue. Otherwise, please feel free to close this bug report.
@marc0der Hi, unfortunately i'm still seeing this "permission deined" bug occur from time to time with SDKMAN 5.15.0
on Windows.
I first run sdk install maven 3.8.6
Installing: maven 3.8.6
mv: cannot move '/c/Windows/ServiceProfiles/NetworkService/.sdkman/tmp/out/apache-maven-3.8.6' to '/c/Windows/ServiceProfiles/NetworkService/.sdkman/candidates/maven/3.8.6': Permission denied
Done installing!
Unfortunately despite the above error, the sdk install
command exits with 0
- which under the circumstances is still a bug - you should detect the file was unable to be moved and at least exit with non-zero here IMO.
If I then do sdk default maven 3.8.6
, I then get this.
ln: failed to create symbolic link '/c/Windows/ServiceProfiles/NetworkService/.sdkman/candidates/maven/current': No such file or directory
Stop! Candidate version is not installed.
If I erase my sdkman
directory and try again, then problem goes away, but you should still not display Done installing!
and exit with 0
if clearly the sdk was not correctly installed.
The vast majority of the time, these all succeed as expected, yet sometimes I get this spurious permissions error.
Bug report When running the sdkman installer, the
mv
command contained in that script, sometimes fails with a Permission Denied error, yet the installer doesn't realise and continues on, seemginly completing successfully, but resulting in a corrupt sdkman installTo reproduce Install on Windows (Git bash) via curl
curl -s "https://get.sdkman.io" | bash
In my case, I had made sure that/c/Windows/ServiceProfiles/NetworkService/.sdkman
was removed before running the above curl command:Essentially, the
bin
&contrib
were moved from the zip's location OK, just not hesrc
directory, which means sourcing the sdk-init.sh script fails:I'm surprised that a permissions error exists, given the install script has literally only just created the directory... Simply re-running the install script was enough to work around the error, but as I'm using sdkman in an unattended/automated environment, this issue randomly appearing is a tad awkard to work-around, especially as the installer was happily exiting with
0
.Could the
mv
command be hardened somewhat to either retry the move, or simply quit, if it's unable to move the full contents of the zip?System info
Microsoft Windows Server 2022 Datacenter Azure Edition, Version 10.0.20348 N/A Build 20348
GNU bash, version 4.4.23(2)-release (x86_64-pc-msys).
sdk version
:SDKMAN 5.15.0