chm2pdf fails when filename contains special characters

Bug #1200415 reported by prasad
12
This bug affects 2 people
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@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.

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

Tags: patch
Revision history for this message
prasad (prasadjoshi124) wrote :

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.

Revision history for this message
Ubuntu Foundations Team Bug Bot (crichton) wrote :

The attachment "bug-1200415.path" seems to be a patch. If it isn't, please remove the "patch" flag from the attachment, remove the "patch" tag, and if you are a member of the ~ubuntu-reviewers, unsubscribe the team.

[This is an automated message performed by a Launchpad user owned by ~brian-murray, for any issues please contact him.]

tags: added: patch
Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in chm2pdf (Ubuntu):
status: New → Confirmed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.