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.

To add a comment to this bug, you must first unarchive it, by sending
a message to control AT debbugs.gnu.org, with unarchive 31684 in the body.
You can then email your comments to 31684 AT debbugs.gnu.org in the normal way.

Toggle the display of automated, internal messages from the tracker.

View this report as an mbox folder, status mbox, maintainer mbox


Report forwarded to bug-auctex <at> gnu.org:
bug#31684; Package auctex. (Sat, 02 Jun 2018 11:54:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to jfbu <jfbu <at> free.fr>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Sat, 02 Jun 2018 11:54:02 GMT) Full text and rfc822 format available.

Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):

From: jfbu <jfbu <at> free.fr>
To: bug-auctex <at> gnu.org
Subject: 12.1.1;
 Preview-DviPNG fails with filename having spaces (DviPS is used as
 fallback)
Date: Sat, 2 Jun 2018 13:53:21 +0200
Hi,

consider this file

---- start
\documentclass{article}
\def\abc{abc}
\begin{document}
$\abc$
\end{document}
---- stop

With default engine (pdftex):

Experience 1: name it as abcdefghi.tex.
Switch to DVI mode. (C-cC-tC-p as PDF mode is ON by default)
Ask to generate previews for all document.
Answer YES to "Cache preamble?"
It works.

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


Preview-DviPNG exited abnormally with code 2 at Sat Jun  2 13:44:48
Running `Preview-DviPS' with ``dvips -Pwww abc\ def\ ghi.dvi -o abc\ def\ ghi.prv/tmp14749p9y/preview.ps''
...

So the preview was generated but using ghostscript as a fallback.

In the case with no spaces the process output buffer contains this

....
TeX Output exited as expected with code 1 at Sat Jun  2 13:50:37
Running `Preview-DviPNG' with ``dvipng -picky -noghostscript abcdefghi.dvi -o "abcdefghi.prv/tmp14749bHC/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)] 

Preview-DviPNG finished at Sat Jun  2 13:50:37
....

This is with stock AUCTeX 12.1.1.

Jean-François







Information forwarded to bug-auctex <at> gnu.org:
bug#31684; Package auctex. (Fri, 08 Jun 2018 05:03:01 GMT) Full text and rfc822 format available.

Message #8 received at 31684 <at> debbugs.gnu.org (full text, mbox):

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: jfbu <jfbu <at> free.fr>
Cc: 31684 <at> debbugs.gnu.org
Subject: Re: 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))))))))




Information forwarded to bug-auctex <at> gnu.org:
bug#31684; Package auctex. (Fri, 08 Jun 2018 09:05:02 GMT) Full text and rfc822 format available.

Message #11 received at 31684 <at> debbugs.gnu.org (full text, mbox):

From: jfbu <jfbu <at> free.fr>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: 31684 <at> debbugs.gnu.org
Subject: Re: bug#31684: 12.1.1; Preview-DviPNG fails with filename having
 spaces (DviPS is used as fallback)
Date: Fri, 8 Jun 2018 11:04:00 +0200
Hi Keita

Le 08/06/2018 à 07:02, Ikumi Keita a écrit :
> 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.)


I confirm problem is fixed at my locale for the MWE I posted initially:

(mac os x 10.9.5)

Here is transcript:

> ...
> (see the transcript file for additional information)
> Output written on "abc def ghi.dvi" (1 page, 1584 bytes).
> Transcript written on "abc def ghi.log".
> 
> TeX Output exited as expected with code 1 at Fri Jun  8 10:57:23
> Running `Preview-DviPNG' with ``dvipng -picky -noghostscript abc\ def\ ghi.dvi -o abc\ def\ ghi.prv/tmpDOwfcQ/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)] 
> 
> Preview-DviPNG finished at Fri Jun  8 10:57:23

My testing does not extend to that part of your patch dealing with options
but I trust it does the right thing...

Best,

Jean-François




Information forwarded to bug-auctex <at> gnu.org:
bug#31684; Package auctex. (Fri, 08 Jun 2018 13:10:01 GMT) Full text and rfc822 format available.

Message #14 received at 31684 <at> debbugs.gnu.org (full text, mbox):

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

Thank you for confirmation.  I think this change is small and rather
safe, so I'll commit it as soon as I finish some documentation.

Regards,
Ikumi Keita

>>>>> jfbu <jfbu <at> free.fr> writes:
>> .  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.)

> I confirm problem is fixed at my locale for the MWE I posted initially:

> (mac os x 10.9.5)

> Here is transcript:

>> ...
>> (see the transcript file for additional information)
>> Output written on "abc def ghi.dvi" (1 page, 1584 bytes).
>> Transcript written on "abc def ghi.log".
>> 
>> TeX Output exited as expected with code 1 at Fri Jun  8 10:57:23
>> Running `Preview-DviPNG' with ``dvipng -picky -noghostscript abc\ def\ ghi.dvi -o abc\ def\ ghi.prv/tmpDOwfcQ/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)] 
>> 
>> Preview-DviPNG finished at Fri Jun  8 10:57:23

> My testing does not extend to that part of your patch dealing with options
> but I trust it does the right thing...




bug closed, send any further explanations to 31684 <at> debbugs.gnu.org and jfbu <jfbu <at> free.fr> Request was from Ikumi Keita <ikumi <at> ikumi.que.jp> to control <at> debbugs.gnu.org. (Wed, 31 Oct 2018 13:25:02 GMT) Full text and rfc822 format available.

bug archived. Request was from Debbugs Internal Request <help-debbugs <at> gnu.org> to internal_control <at> debbugs.gnu.org. (Thu, 29 Nov 2018 12:24:05 GMT) Full text and rfc822 format available.

This bug report was last modified 5 years and 150 days ago.

Previous Next


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