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

Unable to install from Dockerfile / alpine based #104

Open
nvuillam opened this issue Jan 7, 2024 · 9 comments
Open

Unable to install from Dockerfile / alpine based #104

nvuillam opened this issue Jan 7, 2024 · 9 comments
Labels

Comments

@nvuillam
Copy link

nvuillam commented Jan 7, 2024

Dockerfile instructions:

          RUN curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/greglook/cljstyle/main/util/install-cljstyle \
              && chmod +x install-cljstyle \
              && ./install-cljstyle

Log:

5.842 Downloading https://github.com/greglook/cljstyle/releases/download/0.15.0/cljstyle_0.15.0_linux_x86_64.zip to /tmp
6.078 Archive:  cljstyle_0.15.0_linux_x86_64.zip
6.079 unzip: short read

And as https://github.com/greglook/cljstyle/releases/download/0.15.0/cljstyle_0.15.0_linux_x86_64.zip returns a 404 is makes sense :/

Issue visible here: https://github.com/oxsecurity/megalinter/actions/runs/7439147778/job/20238690106?pr=3268#step:8:304

@greglook
Copy link
Owner

greglook commented Jan 7, 2024

I think you caught me between pushing the new code to the main branch and actually cutting the release. 😅 The new artifacts are platform-specific, since I have an M2 mac to build on now.

As to the build failure, it seems that some of the reorganization I did broke that step - I moved script/install-cljstyle to util/. I had been thinking about the install script as mostly a tool for humans, but it makes sense that folks would go to it as a one-step installer in containers as well. 🤔

@nvuillam
Copy link
Author

nvuillam commented Jan 7, 2024

@greglook thanks for the reply :)

Any chance to have a fix someday ? 👼

cljstyle has been integrated within MegaLinter and I'm pretty sure that @practicalli-johnny would be sad if next MegaLinter version would be without cljstyle ;)

@greglook
Copy link
Owner

greglook commented Jan 8, 2024

Any chance to have a fix someday ? 👼

Can you try with the latest install script on main?

@greglook greglook added the bug label Jan 8, 2024
@nvuillam
Copy link
Author

nvuillam commented Apr 27, 2024

@greglook I still have the issue :( -> https://github.com/oxsecurity/megalinter/actions/runs/8862094296/job/24334661450?pr=3516

Setup log:

#12 2.300 Downloading https://github.com/greglook/cljstyle/releases/download/0.16.626/cljstyle_0.16.626_linux_amd64.zip to /tmp
#12 2.522 Archive:  cljstyle_0.16.626_linux_amd64.zip
#12 2.974   inflating: cljstyle
#12 2.979 Successfully installed cljstyle 0.16.626 in /usr/local/bin
#12 DONE 3.0s

cljstyle seems to always return -11 as status code

[cljstyle] command: ['cljstyle', 'check', 'clojure_bad_1.clj']
[cljstyle] CWD: /tmp/ab00bfe7-4299-4279-9444-daed54eb8052
[cljstyle] result: -11 
[cljstyle] command: ['cljstyle', 'check', 'clojure_bad_2.clj']
[cljstyle] CWD: /tmp/ab00bfe7-4299-4279-9444-daed54eb8052
[cljstyle] result: -11 
Linter version command: ['/usr/local/bin/cljstyle', 'version']
Linter version result: -11 
Unable to get version for lin

@greglook
Copy link
Owner

greglook commented Dec 9, 2024

Still not sure why you'd get a segfault, but try with the latest release 0.17.642 - it's built to be compatible with more architectures, which might affect this.

@nvuillam
Copy link
Author

nvuillam commented Dec 9, 2024

@greglook sorry, still crashing :/

#17 3.926   inflating: cljstyle
#17 3.931 Successfully installed cljstyle 0.17.642 in /usr/local/bin
Linter version command: ['/usr/local/bin/cljstyle', 'version']
Linter version result: -11 

You can see the full log here -> https://github.com/oxsecurity/megalinter/actions/runs/12245971753/job/34160970501?pr=4369

@greglook
Copy link
Owner

Huh, curious. I tried a minimal reproduction in a basic alpine:latest container, and this is what I got:

% docker run --rm -it --platform linux/x86_64 alpine:latest
/ # apk add bash curl
...
/ # exec bash

eac452fc3c2f:/# cd /tmp

eac452fc3c2f:/tmp# curl --retry 5 --retry-delay 5 -sLO https://raw.githubusercontent.com/greglook/cljstyle/main/util/install-cljstyle

eac452fc3c2f:/tmp# chmod +x install-cljstyle

eac452fc3c2f:/tmp# ./install-cljstyle
Downloading https://github.com/greglook/cljstyle/releases/download/0.17.642/cljstyle_0.17.642_linux_amd64.zip to /tmp
Archive:  cljstyle_0.17.642_linux_amd64.zip
  inflating: cljstyle
Successfully installed cljstyle 0.17.642 in /usr/local/bin

eac452fc3c2f:/tmp# cljstyle version
rosetta error: failed to open elf at /lib64/ld-linux-x86-64.so.2
 Trace/breakpoint trap

I'm not sure what to make of that, but it seems like in the alpine image the libraries that cljstyle links against aren't found or aren't valid somehow? Notably, there is no /lib64/ directory in this container.

On the other hand, the statically-compiled binary seems to work okay, so that might be an option:

eac452fc3c2f:/tmp# curl -sLO https://github.com/greglook/cljstyle/releases/download/0.17.642/cljstyle_0.17.642_linux_amd64_static.zip

eac452fc3c2f:/tmp# unzip cljstyle_0.17.642_linux_amd64_static.zip 
Archive:  cljstyle_0.17.642_linux_amd64_static.zip
  inflating: cljstyle

eac452fc3c2f:/tmp# ./cljstyle version
mvxcvi/cljstyle 0.17.642 (built from 63a4cf472cd58261683268076819d90cd0334b3d on 2024-12-09)

eac452fc3c2f:/tmp# echo -e "( defn f\n[x y]\n     ( + x y    )\n)\n" | ./cljstyle pipe
(defn f
  [x y]
  (+ x y))

The installer doesn't currently have an option for picking the static binary, but that could be added.

@nvuillam
Copy link
Author

The installer doesn't currently have an option for picking the static binary, but that could be added.

I would love that @greglook , many thanks if you can do it :)

@greglook
Copy link
Owner

Try with the new --static option on the installer when you get a chance.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants