[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Fixing parallel byte-compilation
From: |
Glenn Morris |
Subject: |
Fixing parallel byte-compilation |
Date: |
Fri, 10 Sep 2010 19:51:59 -0400 |
User-agent: |
Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) |
Parallel bootstrap sometimes fails if one Emacs process tries to read
an .elc file that another is in the middle of writing. See eg
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=4196
http://debbugs.gnu.org/cgi/bugreport.cgi?bug=6858
and recent mails on this list.
One suggested solution was to compile to a temp-file, then move it in
place. That seems simple to do...?
*** lisp/emacs-lisp/bytecomp.el 2010-09-08 16:02:38 +0000
--- lisp/emacs-lisp/bytecomp.el 2010-09-10 23:42:25 +0000
***************
*** 1698,1714 ****
(insert "\n") ; aaah, unix.
(if (file-writable-p target-file)
;; We must disable any code conversion here.
! (let ((coding-system-for-write 'no-conversion))
(if (memq system-type '(ms-dos 'windows-nt))
(setq buffer-file-type t))
! (when (file-exists-p target-file)
! ;; Remove the target before writing it, so that any
! ;; hard-links continue to point to the old file (this makes
! ;; it possible for installed files to share disk space with
! ;; the build tree, without causing problems when emacs-lisp
! ;; files in the build tree are recompiled).
! (delete-file target-file))
! (write-region (point-min) (point-max) target-file))
;; This is just to give a better error message than write-region
(signal 'file-error
(list "Opening output file"
--- 1698,1720 ----
(insert "\n") ; aaah, unix.
(if (file-writable-p target-file)
;; We must disable any code conversion here.
! (let ((coding-system-for-write 'no-conversion)
! ;; Write to a tempfile so that if another Emacs
! ;; process is trying to load target-file (eg in a
! ;; parallel bootstrap), it does not risk getting a
! ;; half-finished file. (Bug#4196)
! (tempfile (make-temp-name target-file)))
(if (memq system-type '(ms-dos 'windows-nt))
(setq buffer-file-type t))
! ;; The old code used to: delete target-file before
! ;; writing it, so that any hard-links continue to
! ;; point to the old file (this makes it possible
! ;; for installed files to share disk space with
! ;; the build tree, without causing problems when
! ;; emacs-lisp files in the build tree are
! ;; recompiled). Renaming works the same way.
! (write-region (point-min) (point-max) tempfile)
! (rename-file tempfile target-file t))
;; This is just to give a better error message than write-region
(signal 'file-error
(list "Opening output file"
- Fixing parallel byte-compilation,
Glenn Morris <=