From: Ralf Wildenhues Date: Sun, 31 Jan 2010 21:37:41 +0000 (+0100) Subject: gnulib-tool: Ensure cache variables are unique. X-Git-Tag: v0.1~4631 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=cc045f2aee51c271f0ce36edb694a5aae72a4402;p=gnulib.git gnulib-tool: Ensure cache variables are unique. --- diff --git a/ChangeLog b/ChangeLog index e9ef43819..fab02220a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2010-01-18 Ralf Wildenhues + * gnulib-tool (func_cache_lookup_module): Store the module name + belonging to the cache variable; error out if two different + module names map to the same cache variable name. + +2010-01-18 Ralf Wildenhues + gnulib-tool: Make caching optional. * gnulib-tool: Accept option --no-cache, turning off $do_cache. Update matching short versions of --no-changelog. diff --git a/gnulib-tool b/gnulib-tool index f9883bbff..bf42934f0 100755 --- a/gnulib-tool +++ b/gnulib-tool @@ -1436,7 +1436,7 @@ func_cache_lookup_module () # following line with an opening quote, if any. # 4) Special treatment if two headers are only separated by one newline. sed_cache_module=' - 1i\'$nl$cachevar'_cached='\''yes\'$nl' + 1i\'$nl$cachevar'_name='\'$1\'\\$nl$cachevar'_cached='\''yes\'$nl' :match t match @@ -1480,6 +1480,10 @@ func_cache_lookup_module () cache_script=`sed "$sed_cache_module" < "$lookedup_file" \ | sed "$sed_strip_trailing_nl"` eval "$cache_script" + else + if eval test "$1" != \"\$${cachevar}_name\"; then + eval 'func_fatal_error "cache variable collision: $1 and $'${cachevar}'_name"' + fi fi }