#147182 docbook-utils: docbook2* crashes if there is spaces in name or in path of the sgml file

#147182#5
Date:
2002-05-16 13:44:39 UTC
From:
To:

There are in fact 2 problems :

- spaces in path :

$ cd /tmp/foo\ bar/
$ docbook2pdf foo.sgml
/usr/bin/jw: [: /tmp/foo: binary operator expected
grep: /tmp/foo: Aucun fichier ou répertoire de ce type
grep: bar/foo.sgml: Aucun fichier ou répertoire de ce type
Using catalogs: /etc/sgml/catalog
Using stylesheet: /usr/share/sgml/docbook/utils-0.6.10/docbook-utils.dsl#print
Working on: /tmp/foo bar/foo.sgml
jade:E: cannot open "/tmp/foo" (Aucun fichier ou rpertoire de ce type)
jade:E: cannot find "bar/foo.sgml"; tried "bar/foo.sgml", "/usr/local/share/sgml/bar/foo.sgml", "/usr/local/lib/sgml/bar/foo.sgml", "/usr/share/sgml/bar/foo.sgml"
/usr/bin/jw: cd: /tmp/foo: Aucun fichier ou répertoire de ce type

The bug is linked to some expansion done by the shell, the name
"foo bar" is sometimes seen as 2 differents arguments ("foo" "bar").

Corrections (I cand send all files I have modified, feel free to ask) :

  * in /usr/bin/jw, /usr/share/sgml/docbook/utils-0.6.10/frontends/docbook

  add " around all $SGML_FILE and $SGML_CURRENT_DIRECTORY variables.

  * in /usr/share/sgml/docbook/utils-0.6.10/backends/* :

  the problem appears in the $SGML_ARGUMENTS, $SGML_FILE appears at the
  end. The only solution I found is to expand all variable, and add "
  around SGML_FILE, eg :

  $SGML_JADE -t rtf -o ${SGML_FILE_NAME}.rtf $SGML_INCLUDE -i $SGML_TYPE \
   -d $SGML_STYLESHEET $SGML_OPTIONS $SGML_WARNINGS $SGML_DECL "$SGML_FILE"


- spaces in file name :

  * in /usr/bin/doocbook2XXX  : substitute "$@" by "$1"

  * in /usr/share/sgml/docbook/utils-0.6.10/backends/* : add " around
    all variables refering to file's name (${SGML_FILE_NAME}.tex,...)

    Anyway the scripts always failed, the bug is in pdfjadetex, which
    does not accept files with spaces - also with ". I should probably
    report the bug against the tetex-bin package...

    There is a workaround : in backends, I have changed SGML_FILE_NAME
    to a SGML_FILE_TEMP, initialized to a temporary file (using mktemp),
    and then rename the SGML_FILE_TEMP.xxx produced to
    SGML_FILE_NAME.xxx


HTH...