problem with epstopdf: shell metacharacters not quoted from $OutputFilename

"Robert J. Peters" <[email protected]>
Newsgroups gmane.comp.tex.tetex.general
Message-ID <[email protected]>
Hello all,

Apologies if this is the wrong forum for this question; in that case please
point me in the right direction.

System info:

$ uname -a
Linux (somehost.somewhere) 2.6.11-1.14_FC3smp #1 SMP Thu Apr 7 19:38:19 EDT 2005
i686 i686 i386 GNU/Linux
$ rpm -q tetex
tetex-2.0.2-21.3

(Note that while my system has tetex 2.0, I've verified that this problem also
occurs with the epstopdf from the latest tetex-src-3.0.tar.gz).

While using doxygen (v1.4.3) to generate documentation (doxygen calls epstopdf
internally), I came across an apparent problem with epstopdf in which shell
metacharacters (specifically, parentheses) are passed unquoted to a shell pipe
in the following lines of epstopdf:

$ fgrep -1 sOutputFile ~/build/tetex-src-3.0/texk/tetex/epstopdf

  my $pipe = "$GS -q -sDEVICE=pdfwrite $GSOPTS " .
          "-sOutputFile=$OutputFilename - -c quit";
  debug "Ghostscript pipe:", $pipe;
  open(OUT,"|$pipe") or error "Cannot open Ghostscript for piped input";

In my case (using an explicit call to mimic what doxygen is doing internally),
epstopdf is being called as follows:

  epstopdf structfunc__traits_3_01R\(C_1_1_5\)\(\)_4.eps  \
    --outfile="structfunc__traits_3_01R(C_1_1_5)()_4.pdf"

and generates the following message:

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `gs -q -sDEVICE=pdfwrite 
-sOutputFile=structfunc__traits_3_01R(C_1_1_5)()_4.pdf - -c quit'

Is this the expected/desired behavior?

>From my admittedly superficial view of the situation, it seems like the
following change would fix the problem

-          "-sOutputFile=$OutputFilename - -c quit";
+          "-sOutputFile='$OutputFilename' - -c quit";

If so, could someone point me to the proper forum for suggesting such a patch?

Or, is it expected that callers of epstopdf should wrap the argument to
--outfile in a second set of quotes, like this:

  epstopdf structfunc__traits_3_01R\(C_1_1_5\)\(\)_4.eps  \
    --outfile="\"structfunc__traits_3_01R(C_1_1_5)()_4.pdf\""

That call works as-is with the current epstopdf, but it feels somewhat
awkward/counter-intuitive to have to wrap the argument in two sets of quotes.

Thanks,
Rob Peters

******************************************************************
Robert J. Peters, Ph.D.              Computer Science/Neuroscience
rjpeters at usc dot edu               Univ. of Southern California
http://ilab.usc.edu/rjpeters/                        3641 Watt Way
tel: 213.740.9223, fax: 626.737.0463         Los Angeles, CA 90089
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.