On 10/15/2023 1:31 AM, Alexander Kriegisch wrote:
…
Let us settle on only using double quotes to enclose arguments containing 
spaces. Then, we do not need to escape single quotes and can use them 
literally. But we do need to escape nested double quotes.

Let's make sure we don't confuse whether we're talking about escaping occurring at the Bash level, or at the Maven Exec Plugin level. I [made the mistake](https://stackoverflow.com/questions/77294556/bash-single-quote-elements-of-array-and-concatenate-using-space?noredirect=1#comment136265886_77294609) of confusing the two at first.

Just for a moment, forget about Bash/PowerShell/CMD escaping rules. What are escaping the rules of the Maven Exec Plugin? What does it consider a delimiter for indicating multiple arguments? Are you saying that Maven Exec Plugin will accept either single or double quote for delimiter? I'm not saying it doesn't (I haven't seen the code), but I wouldn't want to assume it does, either.

For example, let's assume I use whatever escaping rules are appropriate for my shell, and I do it 100% correctly, so that the Maven Exec Plugin sees `test "foo\" bar" 'more stuff'`. (I'm using the backtick here to delimit the string.) The backslash is not part of the Bash-level escaping—it's literally what the Maven Exec Plugin sees (i.e. I probably escaped it using `\\\"` or something at the Bash level). How does Maven Exec Plugin interpret that string? As one argument? As two? As three?

And where is the Maven Exec Plugin documentation for this? The delimiter rules of the Maven Exec Plugin would be completely independent of the shell escaping rules. (This is the same as if I passed a single quote using `'` from XML; once it got to the Maven Exec Plugin in a Maven property, it would be irrelevant how it was escaped in XML.)

In UNIX-like shells like Bash, a double quote is escaped by a backslash:

   -Dexec.args="one \"it's OK\" three"

OK, so following the discussion above, the Maven Exec Plugin will see the string `one "it's OK" three` (again using a backtick here in this email as a somewhat arbitrary delimiter for the entire string). Bash is now out of the picture. How does the Maven Exec Plugin interpret the string `one "it's OK" three`, and where is that documented?

Garret

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@maven.apache.org
For additional commands, e-mail: users-h...@maven.apache.org

Reply via email to