Skip to content

Commit

Permalink
Fix bug in cycle detection
Browse files Browse the repository at this point in the history
It was recording targets relative to the directory of the latest .do
script, rather than the directory where the build started.
  • Loading branch information
bocchino committed Dec 8, 2016
1 parent c4b2cce commit a0b88e0
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions lib/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,10 +86,11 @@ def done(t, rv):
break
fid,t = locked.pop(0)
target_list = targets_seen.get()
if t in target_list:
nice_t = _nice(t)
if nice_t in target_list:
# Target locked by parent: cyclic dependence
err('encountered a dependence cycle:\n')
_print_cycle(target_list, t)
_print_cycle(target_list, nice_t)
retcode[0] = 208
break
lock = state.Lock(fid)
Expand Down Expand Up @@ -243,7 +244,7 @@ def _start_unlocked(self, dirty):
def run():
os.chdir(vars.BASE)
os.environ['REDO_DEPTH'] = vars.DEPTH + ' '
targets_seen.add(self.t)
targets_seen.add(_nice(self.t))
os.execvp(argv[0], argv)
assert(0)
# returns only if there's an exception
Expand All @@ -262,7 +263,7 @@ def _do_subproc(self):
os.environ['REDO_PWD'] = state.relpath(newp, vars.STARTDIR)
os.environ['REDO_TARGET'] = self.basename + self.ext
os.environ['REDO_DEPTH'] = vars.DEPTH + ' '
targets_seen.add(self.t)
targets_seen.add(_nice(self.t))
if dn:
os.chdir(dn)
os.dup2(self.f.fileno(), 1)
Expand Down

0 comments on commit a0b88e0

Please sign in to comment.