Fix a deadlock with redo-oob.

If a checksummed target A used to exist but is now missing, and we tried to
redo-ifchange that exact file, we would unnecessarily run 'redo-oob A A';
that is, we have to build A in order to determine if A needs to be built.

The sub-targets of redo-oob aren't run with REDO_UNLOCKED, so this would
deadlock instantly.

Add an assertion to redo-oob to ensure we never try to redo-ifchange the
primary target (thus converting the deadlock into an exception).  And skip
doing redo-oob when the target is already the same as the thing we have to
check.
This commit is contained in:
Avery Pennarun 2010-12-11 06:16:32 -08:00
commit 1d26d99e0c
4 changed files with 12 additions and 1 deletions

View file

@ -262,6 +262,7 @@ class File(object):
reldep = relpath(dep, vars.BASE)
debug2('add-dep: %r < %s %r\n' % (self.name, mode, reldep))
assert(src.name == reldep)
assert(self.id != src.id)
_write("insert or replace into Deps "
" (target, mode, source) values (?,?,?)",
[self.id, mode, src.id])