[ 
https://issues.apache.org/jira/browse/EXEC-93?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14933662#comment-14933662
 ] 

Sebb commented on EXEC-93:
--------------------------

The example test applies to Unix shells.
It may not apply to other OSes or to other Unix applications which may have 
different quoting requirements.
Indeed different Unix shells have different quoting requirements.

It's very difficult - if not impossible - to write quoting code that works for 
all situations in Unix, let alone all OSes.

The existing code is specifically designed for arguments that may contain 
spaces or quotes.
As such it is a compromise because it does not work on all OSes.
The patch breaks the behaviour as it always adds quotes, even if they are not 
needed.
I don't think this code should be committed.

It's also not clear whether this code is even needed.

I don't think Commons Exec should be trying to parse shell syntax, which is 
what this patch seems to be aimed at.

The example given could easily be implemented using the environment map; there 
is no need to quote parameters when they are passed as values of environment 
variables.

> Handling of escaped values by StringUtils
> -----------------------------------------
>
>                 Key: EXEC-93
>                 URL: https://issues.apache.org/jira/browse/EXEC-93
>             Project: Commons Exec
>          Issue Type: Bug
>    Affects Versions: 1.3, 1.4
>            Reporter: Viktor Sadovnikov
>             Fix For: 1.4
>
>         Attachments: EXEC-93.patch
>
>
> An arguments can contain an environment variable value. For example, in 
> command {{cd /tmp && STORAGE_DIR=/tmp resolve.sh}} {{STORAGE_DIR=/tmp}} is an 
> argument, which is used by {{resolve.sh}}.
> However values of the variables can be more complicated and can contain 
> escaped quotes. Current implementation of 
> {{StringUtils#quoteArgument(String)}} does not handle these values correctly. 
> Attached patch contains fix for this problem and unit tests to demonstrate 
> the problem and the fix



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to