bug-auctex
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Bug-AUCTeX] 11.86; pngs not being generated by preview-latex


From: Clark Taylor
Subject: Re: [Bug-AUCTeX] 11.86; pngs not being generated by preview-latex
Date: Wed, 13 Oct 2010 19:02:29 -0700

Plugging this patch into preview.el does cause it to work properly
with 9.00.  It also works with 8.71.

Clark

On Wed, Oct 13, 2010 at 9:46 AM, Ralf Angeli <address@hidden> wrote:
> * Clark Taylor (2010-10-13) writes:
>
>> Your patch solved the problem.  It works with gs9.00 and your patch.
>
> Thanks for testing.  Also to Stefan.
>
> Below you can find a patch which should solve the problem without
> introducing a security issue.  At least I hope.  It would be nice if
> somebody with some knowledge of Ghostscript could review it.
>
> The idea is that while Ghostscript is started with -dDELAYSAFER, SAFER
> mode is enabled as soon as reading is permitted for the required files.
> This is done with .locksafe.  The .setsafe statement in the original
> value of `preview-gs-init-string' should not be executed after that, so
> the the PermitFile... parameters should not be reset to empty arrays.  I
> kept the .setsafe for the case without fast conversion.  (All this is
> done after gs is started.  An alternative would be to do a `-dDELAYSAFER
> -c '<</PermitFileReading...' -dSAFER'.  But this clashes a bit with the
> custmizability of the `preview-gs-options'.)
>
> A propos fast conversion, I'm not sure yet if it is enough to set the
> file permissions in `preview-prepare-fast-conversion' or if this has to
> be done earlier, .e.g in `preview-gs-open'.
>
>
> --- preview.el  18 Jun 2009 19:20:46 -0000      1.284
> +++ preview.el  13 Oct 2010 16:28:42 -0000
> @@ -355,7 +355,7 @@
>   :group 'preview-gs
>   :type 'string)
>
> -(defcustom preview-gs-options '("-q" "-dSAFER" "-dNOPAUSE"
> +(defcustom preview-gs-options '("-q" "-dDELAYSAFER" "-dNOPAUSE"
>                                "-DNOPLATFONTS" "-dPrinted"
>                                "-dTextAlphaBits=4"
>                                "-dGraphicsAlphaBits=4")
> @@ -1066,14 +1066,21 @@
>
>  (defun preview-prepare-fast-conversion ()
>   "This fixes up all parameters for fast conversion."
> -  (let ((file (if (consp (car preview-ps-file))
> -                 (if (consp (caar preview-ps-file))
> -                     (car (last (caar preview-ps-file)))
> -                   (caar preview-ps-file))
> -               (car preview-ps-file))))
> +  (let* ((file (if (consp (car preview-ps-file))
> +                  (if (consp (caar preview-ps-file))
> +                      (car (last (caar preview-ps-file)))
> +                    (caar preview-ps-file))
> +                (car preview-ps-file)))
> +        (all-files (if (and (consp (car preview-ps-file))
> +                            (consp (caar preview-ps-file)))
> +                       (caar preview-ps-file)
> +                     (list file))))
>     (setq preview-gs-dsc (preview-dsc-parse file))
>     (setq preview-gs-init-string
> -         (concat preview-gs-init-string
> +         (concat (format "{<</PermitFileReading[%s]>> setuserparams \
> +.locksafe} stopped pop "
> +                         (mapconcat 'preview-ps-quote-filename all-files ""))
> +                 preview-gs-init-string
>                  (format "[%s(r)file]aload exch %s .runandhide aload pop "
>                          (preview-ps-quote-filename file)
>                          (preview-gs-dsc-cvx 0 preview-gs-dsc))))))
>
>
> --
> Ralf
>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]