diff options
| author | Glenn Morris | 2010-09-11 11:52:04 -0700 |
|---|---|---|
| committer | Glenn Morris | 2010-09-11 11:52:04 -0700 |
| commit | 0f34ae289a051cb6e92b350f984c23502ff5929f (patch) | |
| tree | d8d567000f21da0709750b5922b3ec9718345a95 | |
| parent | 7cf78aac59d289cdabcf835f1b8c4321d6e50469 (diff) | |
| download | emacs-0f34ae289a051cb6e92b350f984c23502ff5929f.tar.gz emacs-0f34ae289a051cb6e92b350f984c23502ff5929f.zip | |
Close bug#4196.
* lisp/emacs-lisp/bytecomp.el (byte-compile-file): Create .elc files
atomically, to avoid parallel build errors.
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/emacs-lisp/bytecomp.el | 25 |
2 files changed, 21 insertions, 9 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index c47a458f2f7..1088bf432c4 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-09-11 Glenn Morris <rgm@gnu.org> | ||
| 2 | |||
| 3 | * emacs-lisp/bytecomp.el (byte-compile-file): Create .elc files | ||
| 4 | atomically, to avoid parallel build errors. (Bug#4196) | ||
| 5 | |||
| 1 | 2010-09-11 Michael R. Mauger <mmaug@yahoo.com> | 6 | 2010-09-11 Michael R. Mauger <mmaug@yahoo.com> |
| 2 | 7 | ||
| 3 | * progmodes/sql.el: Version 2.6 | 8 | * progmodes/sql.el: Version 2.6 |
diff --git a/lisp/emacs-lisp/bytecomp.el b/lisp/emacs-lisp/bytecomp.el index cb1deb9a762..04bc254b319 100644 --- a/lisp/emacs-lisp/bytecomp.el +++ b/lisp/emacs-lisp/bytecomp.el | |||
| @@ -1698,17 +1698,24 @@ The value is non-nil if there were no errors, nil if errors." | |||
| 1698 | (insert "\n") ; aaah, unix. | 1698 | (insert "\n") ; aaah, unix. |
| 1699 | (if (file-writable-p target-file) | 1699 | (if (file-writable-p target-file) |
| 1700 | ;; We must disable any code conversion here. | 1700 | ;; We must disable any code conversion here. |
| 1701 | (let ((coding-system-for-write 'no-conversion)) | 1701 | (let ((coding-system-for-write 'no-conversion) |
| 1702 | ;; Write to a tempfile so that if another Emacs | ||
| 1703 | ;; process is trying to load target-file (eg in a | ||
| 1704 | ;; parallel bootstrap), it does not risk getting a | ||
| 1705 | ;; half-finished file. (Bug#4196) | ||
| 1706 | (tempfile (make-temp-name target-file))) | ||
| 1702 | (if (memq system-type '(ms-dos 'windows-nt)) | 1707 | (if (memq system-type '(ms-dos 'windows-nt)) |
| 1703 | (setq buffer-file-type t)) | 1708 | (setq buffer-file-type t)) |
| 1704 | (when (file-exists-p target-file) | 1709 | (write-region (point-min) (point-max) tempfile) |
| 1705 | ;; Remove the target before writing it, so that any | 1710 | ;; This has the intentional side effect that any |
| 1706 | ;; hard-links continue to point to the old file (this makes | 1711 | ;; hard-links to target-file continue to |
| 1707 | ;; it possible for installed files to share disk space with | 1712 | ;; point to the old file (this makes it possible |
| 1708 | ;; the build tree, without causing problems when emacs-lisp | 1713 | ;; for installed files to share disk space with |
| 1709 | ;; files in the build tree are recompiled). | 1714 | ;; the build tree, without causing problems when |
| 1710 | (delete-file target-file)) | 1715 | ;; emacs-lisp files in the build tree are |
| 1711 | (write-region (point-min) (point-max) target-file)) | 1716 | ;; recompiled). Previously this was accomplished by |
| 1717 | ;; deleting target-file before writing it. | ||
| 1718 | (rename-file tempfile target-file t)) | ||
| 1712 | ;; This is just to give a better error message than write-region | 1719 | ;; This is just to give a better error message than write-region |
| 1713 | (signal 'file-error | 1720 | (signal 'file-error |
| 1714 | (list "Opening output file" | 1721 | (list "Opening output file" |