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

Assign runner jar the proper permissions #1169

Merged
merged 1 commit into from
Mar 4, 2019

Conversation

geoand
Copy link
Contributor

@geoand geoand commented Mar 4, 2019

Without this fix I was seeing the following on my path:

ls -l target/

...
drwxrwxr-x  2 gandrian gandrian  4096 Μάρ   4 12:23 lib/
-rw-rw-r--  1 gandrian gandrian 10106 Μάρ   4 12:23 example-1.0.0.Alpha1-SNAPSHOT.jar
-rw-------  1 gandrian gandrian 58209 Μάρ   4 12:23 example-1.0.0.Alpha1-SNAPSHOT-runner.jar
-rw-rw-r--  1 gandrian gandrian 11167 Μάρ   4 12:23 example-1.0.0.Alpha1-SNAPSHOT-sources.jar
...

which makes it harder to include example-1.0.0.Alpha1-SNAPSHOT-runner.jar in a Docker image that extends from fabric8/java-jboss-openjdk8-jdk.

This fix sets read permissions for all users to example-1.0.0.Alpha1-SNAPSHOT-runner.jar.

The one thing I don't know is if the fix will work on Windows (although even if it doesn't it shouldn't change anything)

@geoand geoand changed the title Make runner jar have proper permissions Assign runner jar the proper permissions Mar 4, 2019
Files.setPosixFilePermissions(runnerJar, PosixFilePermissions.fromString("rw-rw-r--"));
} catch (Exception e) {
log.warn("Unable to set proper permissions on " + runnerJar);
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Apparently, there's a good chance you will end with an UnsupportedOperationException on Windows.

Maybe, we should just use the File API? It brings us back in time but at least we will be able to make it work on Windows too.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this fails on Windows, then yes, I'll look into the File API stuff :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Rather than patching the permissions after the fact, wouldn't it be better to create the file with the right permissions upfront?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When debugging I saw that the ZipFileSystem thing creates it with the correct permissions, but when that FS is closed, the permissions were being changed.
So I'm not really sure what's going and I didn't want to do something too intrusive this close to launch.

What you propose is obviously the better solution and I'll check and see if I can find a proper (and non intrusive fix)

Copy link
Contributor Author

@geoand geoand Mar 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I swapped the PosixFilePermissions with a simple setReadable for the time being. I don't change the writable permissions since that would make it writable for all users (due to the terrible File API...). WDYT?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair enough!

Copy link
Contributor Author

@geoand geoand Mar 4, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was just reading Pro Java 7 NIO.2 and although it's obviously possible to get the proper permissions for both Posix and ACL style permissions, I think that it's overkill for this use case. So I propose we leave the PR as it is for the time being :)

Copy link
Member

@gsmet gsmet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's wait for CI and merge.

@gsmet gsmet merged commit b776c29 into quarkusio:master Mar 4, 2019
@gsmet
Copy link
Member

gsmet commented Mar 4, 2019

Merged. Good catch.

@geoand
Copy link
Contributor Author

geoand commented Mar 4, 2019

Awesome, thanks!

@geoand geoand deleted the runner-permissions branch March 4, 2019 13:31
@stuartwdouglas stuartwdouglas added this to the 0.11.0 milestone Mar 6, 2019
maxandersen added a commit to maxandersen/quarkus that referenced this pull request Nov 5, 2022
…1169)

JBang now for known shrinkwrap resolution exception prints
error message that contains custom repo list + cause chain on ouptut
without having to use `--verbose` to see it.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants