Subject: Re: [gs-devel] Recent ghostscript broke preview-latex again

From: Ikumi Keita <[email-masked]>
Date: Mon, 14 Oct 2019 20:40:53 +0900

Hi Chris,

>>>>> Chris Liddell <[email-masked]> 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