SHA256
1
0
forked from pool/make

Accepting request 331638 from Base:System

- undefine-variables.patch: Force recomputing .VARIABLES when a variable
  was made undefined (bsc#934131) (forwarded request 331637 from Andreas_Schwab)

OBS-URL: https://build.opensuse.org/request/show/331638
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/make?expand=0&rev=35
This commit is contained in:
Dominique Leuenberger 2015-10-02 07:22:48 +00:00 committed by Git OBS Bridge
commit 3cd7cd0068
3 changed files with 89 additions and 1 deletions

View File

@ -1,3 +1,9 @@
-------------------------------------------------------------------
Wed Sep 16 09:10:34 UTC 2015 - schwab@suse.de
- undefine-variables.patch: Force recomputing .VARIABLES when a variable
was made undefined (bsc#934131)
-------------------------------------------------------------------
Mon Nov 17 12:08:11 UTC 2014 - tchvatal@suse.com

View File

@ -1,7 +1,7 @@
#
# spec file for package make
#
# Copyright (c) 2014 SUSE LINUX Products GmbH, Nuernberg, Germany.
# Copyright (c) 2015 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -29,6 +29,7 @@ Source1: http://ftp.gnu.org/gnu/make/make-%{version}.tar.bz2.sig
Source2: %{name}.keyring
Patch1: make-testcases_timeout.diff
Patch2: make-4.1-fix_null_returns_from_ttyname.patch
Patch3: undefine-variables.patch
Patch64: make-library-search-path.diff
Requires(post): %{install_info_prereq}
Recommends: %{name}-lang
@ -44,6 +45,7 @@ The GNU make command with extensive documentation.
%setup -q
%patch1 -p1
%patch2 -p1
%patch3 -p1
if [ %{_lib} == lib64 ]; then
%patch64 -p1
fi

80
undefine-variables.patch Normal file
View File

@ -0,0 +1,80 @@
Subject: [PATCH] [SV 45728] Force recomputing .VARIABLES when a variable was made undefined
* variable.c (last_var_count): Move to file level.
(undefine_variable_in_set): Clear last_var_count when the variable
was removed from global_variable_set.
* tests/scripts/variables/undefine: Add test case.
---
tests/scripts/variables/undefine | 14 ++++++++++++++
variable.c | 14 ++++++++------
2 files changed, 22 insertions(+), 6 deletions(-)
Index: make-4.1/tests/scripts/variables/undefine
===================================================================
--- make-4.1.orig/tests/scripts/variables/undefine
+++ make-4.1/tests/scripts/variables/undefine
@@ -70,4 +70,18 @@ all: ;@echo ouch
',
'', "#MAKEFILE#:3: *** empty variable name. Stop.\n", 512);
+
+# TEST 4: interaction between undefine and $(.VARIABLES)
+
+run_make_test('
+var_a := a
+var_b := b
+$(foreach v, $(filter var_%, $(.VARIABLES)), $(eval undefine $v))
+var_c := c
+var_d := d
+$(info $(filter var_%, $(.VARIABLES)))
+all: ;@:
+',
+'', "var_d var_c");
+
1;
Index: make-4.1/variable.c
===================================================================
--- make-4.1.orig/variable.c
+++ make-4.1/variable.c
@@ -172,6 +172,7 @@ static struct variable_set global_variab
static struct variable_set_list global_setlist
= { 0, &global_variable_set, 0 };
struct variable_set_list *current_variable_set_list = &global_setlist;
+static unsigned long last_var_count = 0;
/* Implement variables. */
@@ -328,6 +329,10 @@ undefine_variable_in_set (const char *na
{
hash_delete_at (&set->table, var_slot);
free_variable_name_and_value (v);
+ /* Force rebuilding of .VARIABLES when the global variable set
+ has changed. */
+ if (set == &global_variable_set)
+ last_var_count = 0;
}
}
}
@@ -345,9 +350,6 @@ undefine_variable_in_set (const char *na
static struct variable *
lookup_special_var (struct variable *var)
{
- static unsigned long last_var_count = 0;
-
-
/* This one actually turns out to be very hard, due to the way the parser
records targets. The way it works is that target information is collected
internally until make knows the target is completely specified. It unitl
@@ -410,9 +412,9 @@ lookup_special_var (struct variable *var
}
*(p-1) = '\0';
- /* Remember how many variables are in our current count. Since we never
- remove variables from the list, this is a reliable way to know whether
- the list is up to date or needs to be recomputed. */
+ /* Remember how many variables are in our current count. This is a
+ reliable way to know whether the list is up to date or needs to
+ be recomputed. */
last_var_count = global_variable_set.table.ht_fill;
}