moissinac / csvfix

Automatically exported from code.google.com/p/csvfix
MIT License
0 stars 0 forks source link

exec test fails due to a non-escaped apostrophe #36

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Run the exec test on a Linux system

What is the expected output? What do you see instead?

I'm getting the following output from the exec test:
"Charles","Dickens","M","ChXrlXs DXckXns"
"Jane","Austen","F","JXnX AXstXn"
"Herman","Melville","M","HXrmXn MXlvXllX"
sh: -c: line 0: unexpected EOF while looking for matching `''
sh: -c: line 1: syntax error: unexpected end of file
ERROR: Command execution error

Therefore it's clearly stopping due to the un-escaped apostrophe in O'Brien. 
The same would occur for quotation marks.

What version of the product are you using? On what operating system?

I'm running csvfix-1.1 on a Linux system.

Original issue reported on code.google.com by radhermit on 5 Aug 2011 at 4:24

GoogleCodeExporter commented 8 years ago

Original comment by nbutterworth1953@gmail.com on 6 Aug 2011 at 7:33

GoogleCodeExporter commented 8 years ago
A quick fix for Linux users. In the file csved_exec.cpp, locate the function 
MakeParam and change the statement:

    return (unsigned int) n < row.size() ? row[n] : "";

to:

    return (unsigned int) n < row.size()
        ? ALib::Escape( row[n], "\\'\"", "\\" )
        : "";

then rebuild with:

    make lin

Do not apply this fix to code that is to be built for Windows.

Original comment by nbutterworth1953@gmail.com on 7 Aug 2011 at 9:41