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

Fix #6476 Use dry run in jetty.sh #6598

Merged
merged 6 commits into from Aug 13, 2021

Conversation

gregw
Copy link
Contributor

@gregw gregw commented Aug 11, 2021

#6476 Use a --dry-run in jetty.sh to pre-expand the java arguments and thus avoid having two JVMs running in the case of exec.

Also made a small change to allow script to check the current directory for JETTY_BASE, as that allows testing and runs in the same style as direct calls to start.jar

Signed-off-by: Greg Wilkins gregw@webtide.com

Use a --dry-run in jetty.sh to pre-expand the java arguments and thus avoid having two JVMs running in the case of exec.

Also made a small change to allow script to check the current directory for JETTY_BASE, as that allows testing and runs in the same style as direct calls to start.jar

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw requested review from sbordet and joakime August 11, 2021 02:44
@gregw gregw changed the title Fix #6597 Use dry run in jetty.sh Fix #6476 Use dry run in jetty.sh Aug 11, 2021
gregw and others added 2 commits August 12, 2021 08:59
Co-authored-by: Simone Bordet <simone.bordet@gmail.com>
update from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw requested a review from sbordet August 11, 2021 23:05
@@ -247,21 +247,24 @@ if [ -z "$JETTY_HOME" ]; then
exit 1
fi

RUN_DIR=$PWD
Copy link
Contributor

Choose a reason for hiding this comment

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

Note that $PWD is a bash feature.
OSX is deprecating bash and moving to zsh.
https://support.apple.com/en-us/HT208050
Basically, Apple is stuck with Bash 3.2 as it's GPLv2, but newer versions of bash are GPLv3.
Apple will not upgrade/ship and/or use anything with GPLv3 license.
They want to get rid of bash entirely simply as their version is very out of date, and have made it clear that it will go away in the future.

Perhaps we should move to RUN_DIR=$(pwd) instead? (it's more compatible)

Copy link
Contributor

Choose a reason for hiding this comment

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

Just to be clear, there is zero urgency on this change.
Feel free to leave it as it is for now.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ack

update from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw requested a review from joakime August 11, 2021 23:26
@@ -430,7 +433,7 @@ case "`uname`" in
CYGWIN*) JETTY_START="`cygpath -w $JETTY_START`";;
esac

RUN_ARGS=(${JAVA_OPTIONS[@]} -jar "$JETTY_START" ${JETTY_ARGS[*]})
RUN_ARGS=$(echo $JAVA_OPTIONS ; "$JAVA" -jar "$JETTY_START" --dry-run=opts,path,main,args ${JETTY_ARGS[*]} | tail -1 )
Copy link
Contributor

@sbordet sbordet Aug 12, 2021

Choose a reason for hiding this comment

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

I don't like the tail -1 as in "why do we take only the last line?" and "surely if there are multiple lines we don't want to take only the last one and discard the previous ones".
I'd rather fail to start if people puts newlines into JAVA_OPTIONS.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We have no control over what JAVA_OPTIONS users set. We have no control over what output those options generate or indeed if the JVM generates any other output.
If fact I think we should do more, something like:

 java --show-version -jar ../jetty-home/start.jar --dry-run=opts,path,main,args __jetty__=__args__ 2>/dev/null | grep __jetty__=__args__ | sed 's/ __jetty__=__args__ / /'

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think this is simpler!

Copy link
Contributor

Choose a reason for hiding this comment

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

We have no control over what JAVA_OPTIONS users set.

That's exactly why we should do exactly nothing to try to format it. We know our --dry-run generates a single line, and if they set JAVA_OPTIONS right, then there is nothing else to do, no tail, no sed, etc.

We don't do tail -1 on the other variables in this file that can be set by users, so why do it here?
Am I missing something?

update from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@gregw gregw requested a review from sbordet August 13, 2021 04:34
update from review

Signed-off-by: Greg Wilkins <gregw@webtide.com>
@sbordet sbordet merged commit 2b0161e into jetty-10.0.x Aug 13, 2021
@sbordet sbordet deleted the jetty-10.0.x-6597-jetty-start-dryrun branch August 13, 2021 15:37
@sbordet sbordet added this to In progress in Jetty 10.0.7/11.0.7 FROZEN via automation Aug 13, 2021
@joakime joakime moved this from In progress to Done in Jetty 10.0.7/11.0.7 FROZEN Sep 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Show message if JVM args are present but new JVM is spawned based on active modules
3 participants