GNU bug report logs - #37719
11.91; preview-latex not working (again?)

Previous Next

Package: auctex;

Reported by: Dylan Thurston <dpt <at> bostoncoop.net>

Date: Sat, 12 Oct 2019 19:48:02 UTC

Severity: normal

Tags: fixed

Found in version 11.91

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 37719 in the body.
You can then email your comments to 37719 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#37719; Package auctex. (Sat, 12 Oct 2019 19:48:02 GMT) Full text and rfc822 format available.

Acknowledgement sent to Dylan Thurston <dpt <at> bostoncoop.net>:
New bug report received and forwarded. Copy sent to bug-auctex <at> gnu.org. (Sat, 12 Oct 2019 19:48:02 GMT) Full text and rfc822 format available.

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

From: Dylan Thurston <dpt <at> bostoncoop.net>
To: bug-auctex <at> gnu.org
Subject: 11.91; preview-latex not working (again?)
Date: Sat, 12 Oct 2019 12:11:06 -0400
To: bug-auctex <at> gnu.org
Subject: 11.91; preview-latex not working again
From: Dylan Thurston <dpt <at> tulip.bostoncoop.net>
--text follows this line--

Preview-latex has stopped working, with errors about /invalidfileaccess.
(I sometimes also get errors about /typecheck; I have not isolated
exactly when that happens.)

On this minimal TeX file:
```
\documentclass{article}

\begin{document}
Testing. $1+1=2$
\end{document}
```

I get the following error message:

```
/usr/bin/gs -dOutputFile\=\(_region_.prv/tmpLERquC/pr1-1.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r96.1119x96.0946
GS>{<</PermitFileReading[(_region_.pdf)(_region_.prv/tmpLERquC/preview.dsc)]>> setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped pop/.preview-BP currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne or{.preview-BP }{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{/.preview-ST[count 4 roll save]def dup length 0 eq{pop}{setpagedevice}{ifelse exec}stopped{handleerror quit}if .preview-ST aload pop restore}bind def  (_region_.prv/tmpLERquC/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 412()/SubFileDecode filter cvx exec .preview-ST dup dup 412 setfileposition 51()/SubFileDecode filter cvx<<>>preview-do
Error: /invalidfileaccess in --file--
Operand stack:
   (_region_.prv/tmpLERquC/preview.dsc)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:746/1123(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Last OS error: Permission denied
Current file position is 567
GS<2>
```

Since permissions might be an issue, here are the relevant files left
around:

```
dpt <at> tulip:/tmp$ ls -lRa _region_.prv/
_region_.prv/:
total 72
drwxr-xr-x  3 dpt  dpt   4096 Oct 12 11:52 .
drwxrwxrwt 20 root root 61440 Oct 12 11:52 ..
drwx------  2 dpt  dpt   4096 Oct 12 11:52 tmpLERquC

_region_.prv/tmpLERquC:
total 12
drwx------ 2 dpt dpt 4096 Oct 12 11:52 .
drwxr-xr-x 3 dpt dpt 4096 Oct 12 11:52 ..
-rw-r--r-- 1 dpt dpt  489 Oct 12 11:52 preview.dsc
dpt <at> tulip:/tmp$ ls -lRa _region_.*
-rw-r--r-- 1 dpt dpt 3516 Oct 12 11:52 _region_.log
-rw-r--r-- 1 dpt dpt 9149 Oct 12 11:52 _region_.pdf
-rw-r--r-- 1 dpt dpt  240 Oct 12 11:51 _region_.tex

_region_.prv:
total 72
drwxr-xr-x  3 dpt  dpt   4096 Oct 12 11:52 .
drwxrwxrwt 20 root root 61440 Oct 12 11:52 ..
drwx------  2 dpt  dpt   4096 Oct 12 11:52 tmpLERquC

_region_.prv/tmpLERquC:
total 12
drwx------ 2 dpt dpt 4096 Oct 12 11:52 .
drwxr-xr-x 3 dpt dpt 4096 Oct 12 11:52 ..
-rw-r--r-- 1 dpt dpt  489 Oct 12 11:52 preview.dsc
```

I don't see any reason why Emacs wouldn't be able to read that preview.dsc.

This looks similar to earlier permission issues with Ghostscript, but
I thought those were fixed in this latest version of auctex.

Emacs  : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11)
 of 2019-09-22, modified by Debian
Package: 11.91

current state:
==============
(setq
 AUCTeX-date "2017-07-24"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("/var/lib/auctex/emacs/"
		  "/usr/share/emacs/site-lisp/auctex/style"
		  "/home/dpt/.emacs.d/auctex/auto"
		  "/home/dpt/.emacs.d/auctex/style" "auto" "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master "Smoothings"
 TeX-command-list '(("TeX"
		     "%(PDF)%(tex) %(file-line-error) %`%(extraopts) %S%(PDFout)%(mode)%' %t"
		     TeX-run-TeX nil (plain-tex-mode ams-tex-mode texinfo-mode)
		     :help "Run plain TeX")
		    ("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil
		     (latex-mode doctex-mode) :help "Run LaTeX")
		    ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil
		     (texinfo-mode) :help "Run Makeinfo with Info output")
		    ("Makeinfo HTML" "makeinfo %(extraopts) --html %t"
		     TeX-run-compile nil (texinfo-mode) :help
		     "Run Makeinfo with HTML output")
		    ("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %t"
		     TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
		    ("ConTeXt"
		     "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t"
		     TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
		    ("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t"
		     TeX-run-TeX nil (context-mode) :help
		     "Run ConTeXt until completion")
		    ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help
		     "Run BibTeX")
		    ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
		    ("View" "%V" TeX-run-discard-or-function t t :help
		     "Run Viewer")
		    ("Print" "%p" TeX-run-command t t :help "Print the file")
		    ("Queue" "%q" TeX-run-background nil t :help
		     "View the printer queue" :visible TeX-queue-command)
		    ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t t :help
		     "Generate PostScript file")
		    ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil t :help
		     "Convert DVI file to PostScript")
		    ("Dvipdfmx" "dvipdfmx %d" TeX-run-dvipdfmx nil t :help
		     "Convert DVI file to PDF with dvipdfmx")
		    ("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t :help
		     "Convert PostScript file to PDF")
		    ("Glossaries" "makeglossaries %s" TeX-run-command nil t
		     :help "Run makeglossaries to create glossary file")
		    ("Index" "makeindex %s" TeX-run-index nil t :help
		     "Run makeindex to create index file")
		    ("upMendex" "upmendex %s" TeX-run-index t t :help
		     "Run upmendex to create index file")
		    ("Xindy" "texindy %s" TeX-run-command nil t :help
		     "Run xindy to create index file")
		    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode) :help
		     "Check LaTeX file for correctness")
		    ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode)
		     :help "Check LaTeX file for common mistakes")
		    ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil t
		     :help "Spell-check the document")
		    ("Clean" "TeX-clean" TeX-run-function nil t :help
		     "Delete generated intermediate files")
		    ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help
		     "Delete generated intermediate and output files")
		    ("Other" "" TeX-run-command t t :help
		     "Run an arbitrary command")
		    )
 )




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Sun, 13 Oct 2019 12:56:01 GMT) Full text and rfc822 format available.

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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Dylan Thurston <dpt <at> bostoncoop.net>
Cc: 37719 <at> debbugs.gnu.org
Subject: Re: bug#37719: 11.91; preview-latex not working (again?)
Date: Sun, 13 Oct 2019 21:55:45 +0900
Hi Dylan,

>>>>> Dylan Thurston <dpt <at> bostoncoop.net> writes:
> Preview-latex has stopped working, with errors about /invalidfileaccess.
> (I sometimes also get errors about /typecheck; I have not isolated
> exactly when that happens.)

[...]

> This looks similar to earlier permission issues with Ghostscript, but
> I thought those were fixed in this latest version of auctex.

I think that you are accidentally using old AUCTeX, inferring from the
following diagnosis and the "Subject" header of your report.

Current AUCTeX version is 12.1.  Please confirm whether your AUCTeX is
new enough or not.

Regards,
Ikumi Keita

> Emacs  : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11)
>  of 2019-09-22, modified by Debian
> Package: 11.91  <-- This is the version of AUCTeX

> current state:
> ==============
> (setq
>  AUCTeX-date "2017-07-24"  <-- This is the date of AUCTeX




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Sun, 13 Oct 2019 16:09:03 GMT) Full text and rfc822 format available.

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

From: Dylan Thurston <dpt <at> bostoncoop.net>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: 37719 <at> debbugs.gnu.org
Subject: Re: bug#37719: 11.91; preview-latex not working (again?)
Date: Sun, 13 Oct 2019 11:31:49 -0400
On Sun, Oct 13, 2019 at 09:55:45PM +0900, Ikumi Keita wrote:
> Hi Dylan,
> 
> >>>>> Dylan Thurston <dpt <at> bostoncoop.net> writes:
> > Preview-latex has stopped working, with errors about /invalidfileaccess.
> > (I sometimes also get errors about /typecheck; I have not isolated
> > exactly when that happens.)
> 
> [...]
> 
> > This looks similar to earlier permission issues with Ghostscript, but
> > I thought those were fixed in this latest version of auctex.
> 
> I think that you are accidentally using old AUCTeX, inferring from the
> following diagnosis and the "Subject" header of your report.
> 
> Current AUCTeX version is 12.1.  Please confirm whether your AUCTeX is
> new enough or not.

Thank you, you were correct: for some reason I have not yet tracked
down, emacs was using the system-installed version of AUCTeX (11.91)
rather than the version I installed via ELPA, which is 12.1.2. I
removed the system-installed version, and now the bug reporting
headers read as expected:

```
Emacs  : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11)
 of 2019-09-22, modified by Debian
Package: 12.1.2

current state:
==============
(setq
 AUCTeX-date "2019-02-08"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex"
		  "/home/dpt/.emacs.d/elpa/auctex-12.1.2/style"
		  "/home/dpt/.emacs.d/auctex/auto"
		  "/home/dpt/.emacs.d/auctex/style" "auto" "style")
```

(full output at the end).

Preview-latex is still not working; the error message (on the same
minimal file) is now as follows:

```
/usr/bin/gs -dOutputFile\=\(_region_.prv/tmpWdemBH/pr1-1.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r96.1119x96.0946
GS>{<</PermitFileReading[(_region_.pdf)(_region_.prv/tmpWdemBH/preview.dsc)]>> setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped pop/.preview-BP currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne or{.preview-BP }{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{/.preview-ST[count 4 roll save]def dup length 0 eq{pop}{setpagedevice}{ifelse exec}stopped{handleerror quit}if .preview-ST aload pop restore}bind def  (_region_.prv/tmpWdemBH/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 412()/SubFileDecode filter cvx exec .preview-ST dup dup 412 setfileposition 51()/SubFileDecode filter cvx<<>>preview-do
Error: /invalidfileaccess in --file--
Operand stack:
   (_region_.prv/tmpWdemBH/preview.dsc)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:746/1123(ro)(G)--   --dict:0/20(G)--   --dict:77/200(L)--
Current allocation mode is local
Last OS error: Permission denied
Current file position is 567
GS<2>
```

(It's maybe worth noting this was working perfectly until recently.)



Emacs  : GNU Emacs 26.3 (build 2, x86_64-pc-linux-gnu, GTK+ Version 3.24.11)
 of 2019-09-22, modified by Debian
Package: 12.1.2

current state:
==============
(setq
 AUCTeX-date "2019-02-08"
 window-system 'x
 LaTeX-version "2e"
 TeX-style-path '("~/.emacs.d/auctex"
		  "/home/dpt/.emacs.d/elpa/auctex-12.1.2/style"
		  "/home/dpt/.emacs.d/auctex/auto"
		  "/home/dpt/.emacs.d/auctex/style" "auto" "style")
 TeX-auto-save t
 TeX-parse-self t
 TeX-master t
 TeX-command-list '(("TeX"
		     "%(PDF)%(tex) %(file-line-error) %`%(extraopts) %S%(PDFout)%(mode)%' %t"
		     TeX-run-TeX nil
		     (plain-tex-mode ams-tex-mode texinfo-mode) :help
		     "Run plain TeX")
		    ("LaTeX" "%`%l%(mode)%' %T" TeX-run-TeX nil
		     (latex-mode doctex-mode) :help "Run LaTeX")
		    ("Makeinfo" "makeinfo %(extraopts) %t" TeX-run-compile nil
		     (texinfo-mode) :help "Run Makeinfo with Info output")
		    ("Makeinfo HTML" "makeinfo %(extraopts) --html %t"
		     TeX-run-compile nil (texinfo-mode) :help
		     "Run Makeinfo with HTML output")
		    ("AmSTeX" "amstex %(PDFout) %`%(extraopts) %S%(mode)%' %t"
		     TeX-run-TeX nil (ams-tex-mode) :help "Run AMSTeX")
		    ("ConTeXt"
		     "%(cntxcom) --once --texutil %(extraopts) %(execopts)%t"
		     TeX-run-TeX nil (context-mode) :help "Run ConTeXt once")
		    ("ConTeXt Full" "%(cntxcom) %(extraopts) %(execopts)%t"
		     TeX-run-TeX nil (context-mode) :help
		     "Run ConTeXt until completion")
		    ("BibTeX" "bibtex %s" TeX-run-BibTeX nil t :help
		     "Run BibTeX")
		    ("Biber" "biber %s" TeX-run-Biber nil t :help "Run Biber")
		    ("View" "%V" TeX-run-discard-or-function t t :help
		     "Run Viewer")
		    ("Print" "%p" TeX-run-command t t :help "Print the file")
		    ("Queue" "%q" TeX-run-background nil t :help
		     "View the printer queue" :visible TeX-queue-command)
		    ("File" "%(o?)dvips %d -o %f " TeX-run-dvips t t :help
		     "Generate PostScript file")
		    ("Dvips" "%(o?)dvips %d -o %f " TeX-run-dvips nil t :help
		     "Convert DVI file to PostScript")
		    ("Dvipdfmx" "dvipdfmx %d" TeX-run-dvipdfmx nil t :help
		     "Convert DVI file to PDF with dvipdfmx")
		    ("Ps2pdf" "ps2pdf %f" TeX-run-ps2pdf nil t :help
		     "Convert PostScript file to PDF")
		    ("Glossaries" "makeglossaries %s" TeX-run-command nil t
		     :help "Run makeglossaries to create glossary file")
		    ("Index" "makeindex %s" TeX-run-index nil t :help
		     "Run makeindex to create index file")
		    ("upMendex" "upmendex %s" TeX-run-index t t :help
		     "Run upmendex to create index file")
		    ("Xindy" "texindy %s" TeX-run-command nil t :help
		     "Run xindy to create index file")
		    ("Check" "lacheck %s" TeX-run-compile nil (latex-mode)
		     :help "Check LaTeX file for correctness")
		    ("ChkTeX" "chktex -v6 %s" TeX-run-compile nil (latex-mode)
		     :help "Check LaTeX file for common mistakes")
		    ("Spell" "(TeX-ispell-document \"\")" TeX-run-function nil
		     t :help "Spell-check the document")
		    ("Clean" "TeX-clean" TeX-run-function nil t :help
		     "Delete generated intermediate files")
		    ("Clean All" "(TeX-clean t)" TeX-run-function nil t :help
		     "Delete generated intermediate and output files")
		    ("Other" "" TeX-run-command t t :help
		     "Run an arbitrary command")
		    )
 )




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Sun, 13 Oct 2019 17:35:02 GMT) Full text and rfc822 format available.

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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Dylan Thurston <dpt <at> bostoncoop.net>
Cc: 37719 <at> debbugs.gnu.org
Subject: Re: bug#37719: 11.91; preview-latex not working (again?)
Date: Mon, 14 Oct 2019 02:34:03 +0900
Hi Dylan,

>>>>> Dylan Thurston <dpt <at> bostoncoop.net> writes:
> Preview-latex is still not working; the error message (on the same
> minimal file) is now as follows:

Thank you for a valuable report.  It seems that the Ghostscript
developers injected some change incompatible with preview-latex into gs
source, and that change was incorporated into the ghostscript binary
distribution of your package manager (Debian?).  I tried both gs 9.28
RC4 and the latest git repository, and ended up with the same result of
yours:

,----
| /home/keita/gs/bin/gs -dOutputFile\=\(bbb.prv/tmp0UabeI/pr1-1.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r108.606x108.587 -dDELAYBIND
| GS>{<</PermitFileReading[(bbb.pdf)(bbb.prv/tmp0UabeI/preview.dsc)]>> setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped pop/.preview-BP currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne or{.preview-BP gsave 1 1 0.878431 setrgbcolor clippath fill grestore }{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{/.preview-ST[count 4 roll save]def dup length 0 eq{pop}{setpagedevice}{ifelse exec}stopped{handleerror quit}if .preview-ST aload pop restore}bind def  (bbb.prv/tmp0UabeI/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 407()/SubFileDecode filter cvx exec .preview-ST dup dup 407 setfileposition 51()/SubFileDecode filter cvx<<>>preview-do
| Error: /invalidfileaccess in --file--
| Operand stack:
|    (bbb.prv/tmp0UabeI/preview.dsc)   (r)
| Execution stack:
|    %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
| Dictionary stack:
|    --dict:1175/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--
| Current allocation mode is local
| Last OS error: Permission denied
| Current file position is 606
| GS<2>
`----

I have no workaround for this trouble now.  Please consider reverting
the recent gs update if you can.

I'll report this issue to gs-devel list.

Regards,
Ikumi Keita




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Sun, 13 Oct 2019 18:16:01 GMT) Full text and rfc822 format available.

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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: gs-devel <at> ghostscript.com
Cc: 37719 <at> debbugs.gnu.org
Subject: Recent ghostscript broke preview-latex again
Date: Mon, 14 Oct 2019 03:15:16 +0900
[Message part 1 (text/plain, inline)]
Dear Ghostscript developers,

Thank you for your continuing work on developing gs.  Unfortunately, I
have to inform you that recent gs source became not compatible with
preview-latex again:
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=37719

I tried both gs 9.28 RC4 and fresh checkout of git repository of
ghostpdl.  I installed each of them with
env MAKE=gmake ./configure --prefix=$HOME/gs
gmake
gmake install
and set up the relavant path for this temporal installation, on FreeBSD
12.0 living in vmware on windows 10 home edition.  Then the invocation
of gs failed with a message quoted at the last of this message.

At the time of previous correspondence between us in this July,
preview-latex did work with gs 9.27 with patches suggested in
https://ghostscript.com/pipermail/gs-devel/2019-July/010161.html
applied, but it no longer does.  (By the way, the LaTeX developer
released new LaTeX this October, so the internal of the PDF file
produced by pdflatex might have some subtle difference from July.  I
attach the current PDF for reference.)

Could you please take a look and try to find a way to recover
preview-latex functionality?

Best regards,
Ikumi Keita

/home/keita/gs/bin/gs -dOutputFile\=\(bbb.prv/tmp0UabeI/pr1-1.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r108.606x108.587 -dDELAYBIND
GS>{<</PermitFileReading[(bbb.pdf)(bbb.prv/tmp0UabeI/preview.dsc)]>> setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped pop/.preview-BP currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne or{.preview-BP gsave 1 1 0.878431 setrgbcolor clippath fill grestore }{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{/.preview-ST[count 4 roll save]def dup length 0 eq{pop}{setpagedevice}{ifelse exec}stopped{handleerror quit}if .preview-ST aload pop restore}bind def  (bbb.prv/tmp0UabeI/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 407()/SubFileDecode filter cvx exec .preview-ST dup dup 407 setfileposition 51()/SubFileDecode filter cvx<<>>preview-do
Error: /invalidfileaccess in --file--
Operand stack:
   (bbb.prv/tmp0UabeI/preview.dsc)   (r)
Execution stack:
   %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
Dictionary stack:
   --dict:1175/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--
Current allocation mode is local
Last OS error: Permission denied
Current file position is 606
GS<2>

[bbb.pdf (application/pdf, attachment)]

Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Sun, 13 Oct 2019 19:06:02 GMT) Full text and rfc822 format available.

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

From: Dylan Thurston <dpt <at> bostoncoop.net>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: 37719 <at> debbugs.gnu.org
Subject: Re: bug#37719: 11.91; preview-latex not working (again?)
Date: Sun, 13 Oct 2019 14:49:17 -0400
On Mon, Oct 14, 2019 at 02:34:03AM +0900, Ikumi Keita wrote:
> Hi Dylan,
> 
> >>>>> Dylan Thurston <dpt <at> bostoncoop.net> writes:
> > Preview-latex is still not working; the error message (on the same
> > minimal file) is now as follows:
> 
> Thank you for a valuable report.  It seems that the Ghostscript
> developers injected some change incompatible with preview-latex into gs
> source, and that change was incorporated into the ghostscript binary
> distribution of your package manager (Debian?).  I tried both gs 9.28
> RC4 and the latest git repository, and ended up with the same result of
> yours: ...

I can confirm that I was using Debian, and version 9.28~~rc4~dfsg-1 of
ghostscript.

I can also tell you that ghostscript version 9.27~dfsg-3.1 (the last
9.27 Debian version) worked without problems, and 9.28~~rc1~dfsg-1
exhibits apparently the same error.

--Dylan




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Mon, 14 Oct 2019 08:01:02 GMT) Full text and rfc822 format available.

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

From: Chris Liddell <chris.liddell <at> artifex.com>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>, gs-devel <at> ghostscript.com
Cc: 37719 <at> debbugs.gnu.org
Subject: Re: [gs-devel] Recent ghostscript broke preview-latex again
Date: Mon, 14 Oct 2019 08:27:35 +0100
This is almost certainly down to the fact that, for improved security,
the file access controls (PermitFileReading etc) are no longer stored as
Postscript objects - that is, they are not user parameters any more.

Before you call .locksafe, adding something like:

systemdict /.addcontrolpath known
{
  /PermitFileReading (bbb.pdf) .addcontrolpath
  /PermitFileReading (bbb.prv/tmp0UabeI/preview.dsc) .addcontrolpath
} if

That should work, and retain functionality with 9.27 and earlier releases.

Note that any attempt to ".addcontrolpath" *after* calling .locksafe
will result in a fatal error and immediate exit from the interpreter.

Regards,

Chris


On 13/10/2019 19:15, Ikumi Keita wrote:
> Dear Ghostscript developers,
> 
> Thank you for your continuing work on developing gs.  Unfortunately, I
> have to inform you that recent gs source became not compatible with
> preview-latex again:
> https://debbugs.gnu.org/cgi/bugreport.cgi?bug=37719
> 
> I tried both gs 9.28 RC4 and fresh checkout of git repository of
> ghostpdl.  I installed each of them with
> env MAKE=gmake ./configure --prefix=$HOME/gs
> gmake
> gmake install
> and set up the relavant path for this temporal installation, on FreeBSD
> 12.0 living in vmware on windows 10 home edition.  Then the invocation
> of gs failed with a message quoted at the last of this message.
> 
> At the time of previous correspondence between us in this July,
> preview-latex did work with gs 9.27 with patches suggested in
> https://ghostscript.com/pipermail/gs-devel/2019-July/010161.html
> applied, but it no longer does.  (By the way, the LaTeX developer
> released new LaTeX this October, so the internal of the PDF file
> produced by pdflatex might have some subtle difference from July.  I
> attach the current PDF for reference.)
> 
> Could you please take a look and try to find a way to recover
> preview-latex functionality?
> 
> Best regards,
> Ikumi Keita
> 
> /home/keita/gs/bin/gs -dOutputFile\=\(bbb.prv/tmp0UabeI/pr1-1.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r108.606x108.587 -dDELAYBIND
> GS>{<</PermitFileReading[(bbb.pdf)(bbb.prv/tmp0UabeI/preview.dsc)]>> setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped pop/.preview-BP currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne or{.preview-BP gsave 1 1 0.878431 setrgbcolor clippath fill grestore }{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{/.preview-ST[count 4 roll save]def dup length 0 eq{pop}{setpagedevice}{ifelse exec}stopped{handleerror quit}if .preview-ST aload pop restore}bind def  (bbb.prv/tmp0UabeI/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 407()/SubFileDecode filter cvx exec .preview-ST dup dup 407 setfileposition 51()/SubFileDecode filter cvx<<>>preview-do
> Error: /invalidfileaccess in --file--
> Operand stack:
>    (bbb.prv/tmp0UabeI/preview.dsc)   (r)
> Execution stack:
>    %interp_exit   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--   --nostringval--   %loop_continue   --nostringval--   --nostringval--   false   1   %stopped_push   .runexec2   --nostringval--   --nostringval--   --nostringval--   2   %stopped_push   --nostringval--
> Dictionary stack:
>    --dict:1175/1684(ro)(G)--   --dict:0/20(G)--   --dict:78/200(L)--
> Current allocation mode is local
> Last OS error: Permission denied
> Current file position is 606
> GS<2>
> 




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Mon, 14 Oct 2019 11:41:02 GMT) Full text and rfc822 format available.

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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Chris Liddell <chris.liddell <at> artifex.com>
Cc: gs-devel <at> ghostscript.com, 37719 <at> debbugs.gnu.org
Subject: Re: [gs-devel] Recent ghostscript broke preview-latex again
Date: Mon, 14 Oct 2019 20:40:53 +0900
Hi Chris,

>>>>> Chris Liddell <chris.liddell <at> artifex.com> writes:
> Before you call .locksafe, adding something like:

> systemdict /.addcontrolpath known
> {
>   /PermitFileReading (bbb.pdf) .addcontrolpath
>   /PermitFileReading (bbb.prv/tmp0UabeI/preview.dsc) .addcontrolpath
> } if

Thank you, this improves the situation.  However, preview-latex still
does not work.  Ghostscript does not produce PNG files we expect and
sometimes raises errors.  I quote a sample error at the last of this
message.

I have an impression that gs fails to write out PNG files at specified
paths due to restricted permission about file operation.

Regards,
Ikumi Keita

/home/keita/gs/bin/gs -dOutputFile\=\(bbb.prv/tmp821SQO/pr1-2.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r108.606x108.587
GS>systemdict /.addcontrolpath known {
  /PermitFileReading (bbb.pdf) .addcontrolpath
  /PermitFileReading (bbb.prv/tmp821SQO/preview.dsc) .addcontrolpath
} if
{<</PermitFileReading[(bbb.pdf)(bbb.prv/tmp821SQO/preview.dsc)]>> setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped pop/.preview-BP currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne or{.preview-BP gsave 1 1 0.878431 setrgbcolor clippath fill grestore }{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{/.preview-ST[count 4 roll save]def dup length 0 eq{pop}{setpagedevice}{ifelse exec}stopped{handleerror quit}if .preview-ST aload pop restore}bind def  (bbb.prv/tmp821SQO/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 499()/SubFileDecode filter cvx exec .preview-ST dup dup 550 setfileposition 52()/SubFileDecode filter cvx<<>>preview-do

 **** WARNING: .lockfileaccess or .setsafe called ****
 **** when file access controls are already active ****
GPL Ghostscript GIT PRERELEASE 9.29: **** Could not open the file 'bbb.prv/tmp821SQO/pr1-1.png'.
Error: /invalidfileaccess in --showpage--
Operand stack:
   1   true
Execution stack:
   %interp_exit   .runexec2   --nostringval--   showpage   --nostringval--   2   %stopped_push   --nostringval--   showpage   %loop_continue   showpage   showpage   false   1   %stopped_push   .runexec2   --nostringval--   showpage   --nostringval--   2   %stopped_push   --nostringval--   showpage   false   1   %stopped_push   --nostringval--   showpage   4   1   3   showpage   %for_pos_int_continue   1965   1   7   %oparray_pop   showpage   showpage   1824   0   9   %oparray_pop   showpage   showpage
Dictionary stack:
   --dict:731/1123(ro)(G)--   --dict:1/20(G)--   --dict:84/200(L)--   --dict:84/200(L)--   --dict:135/256(ro)(G)--   --dict:315/325(ro)(G)--   --dict:33/64(L)--   --dict:6/9(L)--   --dict:6/20(L)--
Current allocation mode is local
Last OS error: Permission denied





Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Mon, 14 Oct 2019 14:42:02 GMT) Full text and rfc822 format available.

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

From: Chris Liddell <chris.liddell <at> artifex.com>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: gs-devel <at> ghostscript.com, 37719 <at> debbugs.gnu.org
Subject: Re: [gs-devel] Recent ghostscript broke preview-latex again
Date: Mon, 14 Oct 2019 15:41:35 +0100
On 14/10/2019 12:40, Ikumi Keita wrote:
> Hi Chris,
> 
>>>>>> Chris Liddell <chris.liddell <at> artifex.com> writes:
>> Before you call .locksafe, adding something like:
> 
>> systemdict /.addcontrolpath known
>> {
>>   /PermitFileReading (bbb.pdf) .addcontrolpath
>>   /PermitFileReading (bbb.prv/tmp0UabeI/preview.dsc) .addcontrolpath
>> } if
> 
> Thank you, this improves the situation.  However, preview-latex still
> does not work.  Ghostscript does not produce PNG files we expect and
> sometimes raises errors.  I quote a sample error at the last of this
> message.
> 
> I have an impression that gs fails to write out PNG files at specified
> paths due to restricted permission about file operation.
> 
> Regards,
> Ikumi Keita
> 
> /home/keita/gs/bin/gs -dOutputFile\=\(bbb.prv/tmp821SQO/pr1-2.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r108.606x108.587
> GS>systemdict /.addcontrolpath known {
>   /PermitFileReading (bbb.pdf) .addcontrolpath
>   /PermitFileReading (bbb.prv/tmp821SQO/preview.dsc) .addcontrolpath
> } if
> {<</PermitFileReading[(bbb.pdf)(bbb.prv/tmp821SQO/preview.dsc)]>> setuserparams .locksafe} stopped pop {DELAYSAFER{.setsafe}if}stopped pop/.preview-BP currentpagedevice/BeginPage get dup null eq{pop{pop}bind}if def<</BeginPage{currentpagedevice/PageSize get dup 0 get 1 ne exch 1 get 1 ne or{.preview-BP gsave 1 1 0.878431 setrgbcolor clippath fill grestore }{pop}ifelse}bind/PageSize[1 1]>>setpagedevice/preview-do{/.preview-ST[count 4 roll save]def dup length 0 eq{pop}{setpagedevice}{ifelse exec}stopped{handleerror quit}if .preview-ST aload pop restore}bind def  (bbb.prv/tmp821SQO/preview.dsc)(r)file /.preview-ST 1 index def dup 0 setfileposition 499()/SubFileDecode filter cvx exec .preview-ST dup dup 550 setfileposition 52()/SubFileDecode filter cvx<<>>preview-do
> 
>  **** WARNING: .lockfileaccess or .setsafe called ****
>  **** when file access controls are already active ****
> GPL Ghostscript GIT PRERELEASE 9.29: **** Could not open the file 'bbb.prv/tmp821SQO/pr1-1.png'.
> Error: /invalidfileaccess in --showpage--
> Operand stack:
>    1   true
> Execution stack:
>    %interp_exit   .runexec2   --nostringval--   showpage   --nostringval--   2   %stopped_push   --nostringval--   showpage   %loop_continue   showpage   showpage   false   1   %stopped_push   .runexec2   --nostringval--   showpage   --nostringval--   2   %stopped_push   --nostringval--   showpage   false   1   %stopped_push   --nostringval--   showpage   4   1   3   showpage   %for_pos_int_continue   1965   1   7   %oparray_pop   showpage   showpage   1824   0   9   %oparray_pop   showpage   showpage
> Dictionary stack:
>    --dict:731/1123(ro)(G)--   --dict:1/20(G)--   --dict:84/200(L)--   --dict:84/200(L)--   --dict:135/256(ro)(G)--   --dict:315/325(ro)(G)--   --dict:33/64(L)--   --dict:6/9(L)--   --dict:6/20(L)--
> Current allocation mode is local
> Last OS error: Permission denied

The warning is benign, although it does indicate that you can calling
.setsafe when SAFER is already active.


But there are some things that are confusing.

First, on your command line, your output file is in parentheses, but the
file name in the error message does not have parentheses. Secondly, the
file name on your command line is "bbb.prv/tmp821SQO/pr1-2.png" but the
one in the error is "bbb.prv/tmp821SQO/pr1-1.png". So, clearly not the
same file.

The revised file access controls includes control over output files, so
it is important the file names match, in these circumstances.


If you are changing the output file name dynamically, from the one on
the command line, you could add the output directory to the permitted
write directories:

systemdict /.addcontrolpath known
{
  /PermitFileReading (bbb.pdf) .addcontrolpath
  /PermitFileReading (bbb.prv/tmp0UabeI/preview.dsc) .addcontrolpath
  /PermitFileWriting (bbb.prv/tmp821SQO/) .addcontrolpath
} if

(Note the trailing '/' on the writable path.

This can also be done on the command line:
--permit-file-write="bbb.prv/tmp821SQO/"



Chris







Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Mon, 14 Oct 2019 16:49:02 GMT) Full text and rfc822 format available.

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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Chris Liddell <chris.liddell <at> artifex.com>
Cc: gs-devel <at> ghostscript.com, 37719 <at> debbugs.gnu.org
Subject: Re: [gs-devel] Recent ghostscript broke preview-latex again
Date: Tue, 15 Oct 2019 01:48:52 +0900
Hi Chris,

>>>>> Chris Liddell <chris.liddell <at> artifex.com> writes:
> If you are changing the output file name dynamically, from the one on
> the command line, you could add the output directory to the permitted
> write directories:

> systemdict /.addcontrolpath known
> {
>   /PermitFileReading (bbb.pdf) .addcontrolpath
>   /PermitFileReading (bbb.prv/tmp0UabeI/preview.dsc) .addcontrolpath
>   /PermitFileWriting (bbb.prv/tmp821SQO/) .addcontrolpath
> } if

> (Note the trailing '/' on the writable path.

Thank you very much, this basically sorts out things fine!

>> **** WARNING: .lockfileaccess or .setsafe called ****
>> **** when file access controls are already active ****

> The warning is benign, although it does indicate that you can calling
> .setsafe when SAFER is already active.

This warning is problematic for preview-latex because preview-latex
regards it as an error and does not pick up the associated image file
into emacs buffer.  So I changed an element in the initial command
string given to ghostscript from
{DELAYSAFER{.setsafe}if}
to just
{}
in order to suppress the warning.  This worked for me.  However, I'm
just doing try&error method and I cannot tell whether this change leads
to security hole for earlier version of ghostscript.  Can you tell about
it?

> This can also be done on the command line:
> --permit-file-write="bbb.prv/tmp821SQO/"

A brief survey shows that this command line option does not exist in
Use.html of gs 9.27.  So I suppose we should refrain from using it in
preview-latex for compatibility with earlier gs.

> But there are some things that are confusing.

> First, on your command line, your output file is in parentheses, but the
> file name in the error message does not have parentheses.

I'm not sure what those parentheses are for.  Maybe those are "quotes"
for PS language and "consumed" by ghostscript?

> Secondly, the file name on your command line is
> "bbb.prv/tmp821SQO/pr1-2.png" but the one in the error is
> "bbb.prv/tmp821SQO/pr1-1.png". So, clearly not the same file.

Agreed.  In general, preview-latex needs multiple image files for
multiple math formulae in the latex document.  As far as I understand,
preview-latex invokes gs only once for those image files and gives input
to its prompt "GS>" to produce one image file, and waits the next prompt
to come up, and gives another input to it to produce another image
file,... and repeats similar cycle until all image files are generated.

So I think that the error message for "...pr1-1.png" was injected just
after preview-latex gave input for "..pr1-2.png", and those were
recorded in the emacs buffer for inter-process communication in that
order.

Best regards,
Ikumi Keita




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Mon, 14 Oct 2019 17:51:02 GMT) Full text and rfc822 format available.

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

From: Chris Liddell <chris.liddell <at> artifex.com>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: gs-devel <at> ghostscript.com, 37719 <at> debbugs.gnu.org
Subject: Re: [gs-devel] Recent ghostscript broke preview-latex again
Date: Mon, 14 Oct 2019 18:49:57 +0100
Hi Ikumi,

On 14/10/2019 17:48, Ikumi Keita wrote:
> Hi Chris,
> 
>>>>>> Chris Liddell <chris.liddell <at> artifex.com> writes:
>> If you are changing the output file name dynamically, from the one on
>> the command line, you could add the output directory to the permitted
>> write directories:
> 
>> systemdict /.addcontrolpath known
>> {
>>   /PermitFileReading (bbb.pdf) .addcontrolpath
>>   /PermitFileReading (bbb.prv/tmp0UabeI/preview.dsc) .addcontrolpath
>>   /PermitFileWriting (bbb.prv/tmp821SQO/) .addcontrolpath
>> } if
> 
>> (Note the trailing '/' on the writable path.
> 
> Thank you very much, this basically sorts out things fine!

So, just so you know what's going on: the trailing '/' means you are
allowing Ghostscript to write to any file name in that directory, but
*only* that directory. If you wanted to allow Ghostscript to write to
any file in that directory, or subdirectory, you could use:

/PermitFileWriting (bbb.prv/tmp821SQO/*) .addcontrolpath


>>> **** WARNING: .lockfileaccess or .setsafe called ****
>>> **** when file access controls are already active ****
> 
>> The warning is benign, although it does indicate that you can calling
>> .setsafe when SAFER is already active.
> 
> This warning is problematic for preview-latex because preview-latex
> regards it as an error and does not pick up the associated image file
> into emacs buffer.  So I changed an element in the initial command
> string given to ghostscript from
> {DELAYSAFER{.setsafe}if}
> to just
> {}
> in order to suppress the warning.  This worked for me.  However, I'm
> just doing try&error method and I cannot tell whether this change leads
> to security hole for earlier version of ghostscript.  Can you tell about
> it?

Well, I suppose we shouldn't get into a warning is a warning, not an
error, and generally should not be treated as an error.....

The warning was added at the request of a user doing similar sorts of
thing to you: he didn't realise that the way his code was working meant
.setsafe was being called multiple times.

Anyway, have it work safely, you'll want something like:

{
  DELAYSAFER
  {
    systemdict /.currentpathcontrolstate known
    {
        .currentpathcontrolstate not
        {
          .setsafe
        } if
    }
    {
      .setsafe
    } ifelse
  } if
}

But, I'm going to make that warning honour the -dQUIET/-q parameter, so
you won't have to worry about that. I'll push the commit tomorrow
morning, and it'll be in the pending release.

>> This can also be done on the command line:
>> --permit-file-write="bbb.prv/tmp821SQO/"
> 
> A brief survey shows that this command line option does not exist in
> Use.html of gs 9.27.  So I suppose we should refrain from using it in
> preview-latex for compatibility with earlier gs.

Yes, and given your workflow, there's no advantage to using the command
line, I only mentioned as information.

>> But there are some things that are confusing.
> 
>> First, on your command line, your output file is in parentheses, but the
>> file name in the error message does not have parentheses.
> 
> I'm not sure what those parentheses are for.  Maybe those are "quotes"
> for PS language and "consumed" by ghostscript?
> 
>> Secondly, the file name on your command line is
>> "bbb.prv/tmp821SQO/pr1-2.png" but the one in the error is
>> "bbb.prv/tmp821SQO/pr1-1.png". So, clearly not the same file.
> 
> Agreed.  In general, preview-latex needs multiple image files for
> multiple math formulae in the latex document.  As far as I understand,
> preview-latex invokes gs only once for those image files and gives input
> to its prompt "GS>" to produce one image file, and waits the next prompt
> to come up, and gives another input to it to produce another image
> file,... and repeats similar cycle until all image files are generated.
> 
> So I think that the error message for "...pr1-1.png" was injected just
> after preview-latex gave input for "..pr1-2.png", and those were
> recorded in the emacs buffer for inter-process communication in that
> order.

OKay, that's not how I think I'd have done it, but it makes sense of
what you're seeing.

So, a big, important thing to realise about the new file access controls
we've implemented: they cannot be deactivated (even with a
save/restore). That *is* a departure from the previous implementation,
but we really had no choice. On the other hand, by allowing you to setup
a writable directory, there is no need to deactivate the controls.

Chris




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Tue, 15 Oct 2019 07:20:02 GMT) Full text and rfc822 format available.

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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Chris Liddell <chris.liddell <at> artifex.com>
Cc: gs-devel <at> ghostscript.com, 37719 <at> debbugs.gnu.org
Subject: Re: [gs-devel] Recent ghostscript broke preview-latex again
Date: Tue, 15 Oct 2019 16:18:52 +0900
Hi Chris,

>>>>> Chris Liddell <chris.liddell <at> artifex.com> writes:

> But, I'm going to make that warning honour the -dQUIET/-q parameter, so
> you won't have to worry about that. I'll push the commit tomorrow
> morning, and it'll be in the pending release.

Thanks, we appreciate your kindness.

>>> But there are some things that are confusing.
>> 
>>> First, on your command line, your output file is in parentheses, but the
>>> file name in the error message does not have parentheses.
>> 
>> I'm not sure what those parentheses are for.  Maybe those are "quotes"
>> for PS language and "consumed" by ghostscript?
>> 
>>> Secondly, the file name on your command line is
>>> "bbb.prv/tmp821SQO/pr1-2.png" but the one in the error is
>>> "bbb.prv/tmp821SQO/pr1-1.png". So, clearly not the same file.
>> 
>> Agreed.  In general, preview-latex needs multiple image files for
>> multiple math formulae in the latex document.  As far as I understand,
>> preview-latex invokes gs only once for those image files and gives input
>> to its prompt "GS>" to produce one image file, and waits the next prompt
>> to come up, and gives another input to it to produce another image
>> file,... and repeats similar cycle until all image files are generated.
>> 
>> So I think that the error message for "...pr1-1.png" was injected just
>> after preview-latex gave input for "..pr1-2.png", and those were
>> recorded in the emacs buffer for inter-process communication in that
>> order.

> OKay, that's not how I think I'd have done it, but it makes sense of
> what you're seeing.

I have to apologize for having failed to tell you correctly the
invocation string of ghostscript.  The debug facility of preview-latex
didn't record literally how it invoked gs and I didn't notice that.
Preview-latex actually called gs as

/home/keita/gs/bin/gs -dOutputFile\=\(bbb.prv/tmp0UabeI/pr1-\%d.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r108.606x108.587 -dDELAYBIND

.  The parameter for -dOutputFile contains "%d", not a constant number.

Triggered by this discovery, I managed to tame preview-latex to work
without /PermitFileWriting.  After reading portion of Use.html, I
understood the true origin of the error:
(1) OutputFile parameter is given with "-d" option rather than "-s".
    This is the reason why the output file name is surrounded by
    parentheses.
(2) Ghostscript>9.27 disables "%d" specification in OutputFile
    parameter if it is given with "-d" option.  I observe that gs 9.27
    finishes without any problems while gs>9.27 does not:
> gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pgmraw -r150 \
            -dTextAlphaBits=4 -dOutputFile='(sample-%00d.pgm)' sample.ps
GPL Ghostscript 9.27 (2019-04-04)
Copyright (C) 2018 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
> ~/gs/bin/gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pgmraw -r150 \
            -dTextAlphaBits=4 -dOutputFile='(sample-%00d.pgm)' sample.ps
GPL Ghostscript GIT PRERELEASE 9.29 (2019-08-15)
Copyright (C) 2019 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
GPL Ghostscript GIT PRERELEASE 9.29: **** Could not open the file 'sample-1.pgm'.
Error: /invalidfileaccess in --showpage--
Operand stack:
   1   true
Execution stack:
   %interp_exit   .runexec2   --nostringval--   showpage   --nostringval--   2   %stopped_push   --nostringval--   showpage   showpage   false   1   %stopped_pu
sh   1974   1   3   %oparray_pop   1973   1   3   %oparray_pop   1961   1   3   %oparray_pop   1817   1   3   %oparray_pop   --nostringval--   %errorexec_pop   .runexec2   --nostringval--   showpage   --nostringval--   2   %stopped_push   --nostringval--   1824   0   4   %oparray_pop   showpage   showpage
Dictionary stack:
   --dict:727/1123(ro)(G)--   --dict:1/20(G)--   --dict:85/200(L)--   --dict:179/300(L)--
Current allocation mode is local
Last OS error: Permission denied
Current file position is 119708
GPL Ghostscript GIT PRERELEASE 9.29: Unrecoverable error, exit code 1

    (These command line string are taken from an example in Use.html and
     I don't understand most of them.)

(3) The "%d" specification in OutputFile parameter is valid if given
    with "-s" option, even with gs>9.27:
> ~/gs/bin/gs -dSAFER -dBATCH -dNOPAUSE -sDEVICE=pgmraw -r150 \
            -dTextAlphaBits=4 -sOutputFile='sample-%00d.pgm' sample.ps
GPL Ghostscript GIT PRERELEASE 9.29 (2019-08-15)
Copyright (C) 2019 Artifex Software, Inc.  All rights reserved.
This software is supplied under the GNU AGPLv3 and comes with NO WARRANTY:
see the file COPYING for details.
(It finishes without any problems.)

(4) So I changed preview-latex to use "-s" option instead of "-d" for
    OutputFile parameter and to remove parentheses around the file name
    containing "%d".  With this change, I confirmed that
    /PermitFileWriting is no longer necessary.

Regards,
Ikumi Keita




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Tue, 15 Oct 2019 11:12:01 GMT) Full text and rfc822 format available.

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

From: Chris Liddell <chris.liddell <at> artifex.com>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: gs-devel <at> ghostscript.com, 37719 <at> debbugs.gnu.org
Subject: Re: [gs-devel] Recent ghostscript broke preview-latex again
Date: Tue, 15 Oct 2019 12:11:41 +0100

On 15/10/2019 08:18, Ikumi Keita wrote:
> Hi Chris,
> 
>>>>>> Chris Liddell <chris.liddell <at> artifex.com> writes:
> 
<SNIP>
> I have to apologize for having failed to tell you correctly the
> invocation string of ghostscript.  The debug facility of preview-latex
> didn't record literally how it invoked gs and I didn't notice that.
> Preview-latex actually called gs as
> 
> /home/keita/gs/bin/gs -dOutputFile\=\(bbb.prv/tmp0UabeI/pr1-\%d.png\) -q -dDELAYSAFER -dNOPAUSE -DNOPLATFONTS -dPrinted -dTextAlphaBits\=4 -dGraphicsAlphaBits\=4 -sDEVICE\=png16m -r108.606x108.587 -dDELAYBIND
> 
> .  The parameter for -dOutputFile contains "%d", not a constant number.

I'm slightly stunned that using -d worked at all, ever. It certainly
wouldn't work as expected.

Anyway, I'm relieved you got to the bottom of it.

I know I've been saying this a lot, but I'm sorry for the upheaval
that's been going on, and I hope everyone understands that we wouldn't
be doing all this if we weren't sure of the necessity.

And I really appreciate you (and others) sticking with us to work
through these issues.

Regards,

Chris




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Tue, 15 Oct 2019 12:09:02 GMT) Full text and rfc822 format available.

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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Dylan Thurston <dpt <at> bostoncoop.net>
Cc: gs-devel <at> ghostscript.com, 37719 <at> debbugs.gnu.org
Subject: Re: bug#37719: 11.91; preview-latex not working (again?)
Date: Tue, 15 Oct 2019 21:08:54 +0900
Hi Dylan,

>>>>> Dylan Thurston <dpt <at> bostoncoop.net> writes:
> I can confirm that I was using Debian, and version 9.28~~rc4~dfsg-1 of
> ghostscript.

I've just pushed fix for this trouble into the git repository.
Unfortunately, it doesn't work with gs 9.28RC because of a warning it
emits.  Only the latest development version of ghostscript suppresses it
under preview-latex.
Use gs 9.27 until Debian distributes gs binary with the latest change
incorporated, or use gs 9.28RC while you edit preview.el in AUCTeX so
that "{DELAYSAFER{.setsafe}if}" is turned into "{}" in the function
`preview-gs-open' (and, of course, byte-compile it).

I thank Chris Liddell for his valuable advices for using ghostscript
under preview-latex.

Regards,
Ikumi Keita




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Wed, 16 Oct 2019 13:46:01 GMT) Full text and rfc822 format available.

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

From: Dylan Thurston <dpt <at> bostoncoop.net>
To: Ikumi Keita <ikumi <at> ikumi.que.jp>
Cc: gs-devel <at> ghostscript.com, 37719 <at> debbugs.gnu.org
Subject: Re: bug#37719: 11.91; preview-latex not working (again?)
Date: Wed, 16 Oct 2019 09:44:50 -0400
On Tue, Oct 15, 2019 at 09:08:54PM +0900, Ikumi Keita wrote:
> Hi Dylan,
> 
> >>>>> Dylan Thurston <dpt <at> bostoncoop.net> writes:
> > I can confirm that I was using Debian, and version 9.28~~rc4~dfsg-1 of
> > ghostscript.
> 
> I've just pushed fix for this trouble into the git repository.
> Unfortunately, it doesn't work with gs 9.28RC because of a warning it
> emits.  Only the latest development version of ghostscript suppresses it
> under preview-latex.
> Use gs 9.27 until Debian distributes gs binary with the latest change
> incorporated, or use gs 9.28RC while you edit preview.el in AUCTeX so
> that "{DELAYSAFER{.setsafe}if}" is turned into "{}" in the function
> `preview-gs-open' (and, of course, byte-compile it).
> 
> I thank Chris Liddell for his valuable advices for using ghostscript
> under preview-latex.

Thank you for the quick fix! I will check it out when gs gets updated
(hopefully not very long). I note that Debian unstable just yesterday
upgraded to version 9.50, which was released Sept. 30; I assume that
is not recent enough?

--Dylan




Information forwarded to bug-auctex <at> gnu.org:
bug#37719; Package auctex. (Wed, 16 Oct 2019 14:09:01 GMT) Full text and rfc822 format available.

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

From: Ikumi Keita <ikumi <at> ikumi.que.jp>
To: Dylan Thurston <dpt <at> bostoncoop.net>
Cc: gs-devel <at> ghostscript.com, 37719 <at> debbugs.gnu.org
Subject: Re: bug#37719: 11.91; preview-latex not working (again?)
Date: Wed, 16 Oct 2019 23:07:59 +0900
Hi Dylan,

>>>>> Dylan Thurston <dpt <at> bostoncoop.net> writes:
>> I've just pushed fix for this trouble into the git repository.
>> Unfortunately, it doesn't work with gs 9.28RC because of a warning it
>> emits.  Only the latest development version of ghostscript suppresses it
>> under preview-latex.

> Thank you for the quick fix! I will check it out when gs gets updated
> (hopefully not very long). I note that Debian unstable just yesterday
> upgraded to version 9.50, which was released Sept. 30; I assume that
> is not recent enough?

That's recent enough so you can use it with the latest AUCTeX in git
repo.  Ghostscript 9.50 was actually released just yesterday.  I suppose
it was planned to be released on Sept. 30 but delayed until yesterday.

Bye,
Ikumi Keita




Added tag(s) fixed. Request was from Ikumi Keita <ikumi <at> ikumi.que.jp> to control <at> debbugs.gnu.org. (Fri, 06 Dec 2019 15:12:02 GMT) Full text and rfc822 format available.

bug closed, send any further explanations to 37719 <at> debbugs.gnu.org and Dylan Thurston <dpt <at> bostoncoop.net> Request was from Ikumi Keita <ikumi <at> ikumi.que.jp> to control <at> debbugs.gnu.org. (Fri, 06 Dec 2019 15:12: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. (Sat, 04 Jan 2020 12:24:04 GMT) Full text and rfc822 format available.

This bug report was last modified 4 years and 84 days ago.

Previous Next


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