RFR: 8353439: Shell grouping of -XX:OnError= commands is surprising

Kevin Walls kevinw at openjdk.org
Thu Apr 3 08:53:53 UTC 2025


On Thu, 3 Apr 2025 07:53:38 GMT, David Holmes <dholmes at openjdk.org> wrote:

> But if anyone is using this for a sequence of commands that they expect to be in the same shell, they will now be broken.

I haven't worked out an actual example of a dependency... Our sh -c call doesn't seem to accept setting an env var which the next line from OnError an option can use.

It might be the same as:

$ sh -c "FOO=123; echo $FOO"

$ sh -c 'FOO=123; echo $FOO'
123

..where the first must be expanding $FOO at the start, so sees nothing.  We don't want to change anything to try and make that work.

We document the ; separator, but:
-XX:OnError="export FOO=%p; echo $FOO" ...gets separate shells already to they can't depend on each other.

I don't see us actually documenting that you can use multiple -XX:OnError= commands.  It has been mentioned in at least one earlier JBS issue that we can do this, and that they accumulate (possibly your comment).


Creating a file in one command and doing something to it in a second command won't be affected.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/24354#issuecomment-2774934684


More information about the hotspot-dev mailing list