ash: fix unset in standalone mode
authorDenys Vlasenko <vda.linux@googlemail.com>
Fri, 18 Jun 2010 12:23:47 +0000 (14:23 +0200)
committerDenys Vlasenko <vda.linux@googlemail.com>
Fri, 18 Jun 2010 12:23:47 +0000 (14:23 +0200)
Signed-off-by: Denys Vlasenko <vda.linux@googlemail.com>
shell/ash.c
shell/ash_test/ash-standalone/var_standalone1.right [new file with mode: 0644]
shell/ash_test/ash-standalone/var_standalone1.tests [new file with mode: 0755]

index fcaa7b18eb58d3d7cba5c32c0491a2aa9e76633d..74fe8617b7840e5c5f86789c11496f60f13174dc 100644 (file)
@@ -7252,6 +7252,7 @@ tryexec(IF_FEATURE_SH_STANDALONE(int applet_no,) char *cmd, char **argv, char **
 #if ENABLE_FEATURE_SH_STANDALONE
        if (applet_no >= 0) {
                if (APPLET_IS_NOEXEC(applet_no)) {
+                       clearenv();
                        while (*envp)
                                putenv(*envp++);
                        run_applet_no_and_exit(applet_no, argv);
diff --git a/shell/ash_test/ash-standalone/var_standalone1.right b/shell/ash_test/ash-standalone/var_standalone1.right
new file mode 100644 (file)
index 0000000..37457fd
--- /dev/null
@@ -0,0 +1 @@
+Done: 1
diff --git a/shell/ash_test/ash-standalone/var_standalone1.tests b/shell/ash_test/ash-standalone/var_standalone1.tests
new file mode 100755 (executable)
index 0000000..1e905ba
--- /dev/null
@@ -0,0 +1,2 @@
+VAR=42 $THIS_SH -c 'unset VAR; env | grep ^VAR'
+echo Done: $?