sdkman / sdkman-cli

The SDKMAN! Command Line Interface
https://sdkman.io
Apache License 2.0
6.12k stars 630 forks source link

lchmod errors on installing Java #790

Closed felipecrs closed 4 years ago

felipecrs commented 4 years ago

Bug report

When I install any version of Java, I often receive some weird lchmod errors. See:

asciicast

To reproduce

sdk i java

System info Ubuntu 20.04 on WSL2 Running bash OR zsh Latest version of sdk

marc0der commented 4 years ago

Hi @felipecrs, thanks for reporting this.

I have never seen this before, so my guess would be that it is something to do with your environment. I personally use zsh (with oh-my-zsh) on my Linux machine every day and have never seen this happening.

Could you give me some more details about your shell setup? It seems like you are using some framework on top of bash/zsh for fancy prompts and autocomplete. Could this be causing the issue? Could you try disabling this to see if the problem goes away?

felipecrs commented 4 years ago

It happens not only on ZSH but also on Bash, so this should not be the problem. Also happens on my CI:

https://github.com/felipecrs/dotfiles/runs/1007704929?check_suite_focus=true#step:3:282

I'll try to set up a clean environment to check.

felipecrs commented 4 years ago

I tried in a fresh install of Ubuntu 20.04 on WSL and the error didn't appear indeed.

I tried to fully remove SDKMAN! from my current WSL and the problem remains.

I'll try to make more tests, but if you want to see what my dotfiles have, it's open-source: felipecrs/dotfiles

marc0der commented 4 years ago

I just came across this on reddit: https://www.reddit.com/r/linuxquestions/comments/30yy4g/error_when_unzipping/

It seems to be related to the zip command being compiled with some incorrect flags. Could this be what you are experiencing too?

felipecrs commented 4 years ago

It makes sense, look:

felipesantos@ICCSO-035976-NB:/mnt/c/Users/felipesantos$ which unzip
/home/linuxbrew/.linuxbrew/bin/unzip

This should be the issue, for some reason, Homebrew installs unzip and it takes precedence over the system one because of my .profile.

marc0der commented 4 years ago

That could be it yes. The asciinema cast you posted was actually using the cached archive (found a previously downloaded archive...) and unzipping that, so you are absolutely right, this would be the unzip command emitting errors.

felipecrs commented 4 years ago

I opened an Issue in Homebrew. By the way, do you know how can I download a Java archive which SDKMAN uses without having to use sdkman for that? I want to make it easier for people to reproduce since I could not reproduce using other .zip files.

marc0der commented 4 years ago

TLDR: no, unfortunately this isn't possible.

Here's the tricky part: the JDKs were added to SDKMAN as an afterthought. We initially served only zip archives, which we then cached and extracted in place. Since introducing JDKs (always distributed as tar.gz), I first normalise them by extracting them, repacking them as zip, then caching them in the archives directory. This then gets extracted in place under the candidates folder. It is a few steps extra, but this does give us reuse of all the existing SDKMAN code.

felipecrs commented 4 years ago

Got it, thank you very much. I'm going to close this issue since the problem comes from elsewhere.

ianzone commented 2 months ago

Hi, I also met this issue, is there a workaround or can I just ignore the error msg?