Sdkman-cli: lchmod errors on installing Java

Created on 20 Aug 2020  路  9Comments  路  Source: sdkman/sdkman-cli

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

All 9 comments

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?

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.

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

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?

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.

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.

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.

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.

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

EarthCitizen picture EarthCitizen  路  3Comments

dayja78 picture dayja78  路  6Comments

hho picture hho  路  4Comments

edmondo1984 picture edmondo1984  路  6Comments

simonjhy picture simonjhy  路  7Comments