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

Fails on ktlint with shell script header #2

Open
jayvdb opened this issue Apr 11, 2022 · 2 comments · Fixed by CubikTech/warp4j#1 · May be fixed by #3
Open

Fails on ktlint with shell script header #2

jayvdb opened this issue Apr 11, 2022 · 2 comments · Fixed by CubikTech/warp4j#1 · May be fixed by #3

Comments

@jayvdb
Copy link

jayvdb commented Apr 11, 2022

Processing https://github.com/pinterest/ktlint/releases/download/0.45.2/ktlint fails because it has a shell script before the zip file.

$ mv ktlint ktlint.jar
$ warp4j ktlint.jar
Error: File "ktlint.jar" is not a java archive
@jayvdb
Copy link
Author

jayvdb commented Apr 25, 2022

The reason is warp4j uses file, and expects the output to contain either "Java" or "Zip", and it doesnt do that for these files.

% file /tmp/ktlint
/tmp/ktlint: POSIX shell script executable (binary data)
% /usr/local/Cellar/file-formula/5.41/bin/file /tmp/ktlint
/tmp/ktlint: POSIX shell script executable (binary data)

Searching for "jar" in https://bugs.astron.com/view_all_bug_page.php reveals nothing of interest, so I created https://bugs.astron.com/view.php?id=342 about this issue. Probably still want a local workaround.

There is already a check if the extension is ".jar", but it is only used if file mentions "Zip" or "Java". Perhaps the file check can be loosened to also include "POSIX shell script executable (binary data)", which hints that it is more than a normal shell script. e.g. on my macos brew collection, only one (1) of 245 scripts in /usr/local/bin/ gets flagged as (binary data).

% file /usr/local/bin/* | grep POSIX | wc -l
     245
% file /usr/local/bin/* | grep POSIX | grep binary
/usr/local/bin/rcs2log:                             POSIX shell script executable (binary data)

@jayvdb
Copy link
Author

jayvdb commented Apr 25, 2022

Once that is bypassed, I can get a working warped ktlint with warp4j --macos --java-version 15 --no-optimize ktlint.jar

jayvdb added a commit to jayvdb/warp4j that referenced this issue Apr 25, 2022
jayvdb added a commit to jayvdb/warp4j that referenced this issue Apr 25, 2022
@jayvdb jayvdb linked a pull request Apr 25, 2022 that will close this issue
Cubik65536 added a commit to CubikTech/warp4j that referenced this issue Jan 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant