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

Escaped inner class to avoid shell interpolation #2435

Closed
wants to merge 2 commits into from

Conversation

idiotwithalaptop
Copy link

Fixes the issue described at #2414

@gsmet
Copy link
Member

gsmet commented May 14, 2019

Looks like it's not as simple as it seemed: we have the following error on our CI:

Error: policy 'com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime' does not exist. It must be a fully qualified class name.
com.oracle.svm.core.util.UserError$UserException: policy 'com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime' does not exist. It must be a fully qualified class name.

@idiotwithalaptop
Copy link
Author

Hmm, this is odd. I've tried running the exact same command in the test docker run -v /home/vsts/work/1/s/integration-tests/hibernate-validator/target:/project:z --rm --user 1001:117 quay.io/quarkus/centos-quarkus-native-image:graalvm-1.0.0-rc16 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -H:InitialCollectionPolicy="com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime" -jar quarkus-integration-test-hibernate-validator-999-SNAPSHOT-runner.jar -J-Djava.util.concurrent.ForkJoinPool.common.parallelism=1 -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:+PrintAnalysisCallTree -J-Xmx6g -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-SpawnIsolates -H:-JNI --no-server -H:-UseServiceLoaderFeature -H:+StackTrace locally and didn't get the same issue. This difference might have something to do with being a different host OS, so will have to look at a cross-platform alternative.

@gsmet
Copy link
Member

gsmet commented May 15, 2019

I think what the error message states is that we still have the single quotes when trying to find the class. Thus the issue.

I wonder if the whole option should be quoted instead. Could you try that?

Copy link
Member

@dmlloyd dmlloyd left a comment

Choose a reason for hiding this comment

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

Shell escaping is not correct.

@@ -407,7 +407,7 @@ public void provideOutcome(AppCreator ctx) throws AppCreatorException {
if (additionalBuildArgs != null) {
command.addAll(additionalBuildArgs);
}
command.add("-H:InitialCollectionPolicy='com.oracle.svm.core.genscavenge.CollectionPolicy$BySpaceAndTime'"); //the default collection policy results in full GC's 50% of the time
command.add("-H:InitialCollectionPolicy=\"com.oracle.svm.core.genscavenge.CollectionPolicy\\$BySpaceAndTime\""); //the default collection policy results in full GC's 50% of the time
Copy link
Member

Choose a reason for hiding this comment

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

This is not necessary. These arguments are used by ProcessBuilder which does not use a shell to execute commands.

Copy link
Member

Choose a reason for hiding this comment

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

Since the problem is related to Docker, maybe there should be a second escaping pass when docker is used?

@dmlloyd
Copy link
Member

dmlloyd commented May 15, 2019

This approach is never going to work because process builder is not a shell mechanism, it's an OS mechanism. The OS is always going to send the program and arguments in to the destination process with no interpolation. The problem here is that Docker is apparently performing a round of interpolation on its arguments - which is bad and incorrect, but maybe there's nothing we can do about it. So we will need to quote things but only if Docker is in use and only the arguments that actually are passed in to Docker.

@FroMage
Copy link
Member

FroMage commented Jun 19, 2019

OK, we need to ask our docker expert @cescoffier to participate.

@FroMage FroMage requested a review from cescoffier June 19, 2019 08:45
@dmlloyd
Copy link
Member

dmlloyd commented Sep 20, 2019

This PR hasn't been updated since May or so, can it be closed?

@machi1990
Copy link
Member

@idiotwithalaptop hi, what's the status of this PR? I am seeing that it has not been updated since May, do you plan to continue working on this issue?

@cescoffier
Copy link
Member

Closing due to inactivity.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage/invalid This doesn't seem right
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants