commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Csaba Skrabak (JIRA)" <j...@apache.org>
Subject [jira] [Comment Edited] (CLI-275) Cannot get a full quoted argument through
Date Wed, 23 Aug 2017 15:59:00 GMT

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

Csaba Skrabak edited comment on CLI-275 at 8/23/17 3:58 PM:
------------------------------------------------------------

[~glennm], your 4th example:
{noformat}
"'"~"'"
{noformat}
...is fully interpreted by bash, that is why echo behaves the same way. Bash by the way interprets
it the following way:
1. Double quotation mark: quoted string starts (first one.)
2. Single quotation mark: a literal apostrophe is passed over to the process since we are
inside quotation.
3. Double quotation mark: first quoted string ends here.
4. Tilde. Has no special meaning, passing it over to the process. (It does have special meaning
in Mac OS bash; but you seem to have tested it on Linux bash.)
5. Double quotation mark. Starting a quoted string again. This is a second quotation.
6. Single quotation mark. A literal apostrophe is passed over to the process since we are
inside (the second) quotation.
7. Double quotation mark. End of the second quotation.
8. End. So as a result, we passed over an apostrophe in step 2, a tilde in step 4 and another
apostrophe in step 6:
{noformat}
'~'
{noformat}
tada.wav


was (Author: cskrabak):
[~glennm], your 4th example:
{noformat}
"'"~"'"
{noformat}
...is fully interpreted by bash, that is why echo behaves the same way. Bash by the way interprets
it the following way:
1. Double quotation mark: quoted string starts (first one.)
2. Single quotation mark: a literal apostrophe is passed over to the process since we are
inside quotation.
3. Double quotation mark: first quoted string ends here.
4. Tilde. Has no special meaning, passing it over to the process.
5. Double quotation mark. Starting a quoted string again. This is a second quotation.
6. Single quotation mark. A literal apostrophe is passed over to the process since we are
inside (the second) quotation.
7. Double quotation mark. End of the second quotation.
8. End. So as a result, we passed over an apostrophe in step 2, a tilde in step 4 and another
apostrophe in step 6:
{noformat}
'~'
{noformat}
tada.wav

> Cannot get a full quoted argument through
> -----------------------------------------
>
>                 Key: CLI-275
>                 URL: https://issues.apache.org/jira/browse/CLI-275
>             Project: Commons CLI
>          Issue Type: Bug
>            Reporter: Csaba Skrabak
>
> CLI-185 has been partially fixed but user still cannot pass in an argument like "x" (the
whole argument surrounded by one pair of double quotes.) If user enters \"x\" then the quotes
get eaten (btw. WHY THE HECK?!). But if user enters \"\"x\"\" then both pairs of quotes are
left intact.
> The idea of removing the quotes is plain wrong, should be either forgotten entirely or
the argument should be parsed properly (rather than tinkering from bug to bug with variations
of find/substring call constructs) with the possibility to escape and quote quotation marks.
> Blocks: PHOENIX-3710



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message