chm2pdf fails when filename contains special characters
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
chm2pdf (Ubuntu) |
Confirmed
|
Undecided
|
Unassigned |
Bug Description
Probably similar to
#500262 Errors if file name contains escaped special characters (space, parenthesis etc)
I have a chm file which has special characters in file name i.e. open and close bracket. These characters must be escaped when used with shell command. Otherwise, shell reports errors.
For example:
prasad@
sh: 1: Syntax error: word unexpected (expecting ")")
sh: 1: Syntax error: word unexpected (expecting ")")
sh: 1: Syntax error: "(" unexpected
Something wrong happened when launching htmldoc.
exit value: 512
Check if output exists or if it is good.
Done.
chm2pdf runs shell utilities and commands like rm, htmldoc using os.system(). I suppose, os.system() start a shell and pass the command to it. Therefore, if file has special characters the command fails.
Thanks and Regards,
Prasad
Attaching file: bug-1200415.path
revno: 12
committer: Prasad Joshi <email address hidden>
branch nick: chm2pdf
timestamp: Fri 2013-07-12 03:49:21 +0530
message:
Handle CHM file names with special characters in name
If a file has special characters in the file name, then it must be quoted
correctly when the shell is involved.
chm2pdf runs shell utilities and commands like rm, htmldoc using
os.system(). I suppose, os.system() start a shell and pass the command to
it. Therefore, if file has special characters chm2pdf fails.
For example
prasad@ pjoshi: ~/sources/ chm2pdf- read-only$ chm2pdf --book "(1)_1.chm"
sh: 1: Syntax error: word unexpected (expecting ")")
sh: 1: Syntax error: word unexpected (expecting ")")
sh: 1: Syntax error: "(" unexpected
Something wrong happened when launching htmldoc.
exit value: 512
Check if output exists or if it is good.
Done.
The patch fixes the problem by properly quoting the file name string.