From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: Glenn Morris Newsgroups: gmane.emacs.devel Subject: Fixing parallel byte-compilation Date: Fri, 10 Sep 2010 19:51:59 -0400 Message-ID: <80occ5xilc.fsf@fencepost.gnu.org> NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: dough.gmane.org 1284162732 2772 80.91.229.12 (10 Sep 2010 23:52:12 GMT) X-Complaints-To: usenet@dough.gmane.org NNTP-Posting-Date: Fri, 10 Sep 2010 23:52:12 +0000 (UTC) To: emacs-devel@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Sat Sep 11 01:52:10 2010 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.69) (envelope-from ) id 1OuDO1-0005cO-CY for ged-emacs-devel@m.gmane.org; Sat, 11 Sep 2010 01:52:05 +0200 Original-Received: from localhost ([127.0.0.1]:43085 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuDO0-0003rF-Nb for ged-emacs-devel@m.gmane.org; Fri, 10 Sep 2010 19:52:04 -0400 Original-Received: from [140.186.70.92] (port=58062 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1OuDNs-0003p1-BG for emacs-devel@gnu.org; Fri, 10 Sep 2010 19:51:57 -0400 Original-Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1OuDNr-0004n1-BG for emacs-devel@gnu.org; Fri, 10 Sep 2010 19:51:56 -0400 Original-Received: from fencepost.gnu.org ([140.186.70.10]:33097) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1OuDNr-0004mx-7V for emacs-devel@gnu.org; Fri, 10 Sep 2010 19:51:55 -0400 Original-Received: from rgm by fencepost.gnu.org with local (Exim 4.69) (envelope-from ) id 1OuDNv-0006YY-KR; Fri, 10 Sep 2010 19:51:59 -0400 X-Spook: CDC arrangements Ft. Knox Arnett plutonium Jyllandsposten X-Ran: @_I7uTujpG*Y,f[B^p+x!1'"$\ylL%f%IN|Utrar>pe?2;i@5f6/#'vIJNxC1%}/3D3SVx X-Hue: yellow X-Attribution: GM User-Agent: Gnus (www.gnus.org), GNU Emacs (www.gnu.org/software/emacs/) X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 3) X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:129939 Archived-At: 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"