sayak-m / shcov

Automatically exported from code.google.com/p/shcov
GNU General Public License v2.0
0 stars 0 forks source link

--output and --shell options not handled correctly #7

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. shcov --output=shcov.dat ./test.sh
2. shcov --output=out.dat ./test.sh
3. ls -la

What is the expected output? What do you see instead?
Expected shcov.dat and out.dat to be created. Instead, shcov.da and .da were 
created:

% ls -la
total 20
drwxr-x---   3 mhamilt mhamilt 4096 Feb  7 10:44 .da/
drwxr-x---   3 mhamilt mhamilt 4096 Feb  7 10:42 shcov.da/
-rwxr-x---   1 mhamilt mhamilt   20 Feb  7 10:42 test.sh*

What version of the product are you using? On what operating system?
shcov-5 on RHEL6 using Python 2.7.4

Please provide any additional information below.

The issue here is that the the code uses

outpath = arg.strip("--output=")

However, according to this:

http://docs.python.org/2/library/stdtypes.html?highlight=str.strip#str.strip

the strip member removes 'characters' from the string, not substrings, so all 
combinations of the characters in the string '--output=' will be stripped, 
including the trailing 't' in the first test, and the leading 'out' and 
trailing 't' in the second.

A better approach might be

outpath = arg[9:]

or

outpath = arg.split("--output=')[1]

Note that the --shell option also has this same error.

Original issue reported on code.google.com by hami...@comcast.net on 7 Feb 2014 at 6:20

GoogleCodeExporter commented 8 years ago
Implemented by Mark, thanks!

Original comment by simon.ka...@gmail.com on 14 Feb 2014 at 6:06