]> git.ipfire.org Git - thirdparty/make.git/commit
[SV 63047] Fix shuffle of SECONDEXPANSION prerequisites
authorSergei Trofimovich <siarheit@google.com>
Sun, 11 Sep 2022 20:28:59 +0000 (21:28 +0100)
committerPaul Smith <psmith@gnu.org>
Mon, 12 Sep 2022 05:05:31 +0000 (01:05 -0400)
commitca4234c4b550618df2194e0617c43bb12524f820
tree5942432a68bbce2e60ef8623c729ca57762eb98d
parent257b82ac1ff8ba13428b93ca774d44d1c2febb61
[SV 63047] Fix shuffle of SECONDEXPANSION prerequisites

Commit 07eea3aa4 `make --shuffle` prevented shuffling prerequisites
that use .SECONDEXPANSION, since shuffle happens before expansion.
This has two problems:
1. No shuffling happens for such prerequisites.
2. Use-after-free when outdated '->shuf' links are used.

Add a reshuffle into expansion phase right after dependency changes.

* src/file.c (expand_deps): Add reshuffle if dependencies change.
* src/shuffle.c (identity_shuffle_array): Fix comment typo.
* tests/scripts/options/shuffle: Add new SECONDEXPANSION test.
src/file.c
src/shuffle.c
tests/scripts/options/shuffle