changeset 12856:2dede34a31b6

gnulib-tool: Ensure cache variables are unique.
author Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
date Sun, 31 Jan 2010 22:37:41 +0100
parents e4098d9b46fa
children dfbc7f3aa6d0
files ChangeLog gnulib-tool
diffstat 2 files changed, 11 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2010-01-18  Ralf Wildenhues  <Ralf.Wildenhues@gmx.de>
+
+	* 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  <Ralf.Wildenhues@gmx.de>
 
 	gnulib-tool: Make caching optional.
--- a/gnulib-tool
+++ b/gnulib-tool
@@ -1436,7 +1436,7 @@
     #    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 @@
     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
 }