all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Glenn Morris <rgm@gnu.org>
To: emacs-devel@gnu.org
Subject: Fixing parallel byte-compilation
Date: Fri, 10 Sep 2010 19:51:59 -0400	[thread overview]
Message-ID: <80occ5xilc.fsf@fencepost.gnu.org> (raw)


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"




             reply	other threads:[~2010-09-10 23:51 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-09-10 23:51 Glenn Morris [this message]
2010-09-10 23:56 ` Fixing parallel byte-compilation Chad Brown
2010-09-11  0:52   ` Glenn Morris
2010-09-11 10:58 ` Stefan Monnier
2010-09-11 19:04   ` Glenn Morris
2010-09-12  9:50     ` Stefan Monnier
2010-09-13 16:33 ` Davis Herring
2010-09-13 17:10   ` Eli Zaretskii
2010-09-13 18:32     ` Glenn Morris

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=80occ5xilc.fsf@fencepost.gnu.org \
    --to=rgm@gnu.org \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.