hush: nommu fix for function passing
authorDenis Vlasenko <vda.linux@googlemail.com>
Sun, 26 Apr 2009 20:06:14 +0000 (20:06 -0000)
committerDenis Vlasenko <vda.linux@googlemail.com>
Sun, 26 Apr 2009 20:06:14 +0000 (20:06 -0000)
shell/hush.c
shell/hush_test/hush-misc/func4.right [new file with mode: 0644]
shell/hush_test/hush-misc/func4.tests [new file with mode: 0755]
shell/hush_test/hush-z_slow/leak_all1.tests

index 2ad8ebacbce433623c81f35082440d2a9e9ef9ff..292b8b2e3d9de337c113564d89bd0009435610fe 100644 (file)
@@ -5328,9 +5328,12 @@ static int parse_stream_dquoted(o_string *as_string,
                 * within double quotes by preceding it with a backslash.
                 */
                if (strchr("$`\"\\", next) != NULL) {
-                       o_addqchr(dest, i_getch(input));
+                       ch = i_getch(input);
+                       o_addqchr(dest, ch);
+                       nommu_addchr(as_string, ch);
                } else {
                        o_addqchr(dest, '\\');
+                       nommu_addchr(as_string, '\\');
                }
                goto again;
        }
diff --git a/shell/hush_test/hush-misc/func4.right b/shell/hush_test/hush-misc/func4.right
new file mode 100644 (file)
index 0000000..0c87e31
--- /dev/null
@@ -0,0 +1,2 @@
+24
+Done
diff --git a/shell/hush_test/hush-misc/func4.tests b/shell/hush_test/hush-misc/func4.tests
new file mode 100755 (executable)
index 0000000..db3f15a
--- /dev/null
@@ -0,0 +1,7 @@
+func() { 
+       eval "echo \"\${val_${1}}\"" 
+}
+
+val_x=24 
+(func x)
+echo Done
index 17ce0c6fa21289d064df72e18cc4b41471047052..4e3c4fdecc17c12e5de3a9426bf08bf7859efc33 100755 (executable)
@@ -67,6 +67,7 @@ HERE
     f >/dev/null
     : $((i++))
 done
+unset i l t
 unset -f f
 
 memleak
@@ -134,6 +135,7 @@ HERE
     f >/dev/null
     : $((i++))
 done
+unset i l t
 unset -f f