7
Bug-Reported-by: Dan Douglas <ormaaj@gmail.com>
8
Bug-Reference-ID: <1498458.MpVlmOXDB7@smorgbox>
9
Bug-Reference-URL: http://lists.gnu.org/archive/html/bug-bash/2012-09/msg00008.html
13
Under certain circumstances, bash attempts to expand variables in arithmetic
14
expressions even when evaluation is being suppressed.
16
Patch (apply with `patch -p0'):
19
===================================================================
22
@@ -1009,6 +1009,12 @@
26
+/*itrace("expr_streval: %s: noeval = %d", tok, noeval);*/
27
+ /* If we are suppressing evaluation, just short-circuit here instead of
28
+ going through the rest of the evaluator. */
33
#if defined (ARRAY_VARS)
34
v = (e == ']') ? array_variable_part (tok, (char **)0, (int *)0) : find_variable (tok);
35
@@ -1182,6 +1188,10 @@
36
#endif /* ARRAY_VARS */
39
+ /* XXX - watch out for pointer aliasing issues here */
40
+ if (curlval.tokstr && curlval.tokstr == tokstr)
41
+ init_lvalue (&curlval);
44
tokstr = savestring (tp);
46
Index: b/bash/patchlevel.h
47
===================================================================
48
--- a/bash/patchlevel.h
49
+++ b/bash/patchlevel.h
51
regexp `^#define[ ]*PATCHLEVEL', since that's what support/mkversion.sh
52
looks for to find the patch level (for the sccs version string). */
54
-#define PATCHLEVEL 38
55
+#define PATCHLEVEL 39
57
#endif /* _PATCHLEVEL_H_ */