Fix over-protection of byte-compiled files
Problem reported by Sven Joachim (Bug#28244). Also, fix similar problem for autoload files. * lisp/emacs-lisp/autoload.el (autoload--save-buffer): Set temp file modes to the buffer-file-name file modes (or 666 if not available) as adjusted by umask. * lisp/emacs-lisp/bytecomp.el (byte-compile-file): Set temp file modes to 666 as adjusted by umask.
This commit is contained in:
parent
1be689fbc4
commit
231bfd6818
2 changed files with 12 additions and 1 deletions
|
@ -873,12 +873,18 @@ FILE's modification time."
|
|||
;; For parallel builds, to stop another process reading a half-written file.
|
||||
(defun autoload--save-buffer ()
|
||||
"Save current buffer to its file, atomically."
|
||||
;; Copied from byte-compile-file.
|
||||
;; Similar to byte-compile-file.
|
||||
(let* ((version-control 'never)
|
||||
(tempfile (make-temp-file buffer-file-name))
|
||||
(default-modes (default-file-modes))
|
||||
(temp-modes (logand default-modes #o600))
|
||||
(desired-modes (logand default-modes
|
||||
(or (file-modes buffer-file-name) #o666)))
|
||||
(kill-emacs-hook
|
||||
(cons (lambda () (ignore-errors (delete-file tempfile)))
|
||||
kill-emacs-hook)))
|
||||
(unless (= temp-modes desired-modes)
|
||||
(set-file-modes tempfile desired-modes))
|
||||
(write-region (point-min) (point-max) tempfile nil 1)
|
||||
(backup-buffer)
|
||||
(rename-file tempfile buffer-file-name t))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue