[Top][All Lists]

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

Re: gs -dNOSAFER / windows

From: David Kastrup
Subject: Re: gs -dNOSAFER / windows
Date: Wed, 30 May 2018 11:49:00 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.50 (gnu/linux)

Knut Petersen <address@hidden> writes:

> Hi everybody!
> Could someone please explain why we use ghostscript in  -dNOSAFER
> mode if the windows platform is used?
>    (define-public (postscript->pdf paper-width paper-height
>                                     base-name tmp-name is-eps)
>       (let* ((pdf-name (string-append base-name ".pdf"))
>              (*unspecified* (if #f #f))
>              (cmd
>               (remove (lambda (x) (eq? x *unspecified*))
>                       (list
>                        (search-gs)
>                        (if (ly:get-option 'verbose) *unspecified* "-q")
>                        (if (or (ly:get-option 'gs-load-fonts)
>                                (ly:get-option 'gs-load-lily-fonts)
>                                (eq? PLATFORM 'windows))
>                            "-dNOSAFER"
>                            "-dSAFER")
> Doesn't that mean that -dsafe is totaly broken on windows as it prevents
> exploiting scheme but allows to use ghostscript as an unfriendly tool?!

Commit 11d5b22d4eb refactored the code badly: before that commit,
Windows was called without -dSAFER option, afterwards it was called with
explicit -dNOSAFER option.

The original introduction was in

    commit 6a90fc4934c0c7ce8f2ac1bef7de3ec447ede3e2
    Author: Jan Nieuwenhuizen <address@hidden>
    Date:   Mon May 23 19:18:58 2005 +0000

        * lily/ (setup_paths)[__MINGW32__]: Normalize LILYPONDPREFIX.

        * lily/ (ly:stderr-redirect): Rename from
        ly:port-move.  Needs to be stderr-specific on mingw.
        Run fixcc.

        * lily/ (ly:port-move): Remove.

        * scm/backend-library.scm (postscript->pdf): Remove -dSAFER in

        * lily/ (setup_paths) [ARGV0_RELOCATION]: Reinstate GS_*
        variables.  This eliminates the need for a gs.bat wrapper, which
        opens a console.

        * scripts/lilypond-invoke-editor.scm (running-from-gui?):
        * scm/lily.scm (running-from-gui?):
        * lily/[MINGW]: Remove isatty inversion, this is an
        artifact of not compiling with -mwindows.

        * scm/editor.scm: Define PLATFORM.

where it is mentioned in the commit message.  No rationale is given in
the patch itself, however it appears to be part of _another_ refactoring
(different commit, apparently the Git conversion had problems) that also
removes the following comment:

-                     ;; gs on windows with -dSAFER fails on opening a
-                     ;; file that has no group read permissions.
-                     (if (eq? PLATFORM 'windows) "" "-dSAFER")

The commit having added that comment (and apparently the ultimate source
of the code refactored a few times afterwards) seems to be:

commit d1ddb3de33c8811b914cccbafdf82549c4e76034
Author: Jan Nieuwenhuizen <address@hidden>
Date:   Sun May 15 23:44:07 2005 +0000

    * scm/lily.scm (PLATFORM): Export.
    * scm/framework-ps.scm (write-preamble)[MINGW]: Use
    load-font-via-GS, ttftool or fopencookie is broken on windows.
    * scm/backend-library.scm (postscript->pdf)[MINGW]: Do not use
    -dSAFER, that is broken on windows.

So the question is: has that apparent group read permission problem (?)
been fixed in the last 13 years?

Unless somebody has a clue, I lean towards just trying this out and
waiting for problem reports.  At least we should know more or less what
to expect now.

David Kastrup

reply via email to

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