commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Joerg Schaible (JIRA)" <j...@apache.org>
Subject [jira] Issue Comment Edited: (EXEC-39) StringUtils quoting problems
Date Thu, 16 Sep 2010 08:31:33 GMT

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

Joerg Schaible edited comment on EXEC-39 at 9/16/10 4:30 AM:
-------------------------------------------------------------

Those are not all. There are more characters that have to be escaped. This is typically to
be seen if you have one of those in a file name and use tab completion (e.g. comma is not
in listed the linked documentation):

 $ ls Music/Auffret\,\ Anne\ \&\ Baron\,\ Florian/Setu\ \!/

same as

 $ ls 'Music/Auffret, Anne & Baron, Florian/Setu !/'

The single quote is also escaped:

 $ ls Music/Soundtrack/Le\ fabuleux\ destin\ d\'Amélie\ Poulain/

For quoting an argument containing a single quote I am not sure, but this works:

 $ ls 'Music/Soundtrack/Le\ fabuleux\ destin\ d'\''Amélie\ Poulain/'

{noformat}Also note, that "*" is not the same as '\*' on Unix and on top it depends on the
intention of the caller which version to use. In the first case the shell will expand the
wildcard. In the second case the application must know itself what to do with it - if it should
be handled as a wildcard at all.{noformat}

Fortunately non-ASCII characters (on an UTF-8 system) do not have to be handled in special:

 $ ls Music/Soundtrack/Πολίτικη\ κουζίνα/



      was (Author: joehni):
    Those are not all. There are more characters that have to be escaped. This is typically
to be seen if you have one of those in a file name and use tab completion (e.g. comma is not
in listed the linked documentation):

 $ ls Music/Auffret\,\ Anne\ \&\ Baron\,\ Florian/Setu\ \!/

same as

 $ ls 'Music/Auffret, Anne & Baron, Florian/Setu !/'

The single quote is also escaped:

 $ ls Music/Soundtrack/Le\ fabuleux\ destin\ d\'Amélie\ Poulain/

For quoting an argument containing a single quote I am not sure, but this works:

 $ ls 'Music/Soundtrack/Le\ fabuleux\ destin\ d'\''Amélie\ Poulain/'

Also note, that "*" is not the same as '*' on Unix and on top it depends on the intention
of the caller which version to use. In the first case the shell will expand the wildcard.
In the second case the application must know itself what to do with it - if it should be handled
as a wildcard at all.

Fortunately non-ASCII characters (on an UTF-8 system) do not have to be handled in special:

 $ ls Music/Soundtrack/Πολίτικη\ κουζίνα/


  
> StringUtils quoting problems
> ----------------------------
>
>                 Key: EXEC-39
>                 URL: https://issues.apache.org/jira/browse/EXEC-39
>             Project: Commons Exec
>          Issue Type: Bug
>    Affects Versions: 1.0
>            Reporter: Sebb
>            Assignee: Siegfried Goeschl
>             Fix For: 1.1
>
>
> There are various problems in the StringUtils class:
> isQuoted() - does not check that arguments have the same opening and closing quotes.
This may be a rare case, but it's trivial to fix. There are no test cases for the method.
> quoteArgument()
>  - does not work properly on Windows, which only treats double-quote as a quoting character;
it should not fail if a Windows argument contains single-quotes, as they are not special.
> - does not quote special Unix characters either
> stringSubstitution() does not document what the characters can constitute a key.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


Mime
View raw message