branch: externals/auctex
commit cc52bce708a77654e1b89048cb8dce484a5e4e88
Author: Ikumi Keita <[email protected]>
Commit: Ikumi Keita <[email protected]>
Fix for revised file access controls of gs (bug#37719)
* preview.el.in (preview-prepare-fast-conversion): Add commands for
revised file access controls introduced after gs 9.27.
(preview-gs-restart): Use "-d" option instead of "-s" because the
former does not accept "%d" in OutputFile parameter.
Don't wrap the file name into parentheses in line with this change.
(preview-gs-flag-error): Adjust the reconstructed gs command line
argument so that it matches with the above change.
Add comments about limitations of this function.
---
preview.el.in | 27 +++++++++++++++++++++------
1 file changed, 21 insertions(+), 6 deletions(-)
diff --git a/preview.el.in b/preview.el.in
index 148f05b..03e1d9b 100644
--- a/preview.el.in
+++ b/preview.el.in
@@ -727,8 +727,8 @@ Gets the usual PROCESS and STRING parameters, see
(setq preview-gs-sequence (list 1)))
(setcdr preview-gs-sequence 1)
(let* ((process-connection-type nil)
- (outfile (format "-dOutputFile=%s"
- (preview-ps-quote-filename
+ (outfile (format "-sOutputFile=%s"
+ (file-relative-name
(format "%s/pr%d-%%d.%s"
(car TeX-active-tempdir)
(car preview-gs-sequence)
@@ -1165,9 +1165,16 @@ NONREL is not NIL."
(list file))))
(setq preview-gs-dsc (preview-dsc-parse file))
(setq preview-gs-init-string
- (concat (format "{<</PermitFileReading[%s]>> setuserparams \
+ ;; Add commands for revised file access controls introduced
+ ;; after gs 9.27 (bug#37719)
+ (concat (format "systemdict /.addcontrolpath known {%s} if\n"
+ (mapconcat (lambda (f)
+ (format "/PermitFileReading %s
.addcontrolpath"
+ (preview-ps-quote-filename f)))
+ all-files "\n"))
+ (format "{<</PermitFileReading[%s]>> setuserparams \
.locksafe} stopped pop "
- (mapconcat 'preview-ps-quote-filename all-files ""))
+ (mapconcat #'preview-ps-quote-filename all-files ""))
preview-gs-init-string
(format " %s(r)file /.preview-ST 1 index def %s exec
.preview-ST "
(preview-ps-quote-filename file)
@@ -1257,10 +1264,18 @@ Try \\[ps-run-start] \\[ps-run-buffer] and \
(defun preview-gs-flag-error (ov err)
"Make an eps error flag in overlay OV for ERR string."
+ ;; N.B. Although this code shows command line of gs invocation and
+ ;; error together via mouse popup menu, they are not necessarilly
+ ;; associated with each other. There is a case that the command
+ ;; line is for "[...].prv/tmpXXXXXX/pr1-2.png" while the error is
+ ;; raised for "[...].prv/tmpXXXXXX/pr1-1.png". (c.f. bug#37719)
(let* ((filenames (overlay-get ov 'filenames))
(file (car (nth 0 filenames)))
- (outfile (format "-dOutputFile=%s"
- (preview-ps-quote-filename
+ ;; FIXME: This format isn't equal to actual invocation of gs
+ ;; command constructed in `preview-gs-restart', which
+ ;; contains "%d".
+ (outfile (format "-sOutputFile=%s"
+ (file-relative-name
(car (nth 1 filenames)))))
(ps-open
`(lambda() (interactive "@")