jvm.config and spaces

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

jvm.config and spaces

Romain Manni-Bucau
Hi all,

Is it intended our jvm.config impl does not support spaces?

-Dfoo=bar dummy
"-Dfoo=bar dummy"
'-Dfoo=bar dummy'
-Dfoo=bar\ dummy

All these options don't work - which can be surprising when you are used to
bash.
Fun thing is that if you take of them which should work and append echo
before our final exec and run what is printed it works.

This is mainly due to the fact it uses $MAVEN_OPTS variable in the command
and that bash will split on the space - whatever syntax you use - this way.
Indeed we can't quote the variable since it is not a single one too in
current config.

There are a few options but none are working out of the box:

1. use a string array for jvm.config instead of plain string variable (we
can use lines I guess for that) and then inject "${JVM_CONFIG_OPTS[@]}" in
the exec line - indeed we would default to an empty array
2. Have something specific for system properties like jvm.system.properties
and use the same trick than 1 but without any compat issue - but a new file
as a pitfall
3. Handle the system properties in java - but it is not possible for a few
of them
4. use a custom syntax to detect quoted system properties and extract them
to handle them properly - not sure it is that trivial in bash
4bis. enable to add dropped lines in jvm.config to mark sections:

per_line #will be dropped
-Dfoo=with spaces
-Dfoo2=with spaces too
inline #current impl
-Da=1 -Db=2

5. now we have graalvm and it works quite reliably we can have a small
binary in the distro we build from a new maven-prestart module - and this
module would replace the bash/batch script by doing it in plain java.
Drawback there is the size of the distro will take something around 30M
just for that.
6. same than 5 but in plain java - I fear the ~120ms of latency java
commonly has will kill this option

Any workaround I missed - without patching my maven script locally since it
is a config I want to share on CI and other dev computer?
Any solution I proposed which is tempting or any other solution?

Side note: for the full story I just wanted to set:
-Djava.util.logging.SimpleFormatter.format=[%4$s] %5$s%6$s%n


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>
Reply | Threaded
Open this post in threaded view
|

Re: jvm.config and spaces

Romain Manni-Bucau
+1 to do something close to IBM script or have a graalvm light launcher (if
we manage to make it < 10M but I doubt :().

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le lun. 1 févr. 2021 à 11:47, Benjamin Marwell <[hidden email]> a
écrit :

> Eval is probably needed,
> just look at how open liberty merges those lines [1].
>
> As a user, I would expect spaces and comments to be supported.
>
> [1]:
> https://github.com/OpenLiberty/open-liberty/blob/bd54569d3322c4321a7dda4fcf94d65f85bf13bf/dev/com.ibm.ws.kernel.boot.ws-server/publish/bin/server#L695-L716
> EPLv1
> <https://github.com/OpenLiberty/open-liberty/blob/bd54569d3322c4321a7dda4fcf94d65f85bf13bf/dev/com.ibm.ws.kernel.boot.ws-server/publish/bin/server#L695-L716EPLv1>
> licensed
>
> Am Mo., 1. Feb. 2021 um 11:42 Uhr schrieb Michael Osipov <
> [hidden email]>:
> >
> > Am 2021-01-29 um 21:51 schrieb Romain Manni-Bucau:
> > > Hi all,
> > >
> > > Is it intended our jvm.config impl does not support spaces?
> > >
> > > -Dfoo=bar dummy
> > > "-Dfoo=bar dummy"
> > > '-Dfoo=bar dummy'
> > > -Dfoo=bar\ dummy
> >
> > Likely related to https://issues.apache.org/jira/browse/MNG-4559.
> > I see no way to solve this with POSIX shell or I am too stupid. One
> > either needs a bash/zsh based script, or a C-based launcher.
> >
> > M
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>
Reply | Threaded
Open this post in threaded view
|

Re: jvm.config and spaces

Romain Manni-Bucau
In reply to this post by Romain Manni-Bucau
Why? This is not about changing IFS for maven opts but for jvm.config read
then all the script still uses the default. It is very close to just
writing the jvm.config parsing instead of just handling it with a pipe
bypassing needed escaping, no?

Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<https://rmannibucau.metawerx.net/> | Old Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Book
<https://www.packtpub.com/application-development/java-ee-8-high-performance>


Le lun. 1 févr. 2021 à 11:59, Michael Osipov <[hidden email]> a écrit :

> Am 2021-02-01 um 11:47 schrieb Benjamin Marwell:
> > Eval is probably needed,
> > just look at how open liberty merges those lines [1].
> >
> > As a user, I would expect spaces and comments to be supported.
> >
> > [1]:
> https://github.com/OpenLiberty/open-liberty/blob/bd54569d3322c4321a7dda4fcf94d65f85bf13bf/dev/com.ibm.ws.kernel.boot.ws-server/publish/bin/server#L695-L716
> > EPLv1 licensed
>
> I'd be happy if someone could this picked up. This operates on changing
> IFS. For MAVEN_OPTS this will not work, sadly.
>
> > Am Mo., 1. Feb. 2021 um 11:42 Uhr schrieb Michael Osipov <
> [hidden email]>:
> >>
> >> Am 2021-01-29 um 21:51 schrieb Romain Manni-Bucau:
> >>> Hi all,
> >>>
> >>> Is it intended our jvm.config impl does not support spaces?
> >>>
> >>> -Dfoo=bar dummy
> >>> "-Dfoo=bar dummy"
> >>> '-Dfoo=bar dummy'
> >>> -Dfoo=bar\ dummy
> >>
> >> Likely related to https://issues.apache.org/jira/browse/MNG-4559.
> >> I see no way to solve this with POSIX shell or I am too stupid. One
> >> either needs a bash/zsh based script, or a C-based launcher.
> >>
> >> M
> >>
> >> ---------------------------------------------------------------------
> >> To unsubscribe, e-mail: [hidden email]
> >> For additional commands, e-mail: [hidden email]
> >>
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: [hidden email]
> > For additional commands, e-mail: [hidden email]
> >
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [hidden email]
> For additional commands, e-mail: [hidden email]
>
>