mirror of
https://github.com/mirror/make.git
synced 2026-09-04 05:32:57 +08:00
Save strings we're expanding in case an embedded eval causes them
to be freed (if they're the value of a variable that's reset for example). See Savannah patch #7534
This commit is contained in:
@@ -1,29 +1,30 @@
|
||||
$description = "The following test creates a makefile to ...";
|
||||
# -*-perl-*-
|
||||
$description = "Test recursive variables";
|
||||
|
||||
$details = "";
|
||||
|
||||
open(MAKEFILE,"> $makefile");
|
||||
run_make_test('
|
||||
x = variable1
|
||||
variable2 := Hello
|
||||
y = $(subst 1,2,$(x))
|
||||
z = y
|
||||
a := $($($(z)))
|
||||
all:
|
||||
@echo $(a)
|
||||
',
|
||||
'', "Hello\n");
|
||||
|
||||
# The Contents of the MAKEFILE ...
|
||||
# This tests resetting the value of a variable while expanding it.
|
||||
# You may only see problems with this if you're using valgrind or
|
||||
# some other memory checker that poisons freed memory.
|
||||
# See Savannah patch #7534
|
||||
|
||||
print MAKEFILE "x = variable1\n"
|
||||
."variable2 := Hello\n"
|
||||
."y = \$(subst 1,2,\$(x))\n"
|
||||
."z = y\n"
|
||||
."a := \$(\$(\$(z)))\n"
|
||||
."all: \n"
|
||||
."\t\@echo \$(a)\n";
|
||||
|
||||
# END of Contents of MAKEFILE
|
||||
|
||||
close(MAKEFILE);
|
||||
|
||||
&run_make_with_options($makefile,"",&get_logfile);
|
||||
|
||||
# Create the answer to what should be produced by this Makefile
|
||||
$answer = "Hello\n";
|
||||
|
||||
&compare_output($answer,&get_logfile(1));
|
||||
run_make_test('
|
||||
VARIABLE = $(eval VARIABLE := echo hi)$(VARIABLE)
|
||||
wololo:
|
||||
@$(VARIABLE)
|
||||
',
|
||||
'', "hi\n");
|
||||
|
||||
1;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user