Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 367674

Summary: A command line passed to xdc.exec works on Windows but fails on Linux
Product: [Technology] RTSC Reporter: Sasha Slijepcevic <sascha>
Component: CoreAssignee: Dave Russo <d-russo>
Status: CLOSED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: unspecified   
Target Milestone: ---   
Hardware: All   
OS: Linux   
Whiteboard: target:3.23.01
Attachments:
Description Flags
test case none

Description Sasha Slijepcevic CLA 2011-12-30 16:26:25 EST
Created attachment 208886 [details]
test case

The following code prints "Hello World" on Windows, but fails on Linux with the error message:
Couldn't open file "subdir/prog.out"

var base = xdc.loadPackage("ti.platforms.sim64Pxx").packageBase;
var os = environment["xdc.hostOS"];
var status = {};
xdc.exec(base + os + "/kelvin  -quiet -mem_ignore \"subdir/prog.out\"", {},
         status);
print(status.output);

The test package is attached.
Comment 1 Sasha Slijepcevic CLA 2012-01-04 13:24:40 EST
- fixed in xdc-y15

I added a new code to xdc.services.global.Host.exec, which removes all quotes before supplying the command line arguments to Java's ProcessBuilder. ProcessBuilder does not use a shell to execute commands, so the quotes are not needed, and can cause errors as in the attached test case.
Comment 2 Dave Russo CLA 2012-02-07 21:00:33 EST
verified via a simple xs script, host.xs (see below):

[sanblnx02 744] cat host.xs
var tools = environment["xdc.rootDir"];
var status = {};
xdc.exec(tools + '/bin/printargs this "is a" test', {}, status);
print(status.output);

[sanblnx02 745] $TOOLS/vendors/xdc/xdctools_3_23_00_33//Linux/xs -f host.xs
/db/toolsrc/library/tools/vendors/xdc/xdctools_3_23_00_33//Linux/bin/printargs
this
"is
a"
test

[sanblnx02 746] $TOOLS/vendors/xdc/xdctools_3_23_01_39_eng/Linux/xs -f host.xs
/db/toolsrc/library/tools/vendors/xdc/xdctools_3_23_01_39_eng/Linux/bin/printargs
this
is a
test

[sanblnx02 747]
Comment 3 Dave Russo CLA 2012-02-07 21:04:09 EST
Unfortunately there does not seem to be a way to pass "s in an argument to a command.
Comment 4 Dave Russo CLA 2013-01-24 15:11:56 EST
xdctools 3.23.05 GA is available from here: http://www.sanb.design.ti.com/tisb_releases/XDCtools/3_23_05_61/