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

Daniel Templeton commented on YARN-6830:
----------------------------------------

Oops, sorry.  Didn't mean to do a drive by.

What about using {{Matcher.find()}} to iteratively hunt for vars, something 
like:
{code}
Pattern p = Pattern.compile("^(" + Shell.ENV_NAME_REGEX + 
")=(['\"]?)(((?!\\2).)*)\\2(,|$)");
Matcher m = p.matcher(envString);
int start = 0;

while (m.find(start)) {
  String key = m.group(1);
  String value = m.group(3);

  ...

  start = m.end();
}

if (m.end() != envString.length()) {
  // Complain about left-over bits
}
{code}

Just thinking out loud.

> Support quoted strings for environment variables
> ------------------------------------------------
>
>                 Key: YARN-6830
>                 URL: https://issues.apache.org/jira/browse/YARN-6830
>             Project: Hadoop YARN
>          Issue Type: Bug
>            Reporter: Shane Kumpf
>            Assignee: Shane Kumpf
>         Attachments: YARN-6830.001.patch
>
>
> There are cases where it is necessary to allow for quoted string literals 
> within environment variables values when passed via the yarn command line 
> interface.
> For example, consider the follow environment variables for a MR map task.
> {{MODE=bar}}
> {{IMAGE_NAME=foo}}
> {{MOUNTS=/tmp/foo,/tmp/bar}}
> When running the MR job, these environment variables are supplied as a comma 
> delimited string.
> {{-Dmapreduce.map.env="MODE=bar,IMAGE_NAME=foo,MOUNTS=/tmp/foo,/tmp/bar"}}
> In this case, {{MOUNTS}} will be parsed and added to the task environment as 
> {{MOUNTS=/tmp/foo}}. Any attempts to quote the embedded comma separated value 
> results in quote characters becoming part of the value, and parsing still 
> breaks down at the comma.
> This issue is to allow for quoting the comma separated value (escaped double 
> or single quote). This was mentioned on YARN-4595 and will impact YARN-5534 
> as well.



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

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to