You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nifi.apache.org by "Michal Klempa (JIRA)" <ji...@apache.org> on 2016/02/15 15:57:18 UTC

[jira] [Created] (NIFI-1514) ExecuteStreamCommand does not split command line arguments by provided separator when these come from expression language evaluation

Michal Klempa created NIFI-1514:
-----------------------------------

             Summary: 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.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)