mirror of
https://github.com/mirror/make.git
synced 2026-08-31 11:48:08 +08:00
[SV 54549] Don't free used set_lists during merge
When merging the variable_set_lists for two targets it could be that the "from" set list is a subset of the "to" set list: check for this situation to avoid freeing used memory. * src/variable.c (merge_variable_set_lists): Walk the "to" list and if the "from" list is contained in it, nothing to do. * tests/scripts/features/se_explicit: Add a test.
This commit is contained in:
@@ -164,4 +164,30 @@ foo: $$(@\\:%=%.bar); @echo '$^'
|
||||
!,
|
||||
'', "foo.bar\n");
|
||||
|
||||
# SV 54549 : Ensure we don't free used variable_sets
|
||||
run_make_test(q!
|
||||
foo: -lcat
|
||||
|
||||
# Removing second expansion prevents segfault
|
||||
.SECONDEXPANSION:
|
||||
foo: $$@.o ;
|
||||
|
||||
# Having an empty command here prevents segfault unless,
|
||||
# the environment is empty. `env -i make foo`
|
||||
# MFLAGS=-w or MAKEFLAGS=-w `env MFLAGS=-w make foo`
|
||||
# libcat.a target calls an extra command, `@true \n @touch $@`
|
||||
# odd.
|
||||
%.o: ; @true
|
||||
|
||||
# Having an empty command prevents segfault.
|
||||
-l%: lib%.a ; @true
|
||||
|
||||
# Not creating libcat.a here prevents segfault,
|
||||
libcat.a: ; @touch $@
|
||||
!,
|
||||
'', q!#MAKEFILE#:16: Recipe was specified for file '-lcat' at #MAKEFILE#:19,
|
||||
#MAKEFILE#:16: but '-lcat' is now considered the same file as 'libcat.a'.
|
||||
#MAKEFILE#:16: Recipe for 'libcat.a' will be ignored in favor of the one for '-lcat'.!);
|
||||
unlink('libcat.a');
|
||||
|
||||
1;
|
||||
|
||||
Reference in New Issue
Block a user