bug-auctex
[Top][All Lists]
Advanced

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

bug#28811: 11.90.2.2017-07-25; preview-at-point


From: Ken Sharp
Subject: bug#28811: 11.90.2.2017-07-25; preview-at-point
Date: Sat, 04 Nov 2017 08:59:41 +0000

Hi Arash,

At 23:34 03/11/2017 +0100, Arash Esbati wrote:


--8<---------------cut here---------------start------------->8---
(defun preview-gs-open (&optional setup)
  "Start a Ghostscript conversion pass.
SETUP may contain a parser setup function."
  (let ((image-info (assq preview-image-type preview-gs-image-type-alist)))
    (setq preview-gs-image-type (nth 1 image-info))
    (setq preview-gs-sequence nil)
    (setq preview-gs-command-line (append
                   preview-gs-options
                   (nthcdr 2 image-info))
      preview-gs-init-string
      (format "{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 %s}{pop}ifelse}bind/PageSize[1 1]>>setpagedevice\
/preview-do{[count 3 roll save]3 1 roll dup length 0 eq\
{pop}{setpagedevice}{ifelse .runandhide}\
stopped{handleerror quit}if \
aload pop restore}bind def "
          (preview-gs-color-string preview-colors)))
    (preview-gs-queue-empty)
    (preview-parse-messages (or setup #'preview-gs-dvips-process-setup))))
--8<---------------cut here---------------end--------------->8---

and

--8<---------------cut here---------------start------------->8---
(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)))
    (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 (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))))))
--8<---------------cut here---------------end--------------->8---

@Ken: Sorry for the late response from AUCTeX side, and many thanks for
your offer to resolve this issue.  I'm not familiar enough with PS to
come up with an alternative code.  Do you have a suggestion?  TIA.

Well the obvious suggestion is simply 'don't use SAFER and DELAYSAFER' because then you don't need .runandhide :-)

The problem is that PostScript is a programming language, and the snippets above, intermingled with some other language, are a) difficult to read and b) shorn of context. Its hard for me to pick out just the PostScript from whatever the other language is and without knowing what the aim is its pretty much impossible to figure out what the PostScript is doing.

At a guess, it looks like the intention is to access files outside of Ghostscript's tree, while using the -dSAFER option, which bars access to such files. The obvious answer to my mind is 'don't do that', apart from anything else it seems pointless.

I don't suppose there's anyone still around who knows what the PostScript is supposed to do ? I really need to discuss this with someone who understands the intended purpose of that PostScript code.

In the absence of anyone who knows what the intended purpose of the code is, then I'd need someone to capture the entire PostScript sequence being sent to Ghostscript for the simplest possible job. I could then at least run the file and see what it does.

I would do this myself, but I'm completely unfamiliar with AucTeX so I'd be fumbling in the dark....

If you want to go down that route, then can I suggest reopening our bug 698680:

https://bugs.ghostscript.com/show_bug.cgi?id=698680

and attaching the PostScript file there (and any other files needed to make the program run).



                            Ken






reply via email to

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