Bug 2903 - test.py -l crashes if the path of ns-3 contains a space
test.py -l crashes if the path of ns-3 contains a space
Status: PATCH WANTED
Product: ns-3
Classification: Unclassified
Component: test framework
ns-3.28
All All
: P3 normal
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-03-28 06:44 EDT by Jörg Christian Kirchhof
Modified: 2018-03-30 10:37 EDT (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Jörg Christian Kirchhof 2018-03-28 06:44:42 EDT
Overview: 
If the path where ns-3 lies on your computer contains a space, "./test.py -l" crashes.


Steps to Reproduce: 
1) Setup ns-3 in a folder whose path contains a space, e.g., "/Users/kirchhof/Mobile Documents/ns-allinone-3.28"
2) Go into the ns3 directory
3) Call "./waf configure --enable-examples --enable-tests"
4) Call "./waf build"
5) Call "./test.py -l"

Actual Results: 
The script crashes. The error message says:
"test.py error:  test-runner return code returned 127
To debug, try running './waf --run "test-runner --print-test-name-list"'"

However, calling "./waf --run "test-runner --print-test-name-list"" works fine.

Expected Results: 
A list of test-suites should be printed to the console.

Build Date & Hardware: 
ns-3.28 on Mac OS X High Sierra.

Additional Builds and Platforms: 
I also reproduced the issue using Ubuntu 16.04.3 LTS with ns-3.28.

Additional Information: 
The cause of the error is in line 766 of test.py. It says "proc = subprocess.Popen(cmd, shell = True, cwd = directory, stdout=subprocess.PIPE, stderr=subprocess.PIPE)". Everything after the first whitespace in cmd is treated as an argument. However, simply adding quotation marks to cmd is not an option because cmd contains the command and the arguments.