We're updating the issue view to help you get more done. 

CFEXECUTE arguments does not properly handle arrays

Description

args = [ "my", "set", "of command", "line arguments" ]
cfexecute(name="/bin/echo", arguments=args, timeout=10)

What it tries to execute:
/bin/echo[my, set, of command, line arguments]

Why: see red:
{{
public void setArguments(Object args) {

if(args instanceof lucee.runtime.type.Collection) {
StringBuffer sb=new StringBuffer();
lucee.runtime.type.Collection coll=(lucee.runtime.type.Collection)args;
//lucee.runtime.type.Collection.Key[] keys=coll.keys();
Iterator<Object> it = coll.valueIterator();
while(it.hasNext()) {
sb.append(' ');
sb.append(it.next());
}
arguments=args.toString();
}
else if(args instanceof String) {
arguments=" "+args.toString();
}
else this.arguments="";
}
}}

I would suggest changing args.toString() to sb.toString().... Except I disagree with the entire approach.

The reason one might use arrays instead of a string to pass in arguments is to avoid text parsing issues. If I call Runtime.exec() with an array, then my argument above "of command" or "line arguments" will properly be a SINGLE argument, not two separate ones. Merging the array unceremoniously back into a string with space delimiters removes the context. And doesn't insert any quotes to make underlying layers process it correctly.

Even worse, the underlying lang.commons.cli.Command object accepts arrays! Sooooooo why switch the array, to a string, to be parsed back into an array later?

Environment

Linux, but N/A

Status

Assignee

Pothys - MitrahSoft

Reporter

Joseph Gooch

Sprint

None

Fix versions

Affects versions

5.2.9.32

Priority

Minor