GNU bug report logs - #31684
12.1.1; Preview-DviPNG fails with filename having spaces (DviPS is used as fallback)

Previous Next

Package: auctex;

Reported by: jfbu <jfbu <at> free.fr>

Date: Sat, 2 Jun 2018 11:54:02 UTC

Severity: normal

Found in version 12.1.1

Done: Ikumi Keita <ikumi <at> ikumi.que.jp>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: jfbu <jfbu <at> free.fr>
Cc: 31684 <at> debbugs.gnu.org
Subject: bug#31684: 12.1.1; Preview-DviPNG fails with filename having spaces (DviPS is used as fallback)
Date: Fri, 08 Jun 2018 14:02:36 +0900
Hi Jean and all,

>>>>> jfbu <jfbu <at> free.fr> writes:
> Experience 2: name it as abc def ghi.tex (so it includes spaces in filename)
> Switch to DVI mode
> Ask to generate previews for all document.
> Answer YES to "Cache preamble?"
> It **appears to work** but in fact it doesn't: 

> ....
> Running `Preview-DviPNG' with ``dvipng -picky -noghostscript abc\ def\ ghi.dvi -o "abc\ def\ ghi.prv/tmp14749czs/prev%03d.png"  -D186 ''
> This is dvipng (dvipng (TeX Live)) 1.15 Copyright 2002-2015 Jan-Ake Larsson
> [1 (preview-latex version 12.1) (preview-latex tightpage option detected, will use its bounding box)
> dvipng: Fatal error, cannot open output file abc\ def\ ghi.prv/tmp14749czs/prev001.png

Confirmed.  It seems the reason is that `preview-dvipng-command'
contains spurious quotes.  Various `preview-*-command' are defined as:
(defcustom preview-dvipng-command
  "dvipng -picky -noghostscript %d -o \"%m/prev%%03d.png\""
  ...
(defcustom preview-dvips-command
  "dvips -Pwww -i -E %d -o %m/preview.000"
  ...
(defcustom preview-fast-dvips-command
  "dvips -Pwww %d -o %m/preview.ps"
  ...
(defcustom preview-pdf2dsc-command
  "pdf2dsc %s.pdf %m/preview.dsc"
  ...
.  They don't have quotes around %m except `preview-dvipng-command'.
Removing the quotes makes dvipng works with file name with space on my
side.

In addition, I noticed during test runs that single quotes in
`preview-dvipng-color-string' choke dvipng on w32 platform because
single quotes are not consumed by w32 shell (cmd.exe).

Could you please test the following patch?  (It is for preview.el.in in
the source files, not for preview.el.)

Regards,
Ikumi Keita

diff --git a/preview.el.in b/preview.el.in
--- a/preview.el.in
+++ b/preview.el.in
@@ -522,7 +522,7 @@
 be consulted recursively.")
 
 (defcustom preview-dvipng-command
-  "dvipng -picky -noghostscript %d -o \"%m/prev%%03d.png\""
+  "dvipng -picky -noghostscript %d -o %m/prev%%03d.png"
   "*Command used for converting to separate PNG images.
 
 You might specify options for converting to other image types,
@@ -796,13 +796,13 @@
        (border (aref colors 3)))
     (concat
      (and bg
-	  (format "--bg 'rgb %s' "
+	  (format "--bg \"rgb %s\" "
 		  (mapconcat #'preview-gs-color-value bg " ")))
      (and fg
-	  (format "--fg 'rgb %s' "
+	  (format "--fg \"rgb %s\" "
 		  (mapconcat #'preview-gs-color-value fg " ")))
      (and mask border
-	  (format "--bd 'rgb %s' "
+	  (format "--bd \"rgb %s\" "
 		  (mapconcat #'preview-gs-color-value mask " ")))
      (and border
 	  (format "--bd %d" (max 1 (round (/ (* res border) 72.0))))))))




This bug report was last modified 6 years and 287 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.