[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
FYI: fix race in parallel lisp builds
From: |
Alexandre Duret-Lutz |
Subject: |
FYI: fix race in parallel lisp builds |
Date: |
Sun, 01 Feb 2004 13:17:46 +0100 |
User-agent: |
Gnus/5.1003 (Gnus v5.10.3) Emacs/21.3.50 (gnu/linux) |
There is a minor race condition in the current lisp rules when
run in parallel:
ELCFILES = one.elc three.elc two.elc
all-am: ... elc-stamp $(ELCFILES)
elc-stamp: $(am__ELFILES)
@echo 'WARNING: Warnings can be ignored. :-)'
if test "$(EMACS)" != no; then \
set x; \
list='$(am__ELFILES)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
set x "$$@" "$$d$$p"; shift; \
done; \
shift; \
EMACS="$(EMACS)" $(SHELL) $(elisp_comp) "$$@" || exit 1; \
else : ; fi
touch $@
.el.elc:
@if test ! -f $@; then \
rm -f elc-stamp; \
$(MAKE) $(AM_MAKEFLAGS) elc-stamp; \
else : ; fi
Because the ELCFILES do not depend on elc-stamp, they could be
built in parallel. With very bad luck, one could imagine that
the entire elc-stamp rule is executed between the `test ! -f $@'
and `rm -f elc-stamp' statements of the .el.elc command.
The idea is to replace `.el.elc:' by `$(ELCFILES): elc-stamp'.
Removing that weird inference rule looks cleaner anyway.
I'm installing this on HEAD and branch-1-8.
2004-02-01 Alexandre Duret-Lutz <address@hidden>
* automake.in (handle_emacs_lisp): Define $(ELCFILES) as
$(am__ELCFILES), and always push it on @all. Do not mention
elc-stamp.
* lib/am/lisp.am (.el.elc): Rewrite as ...
($(am__ELCFILES)): ... this, and depend on elc-stamp.
(elc-stamp): Make sure elc-stamp is older that all .elc files, as
explained in the manual entry below.
Index: NEWS
===================================================================
RCS file: /cvs/automake/automake/NEWS,v
retrieving revision 1.256.2.24
diff -u -r1.256.2.24 NEWS
--- NEWS 1 Feb 2004 09:31:07 -0000 1.256.2.24
+++ NEWS 1 Feb 2004 12:13:18 -0000
@@ -17,6 +17,9 @@
- Do not AC_SUBST(LIBOBJS) in AM_WITH_REGEX. This macro was unusable
since Autoconf 2.54, which defines LIBOBJS itself.
+ - Fix a potential (but unlikely) race condition in parallel elisp
+ builds. (Introduced in 1.7.3.)
+
* New sections in manual:
- Third-Party Makefiles: how to interface third party Makefiles.
Index: automake.in
===================================================================
RCS file: /cvs/automake/automake/automake.in,v
retrieving revision 1.1526.2.6
diff -u -r1.1526.2.6 automake.in
--- automake.in 10 Jan 2004 13:41:52 -0000 1.1526.2.6
+++ automake.in 1 Feb 2004 12:13:22 -0000
@@ -4257,24 +4257,14 @@
return if ! @elfiles;
- # Generate .elc files.
- my @elcfiles = map { $_->[1] . 'c' } @elfiles;
-
- define_pretty_variable ('ELCFILES', TRUE, INTERNAL, @elcfiles);
define_pretty_variable ('am__ELFILES', TRUE, INTERNAL,
map { $_->[1] } @elfiles);
+ define_pretty_variable ('am__ELCFILES', TRUE, INTERNAL,
+ '$(am__ELFILES:.el=.elc)');
+ # This one can be overridden by users.
+ define_pretty_variable ('ELCFILES', TRUE, INTERNAL, '$(am__ELCFILES)');
- # Do not depend on the build rules if ELCFILES is empty.
- # This is necessary because overriding ELCFILES= is a documented
- # idiom to disable byte-compilation.
- if (variable_value ('ELCFILES'))
- {
- # It's important that all depends on elc-stamp so that
- # all .elc files get recompiled whenever a .el changes.
- # It's important that all depends on $(ELCFILES) so that
- # we can recover if any of them is deleted.
- push (@all, 'elc-stamp', '$(ELCFILES)');
- }
+ push @all, '$(ELCFILES)';
require_variables ($elfiles[0][0], "Emacs Lisp sources seen", TRUE,
'EMACS', 'lispdir');
Index: lib/am/lisp.am
===================================================================
RCS file: /cvs/automake/automake/lib/am/lisp.am,v
retrieving revision 1.39.2.3
diff -u -r1.39.2.3 lisp.am
--- lib/am/lisp.am 28 Jan 2004 20:50:59 -0000 1.39.2.3
+++ lib/am/lisp.am 1 Feb 2004 12:13:24 -0000
@@ -24,6 +24,7 @@
elc-stamp: $(am__ELFILES)
@echo 'WARNING: Warnings can be ignored. :-)'
+ @rm -f elc-temp && touch elc-temp
if test "$(EMACS)" != no; then \
## Make sure "$@" isn't empty initially.
set x; \
@@ -37,14 +38,18 @@
shift; \
EMACS="$(EMACS)" $(SHELL) $(elisp_comp) "$$@" || exit 1; \
else : ; fi
- touch $@
+ @mv -f elc-temp $@
-.el.elc:
+## Do not use $(ELCFILES) as target, because it may have been emptied
+## by the user (to disable byte-compilation), and POSIX does not allow
+## an empty target.
+$(am__ELCFILES): elc-stamp
## Recover from the removal of $@
@if test ! -f $@; then \
rm -f elc-stamp; \
$(MAKE) $(AM_MAKEFLAGS) elc-stamp; \
else : ; fi
+
## ------------ ##
## Installing. ##
--
Alexandre Duret-Lutz
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- FYI: fix race in parallel lisp builds,
Alexandre Duret-Lutz <=