wingo pushed a commit to branch stable-2.0
in repository guile.
commit dde0d17f8ea1446b737db1fa20d5bc8a5b50ea5d
Author: Andy Wingo <[email protected]>
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 c522b74..e8a8fd9 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