Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 367674 - A command line passed to xdc.exec works on Windows but fails on Linux
Summary: A command line passed to xdc.exec works on Windows but fails on Linux
Status: CLOSED FIXED
Alias: None
Product: RTSC
Classification: Technology
Component: Core (show other bugs)
Version: unspecified   Edit
Hardware: All Linux
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Dave Russo CLA
QA Contact:
URL:
Whiteboard: target:3.23.01
Keywords:
Depends on:
Blocks:
 
Reported: 2011-12-30 16:26 EST by Sasha Slijepcevic CLA
Modified: 2013-01-24 15:11 EST (History)
0 users

See Also:


Attachments
test case (99.30 KB, application/x-zip-compressed)
2011-12-30 16:26 EST, Sasha Slijepcevic CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
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/