Don't set_checked() on is_override files.

If a file is overridden and then overridden again, this caused us to
rebuild only the first thing that depends on it, but not any subsequent
things, which is a pretty serious bug.

It turned out that t/350-deps-forget is already supposed to test this,
but I had cleverly encoded the wrong behaviour into the expected
results in the table-driven test.  I blame lack of sleep.  Anyway, I
fixed the test, which made it fail, and then fixed the code, which made
it pass.
This commit is contained in:
Avery Pennarun 2018-12-18 12:59:51 +00:00
commit 174a093dc5
2 changed files with 12 additions and 13 deletions

View file

@ -165,11 +165,10 @@ class _BuildJob(object):
warn('%s - old: %r\n' % (_nice(t), sf.stamp))
warn('%s - new: %r\n' % (_nice(t), newstamp))
sf.set_override()
sf.set_checked()
sf.save()
return self._finalize(0)
# fall through and treat it the same as a static file
if (os.path.exists(t) and not os.path.isdir(t + '/.')
and not sf.is_generated):
and (sf.is_override or not sf.is_generated)):
# an existing source file that was not generated by us.
# This step is mentioned by djb in his notes.
# For example, a rule called default.c.do could be used to try

View file

@ -61,9 +61,9 @@ truth="
src del nil ran ran no 0 1 0
src del add ran ran no 0 1 0
src add err skip skip no 1 0 0 # source updated
src add nil skip skip no 1 0 0
src add add skip skip no 1 0 0
src add err ran skip no 1 0 0 # source updated
src add nil ran skip no 1 0 0
src add add ran skip no 1 0 0
# File was initially a target that produced nil
nil nop err skip ran no 0 0 0 # content forgotten
@ -74,9 +74,9 @@ truth="
nil del nil ran ran no 0 1 0
nil del add ran ran no 0 1 0
nil add err skip skip warn 1 0 0 # content overridden
nil add nil skip skip warn 1 0 0
nil add add skip skip warn 1 0 0
nil add err ran skip warn 1 0 0 # content overridden
nil add nil ran skip warn 1 0 0
nil add add ran skip warn 1 0 0
# File was initially a target that produced output
add nop err skip ran no 0 1 1 # update failed
@ -87,9 +87,9 @@ truth="
add del nil ran ran no 0 1 0
add del add ran ran no 0 1 0
add add err skip skip warn 1 0 0 # content overridden
add add nil skip skip warn 1 0 0
add add add skip skip warn 1 0 0
add add err ran skip warn 1 0 0 # content overridden
add add nil ran skip warn 1 0 0
add add add ran skip warn 1 0 0
"
echo "$truth" |
@ -150,7 +150,7 @@ while read pre update post subran ran warn src targ ood XX; do
case $update in
nop) ;;
del) rm -f bork; skip=1 ;;
add) echo override >>bork ;;
add) echo override >>bork; skip=1 ;;
*) exit 91 ;;
esac