make/tests/scripts/features
Paul Smith 9e2fa24649 [SV 41273] Allow the directory cache to be invalidated
Each time we invoke a command it's possible that it will change the
filesystem in ways that were not described by the target.  If that
happens but we have cached previous directory contents then we may
make decisions or report results based on obsolete information.

Keep a count of how many commands we've invoked, and remember the
current command count every time we load the contents of a directory.
If we request the directory and the current command count has changed
we know the cache is outdated so reload from scratch.

* NEWS: Announce the change.
* src/makeint.h (command_count): Create a global counter.
* src/main.c (command_count): Ditto.
* src/job.c (reap_children): Increment the counter on job completion.
* src/function.c (func_file): Increment if we write a file.
* src/dir.c (clear_directory_contents): Clear the current contents of
a cached directory.
(struct directory_contents): Remember the counter value.
(struct directory): Remember the counter value for non-existing dirs.
(find_directory): If we have a cached directory and the count hasn't
changed then return it.  Else, clear the previous contents and re-read
from scratch.
* tests/scripts/features/dircache: Add tests of the directory cache.
2020-11-29 17:59:16 -05:00
..
archives
comments
conditionals
default_names
dircache [SV 41273] Allow the directory cache to be invalidated 2020-11-29 17:59:16 -05:00
double_colon
echoing
errors
escape
exec
export
grouped_targets
include
jobserver
load
loadapi
mult_rules
mult_targets
order_only
output-sync
override
parallelism
patspecific_vars
patternrules
quoting
recursion
reinvoke
rule_glob
se_explicit
se_implicit
se_statpat
shell_assignment
statipattrules
suffixrules
targetvars
utf8
varnesting
vpath
vpath2
vpath3
vpathgpath
vpathplus