From mail at dries.net Wed Aug 13 17:59:48 2025 From: mail at dries.net (Dries Samyn) Date: Wed, 13 Aug 2025 18:59:48 +0100 Subject: Bug in -jvmArgs parsing? Message-ID: I'm not sure this is considered a bug as it matches the documented behaviour, but I can't think of a clean workaround if it is. I believe arguments passed into the -jvmArgs option are space delimited. However, this is problematic when those arguments include spaces as part of the value. For example, I am trying to create a custom profiler for YourKit integration, but the YourKit agent, by default, has spaces in its path on MacOs, which means trying to pass it in the jvmArgs option is problematic. I have created a reproduction of the issue and explanation here: https://github.com/driessamyn/jmh-spaces-bug-reproduction Looking forward to hearing thoughts on this. Dries. -------------- next part -------------- An HTML attachment was scrubbed... URL: From kirk.pepperdine at gmail.com Thu Aug 14 07:08:33 2025 From: kirk.pepperdine at gmail.com (Kirk Pepperdine) Date: Thu, 14 Aug 2025 09:08:33 +0200 Subject: Bug in -jvmArgs parsing? In-Reply-To: References: Message-ID: Hi Dries, Have you tried escaping the spaces to that the shell doesn?t split the value? Kind regards, Kirk > On Aug 13, 2025, at 7:59?PM, Dries Samyn wrote: > > I'm not sure this is considered a bug as it matches the documented behaviour, but I can't think of a clean workaround if it is. > > I believe arguments passed into the -jvmArgs option are space delimited. However, this is problematic when those arguments include spaces as part of the value. > For example, I am trying to create a custom profiler for YourKit integration, but the YourKit agent, by default, has spaces in its path on MacOs, which means trying to pass it in the jvmArgs option is problematic. > > I have created a reproduction of the issue and explanation here: https://github.com/driessamyn/jmh-spaces-bug-reproduction > > Looking forward to hearing thoughts on this. > > Dries. > -------------- next part -------------- An HTML attachment was scrubbed... URL: -------------- next part -------------- A non-text attachment was scrubbed... Name: smime.p7s Type: application/pkcs7-signature Size: 1515 bytes Desc: not available URL: From mail at dries.net Fri Aug 15 06:31:24 2025 From: mail at dries.net (Dries Samyn) Date: Fri, 15 Aug 2025 07:31:24 +0100 Subject: Bug in -jvmArgs parsing? Message-ID: Hi Kirk, I don't think it is the shell that is splitting the value as the jvmArgs is quoted, I think it is when the argument is parsed. I tried \ escaping the spaces as well. java -jar build/libs/jmh-spaces-bug-reproduction-jmh.jar \ -jvmArgs "-javaagent:/tmp/agent with spaces/dummy.jar" java -jar build/libs/jmh-spaces-bug-reproduction-jmh.jar \ -jvmArgs "-javaagent:/tmp/agent\ with\ spaces/dummy.jar" I can see the the description of the flag suggest it is a space space-separated line, which makes me think this is intended behaviour, however, I cannot understand how a value containing spaces can then be used: -jvmArgs Use given JVM arguments. Most options are inherited from the host VM options, but in some cases you want to pass the options only to a forked VM. Either single space-separated option line, or multiple options are accepted. This option only affects forked runs. Dires. On Thu, 14 Aug 2025, 8:08?am Kirk Pepperdine, wrote: > Hi Dries, > > Have you tried escaping the spaces to that the shell doesn?t split the > value? > > Kind regards, > Kirk > > > On Aug 13, 2025, at 7:59?PM, Dries Samyn wrote: > > I'm not sure this is considered a bug as it matches the documented > behaviour, but I can't think of a clean workaround if it is. > > I believe arguments passed into the -jvmArgs option are space delimited. > However, this is problematic when those arguments include spaces as part of > the value. > For example, I am trying to create a custom profiler for YourKit > integration, but the YourKit agent, by default, has spaces in its path on > MacOs, which means trying to pass it in the jvmArgs option is problematic. > > I have created a reproduction of the issue and explanation here: > https://github.com/driessamyn/jmh-spaces-bug-reproduction > > Looking forward to hearing thoughts on this. > > Dries. > > > -------------- next part -------------- An HTML attachment was scrubbed... URL: