You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Sebb (JIRA)" <ji...@apache.org> on 2009/04/26 17:59:31 UTC
[jira] Created: (EXEC-39) StringUtils quoting problems
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
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.
[jira] Issue Comment Edited: (EXEC-39) StringUtils quoting problems
Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
[ 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.
[jira] Updated: (EXEC-39) StringUtils quoting problems
Posted by "Siegfried Goeschl (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Siegfried Goeschl updated EXEC-39:
----------------------------------
Fix Version/s: 1.1
> 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.
[jira] Commented: (EXEC-39) StringUtils quoting problems
Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910113#action_12910113 ]
Joerg Schaible commented on EXEC-39:
------------------------------------
No, you cannot escape in Unix within single quotes. This does not work:
$ ls 'Music/Soundtrack/Le fabuleux destin d\'Amélie Poulain/'
> 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.
[jira] Commented: (EXEC-39) StringUtils quoting problems
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910141#action_12910141 ]
Sebb commented on EXEC-39:
--------------------------
Oops! You're right.
However, as you wrote earlier, you can replace embedded single-quotes with single-quote backslash single-quote single-quote.
I.e, close the quoted string, add an escaped single-quote, then re-open the quoted string.
[It's all but impossible to distinguish '' (single-quote*2) from " (double-quote) visually !]
> 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.
[jira] Issue Comment Edited: (EXEC-39) StringUtils quoting problems
Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
[ 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:32 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/'
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/Πολίτικη\ κουζίνα/
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/'
{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/Πολίτικη\ κουζίνα/
> 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.
[jira] Commented: (EXEC-39) StringUtils quoting problems
Posted by "Siegfried Goeschl (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910502#action_12910502 ]
Siegfried Goeschl commented on EXEC-39:
---------------------------------------
Some thoughts along the line
+) What type of quoting is done/required when you invoke a shell script (bash, ksh) versus an application?!
+) There are so many different scenarios and they are hard to test across multiple platforms
+) Looking at the comments I have the feeling that it is easy to break existing behavior used in real-life
That's the reason why I added "pre-quoted" arguments to avoid doing anything harmful and recommend building the command line incrementally instead or parsing a command line string. So I Iean towards "won't fix" otherwise I'm getting no release out of the door - any comments?
> 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.
[jira] Commented: (EXEC-39) StringUtils quoting problems
Posted by "Siegfried Goeschl (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909837#action_12909837 ]
Siegfried Goeschl commented on EXEC-39:
---------------------------------------
+) fixed the isQuoted() issue
+) what are "special Unix characters"?!
> 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.
[jira] Resolved: (EXEC-39) StringUtils quoting problems
Posted by "Siegfried Goeschl (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Siegfried Goeschl resolved EXEC-39.
-----------------------------------
Resolution: Won't Fix
Will reopen the issues when we got more user input ...
> 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.
[jira] Commented: (EXEC-39) StringUtils quoting problems
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12909990#action_12909990 ]
Sebb commented on EXEC-39:
--------------------------
There are quite a few Unix shell meta-characters.
Here is a list I found:
http://www.rci.rutgers.edu/~usseries/UNIXcmds.html#meta
> 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.
[jira] Commented: (EXEC-39) StringUtils quoting problems
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910079#action_12910079 ]
Sebb commented on EXEC-39:
--------------------------
It should just be sufficient to enclose an unsafe parameter in single-quotes.
Any embedded quotes should be escaped with a back-slash.
> 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.
[jira] Reopened: (EXEC-39) StringUtils quoting problems
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb reopened EXEC-39:
----------------------
Assignee: (was: Siegfried Goeschl)
I don't think this should be marked won't fix, as the problems are still present.
At the very least the issues should be mentioned in Javadoc.
> 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
>
> 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.
[jira] Updated: (EXEC-39) StringUtils quoting problems
Posted by "Sebb (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Sebb updated EXEC-39:
---------------------
Fix Version/s: (was: 1.1)
Marking fix version unknown
> 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
>
> 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.
[jira] Issue Comment Edited: (EXEC-39) StringUtils quoting problems
Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
[ 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 7:57 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/'
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/Πολίτικη\ κουζίνα/
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.
[jira] Commented: (EXEC-39) StringUtils quoting problems
Posted by "Joerg Schaible (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/EXEC-39?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12910043#action_12910043 ]
Joerg Schaible commented on EXEC-39:
------------------------------------
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.