[ https://issues.apache.org/jira/browse/NIFI-1514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15151342#comment-15151342 ]
ASF subversion and git services commented on NIFI-1514: ------------------------------------------------------- Commit c2998a71ec4e262363858e7d54bb2e47afcda8c2 in nifi's branch refs/heads/master from [~michal.klempa] [ https://git-wip-us.apache.org/repos/asf?p=nifi.git;h=c2998a7 ] NIFI-1514 Fixed ExecuteStreamCommand when expressions in command arguments are used, contents are not split by command separator This closes #223. Signed-off-by: Aldrin Piri <ald...@apache.org> > ExecuteStreamCommand does not split command line arguments by provided > separator when these come from expression language evaluation > ------------------------------------------------------------------------------------------------------------------------------------ > > Key: NIFI-1514 > URL: https://issues.apache.org/jira/browse/NIFI-1514 > Project: Apache NiFi > Issue Type: Bug > Components: Extensions > Affects Versions: 0.5.0, 0.4.1 > Reporter: Michal Klempa > Priority: Trivial > > When Comannd Arguments property contains expression to be evaluated, the > expression is taken as one command argument instead of being splitted using > argument separator. > To reproduce the problem: > 1. Create DataFlow > 2. Add GenerateFlowFile processor, File Size: 10kB > 3. Connect GenerateFlowFile -> success -> UpdateAttribute processor > 4. In UpdateAttribute: create attribute optionalArgs with contents: "-c 5" > 5. Connect UpdateAttribute -> success -> ExecuteStreamCommand > 6. Configure ExecuteStreamCommand to execute Command Path: "ping", Command > Arguments: "${optionalArgs} google.com", Argument Delimiter: " " (spacebar), > Ignore STDIN: true, auto terminate: original > 7. Connect ExecuteStreamCommand -> output stream - > LogAttribute to see some > output. LogAttribute auto terminate: success, Log Level: error, Log Payload: > true. > 8. Run the flow. > Expected output: > 1. ExecuteStreamCommand issues command ping with args:[ "-c", "5", > "google.com"] > Actual output: > 1. ExecuteStreamCommand puts the "-c 5" into single arg for ProcessBuilder. > args: are ["-c 5", "google.com"] > This behavior is no problem for ping utility (as it reparses the commandline > again to search for argument separator), but there are tools (like snmpwalk > in my case), which are dumb enough not to parse command line arguments > properly, when they are sent inproperly by ProcessBuilder. > The problem is apparently in lines: ExecuteStreamCommand.java: 305-306, where > arguments splitting on argument separator is done before expression language > evaluation. The fix should reverse the operation: first evaluate expression > language and the split the arguments by separator. -- This message was sent by Atlassian JIRA (v6.3.4#6332)