Bug 226584

Summary: Filenames with space are not allowed
Product: Ghostscript Reporter: Jack Moffitt <jack>
Component: PDF WriterAssignee: L. Peter Deutsch <ghost>
Status: NOTIFIED FIXED    
Severity: normal CC: matteosistisette
Priority: P2    
Version: master   
Hardware: All   
OS: All   
Customer: Word Size: ---

Description Jack Moffitt 2000-12-21 03:13:47 UTC
Originally reported by: burnus@users.sourceforge.net
Try to run
    ps2pdf file\ name.ps
this produces
  basename: too many arguments
  Try `basename --help' for more information.

please surround in `basename ${foo}` the ${foo} with ""

moreover you need to use "" around the $infile and $outfile" in ps2pdfwr


Comment 1 L. Peter Deutsch 2000-12-31 09:47:09 UTC
Comment originally by lpd@users.sourceforge.net
I concur with the analysis and proposed fix. All of the utility scripts in lib/ should be reviewed to see whether they have this problem.
Comment 2 Jack Moffitt 2001-06-04 12:26:19 UTC
Comment originally by undefined@users.sourceforge.net
Logged In: YES 
user_id=16258

app: gs 7.00
os: win 2k
bat: ps2pdf.bat

i want to add that this bug also applies to the
ms-dos/windows bat files (not just the unix script as
mentioned in the original submission).

suggestion: in the "if" statements, do not enclose the
operands in quotes. i'm sure this was done because of null
strings, but the standard method of signifying a
command-line parameter containing spaces as a single
parameter is to enclose the parameter in quotes and this
wrecks havoc on the "if" statements.

you should easily see the problem with this example:
if ""postscript file.ps""==""
the parser sees the "if" keyword and expects to next see the
first operand, an operator, and then the last operand. but
instead the parser sees two consecutive operands: the null
string ("") and then the word "postscript", with no operand
imbetween. the parser throws an error.

instead signify the end of an operand with a forward slash.
(sorry for the long-winded explanation, but being more
familiar with bash scripting than win-batch scripting i
learned all this today and figured i would save someone the
headache of also searching all this out.)
Comment 3 L. Peter Deutsch 2001-06-28 23:48:56 UTC
Comment originally by lpd@users.sourceforge.net
Logged In: YES 
user_id=8861

A set of changes fixing this bug has been checked in to the
CVS tree.
Comment 4 matteosistisette 2011-10-22 11:12:23 UTC
The bug is still there at least on linux with the gs command.
If there is a space in the input file name, it gives error (additionally, the error message is not clear). I use backslashes to escape all spaces in file names, as you would do with any linux command.
Even using quotes "" doesnt fix the issue.