wingo pushed a commit to branch master
in repository guile.

commit 1f6a8f2a6e35b1cce564b756ac2c2a3f77e98639
Author: Andy Wingo <wi...@pobox.com>
Date:   Tue Jun 21 17:51:07 2016 +0200

    Use source file permissions for compiled files
    
    * module/system/base/compile.scm (call-with-output-file/atomic): Use the
      permissions of the source file, if available, as the permissions of
      the compiled file.  Fixes #18477.
---
 module/system/base/compile.scm |    4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/module/system/base/compile.scm b/module/system/base/compile.scm
index d6a53d6..dfe03fd 100644
--- a/module/system/base/compile.scm
+++ b/module/system/base/compile.scm
@@ -59,7 +59,9 @@
            (proc tmp)
            ;; Chmodding by name instead of by port allows this chmod to
            ;; work on systems without fchmod, like MinGW.
-           (chmod template (logand #o0666 (lognot (umask))))
+           (let ((perms (or (false-if-exception (stat:perms (stat reference)))
+                            (lognot (umask)))))
+             (chmod template (logand #o0666 perms)))
            (close-port tmp)
            (rename-file template filename))
          (lambda args

Reply via email to