about summary refs log tree commit diff
path: root/posix
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1999-07-02 11:50:55 +0000
committerUlrich Drepper <drepper@redhat.com>1999-07-02 11:50:55 +0000
commit4708015f24a69bd0a436483c4d1244d1fb1f2e87 (patch)
treee3d55cddb335ee69a1f872b3461d567c5cf1c9ec /posix
parent8d93eb92afa7e829225a0e884cc492e138feb515 (diff)
downloadglibc-4708015f24a69bd0a436483c4d1244d1fb1f2e87.tar.gz
glibc-4708015f24a69bd0a436483c4d1244d1fb1f2e87.tar.xz
glibc-4708015f24a69bd0a436483c4d1244d1fb1f2e87.zip
Update.
1999-07-02  Tim Waugh  <tim@cyberelk.demon.co.uk>

	* posix/wordexp-test.c: Revert bogus 'unset IFS' change.  It
	doesn't belong in the tests, but in the wordexp implementation.

	* posix/wordexp.c (exec_comm): Unset IFS so that subshells don't
	split fields.
Diffstat (limited to 'posix')
-rw-r--r--posix/wordexp-test.c24
-rw-r--r--posix/wordexp.c3
2 files changed, 15 insertions, 12 deletions
diff --git a/posix/wordexp-test.c b/posix/wordexp-test.c
index 8720389d4b..03a5d3a9b1 100644
--- a/posix/wordexp-test.c
+++ b/posix/wordexp-test.c
@@ -56,25 +56,25 @@ struct test_case_struct
      * but does NOT start a new field. */
     { 0, ":abc:", "$var", 0, 2, { "", "abc", }, ":" },
 
-    { 0, NULL, "$(unset IFS;echo :abc:)", 0, 2, { "", "abc", }, ":" },
-    { 0, NULL, "$(unset IFS;echo :abc:\\ )", 0, 2, { "", "abc", }, ": " },
-    { 0, NULL, "$(unset IFS;echo :abc\\ )", 0, 2, { "", "abc", }, ": " },
-    { 0, ":abc:", "$(unset IFS;echo $var)", 0, 2, { "", "abc", }, ":" },
+    { 0, NULL, "$(echo :abc:)", 0, 2, { "", "abc", }, ":" },
+    { 0, NULL, "$(echo :abc:\\ )", 0, 2, { "", "abc", }, ": " },
+    { 0, NULL, "$(echo :abc\\ )", 0, 2, { "", "abc", }, ": " },
+    { 0, ":abc:", "$(echo $var)", 0, 2, { "", "abc", }, ":" },
     { 0, NULL, ":abc:", 0, 1, { ":abc:", }, ":" },
-    { 0, NULL, "$(unset IFS;echo :abc:)def", 0, 3, { "", "abc", "def", },
+    { 0, NULL, "$(echo :abc:)def", 0, 3, { "", "abc", "def", },
       ":" },
-    { 0, NULL, "$(unset IFS;echo abc:de)f", 0, 2, { "abc", "def", }, ":" },
-    { 0, NULL, "$(unset IFS;echo abc:de)f:ghi", 0, 2, { "abc", "def:ghi", },
+    { 0, NULL, "$(echo abc:de)f", 0, 2, { "abc", "def", }, ":" },
+    { 0, NULL, "$(echo abc:de)f:ghi", 0, 2, { "abc", "def:ghi", },
       ":" },
-    { 0, NULL, "abc:d$(unset IFS;echo ef:ghi)", 0, 2, { "abc:def", "ghi", },
+    { 0, NULL, "abc:d$(echo ef:ghi)", 0, 2, { "abc:def", "ghi", },
       ":" },
-    { 0, "abc:", "$var$(unset IFS;echo def:ghi)", 0, 3, { "abc", "def",
+    { 0, "abc:", "$var$(echo def:ghi)", 0, 3, { "abc", "def",
 							  "ghi", }, ":" },
-    { 0, "abc:d", "$var$(unset IFS;echo ef:ghi)", 0, 3, { "abc", "def",
+    { 0, "abc:d", "$var$(echo ef:ghi)", 0, 3, { "abc", "def",
 							  "ghi", }, ":" },
-    { 0, "def:ghi", "$(unset IFS;echo abc:)$var", 0, 3, { "abc", "def",
+    { 0, "def:ghi", "$(echo abc:)$var", 0, 3, { "abc", "def",
 							  "ghi", }, ":" },
-    { 0, "ef:ghi", "$(unset IFS;echo abc:d)$var", 0, 3, { "abc", "def",
+    { 0, "ef:ghi", "$(echo abc:d)$var", 0, 3, { "abc", "def",
 							  "ghi", }, ":" },
 
     /* Simple parameter expansion */
diff --git a/posix/wordexp.c b/posix/wordexp.c
index b6cf85af32..dde9183db5 100644
--- a/posix/wordexp.c
+++ b/posix/wordexp.c
@@ -859,6 +859,9 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
 	    }
 	}
 
+      /* Make sure the subshell doesn't field-split on our behalf. */
+      unsetenv ("IFS");
+
       __close (fildes[0]);
       __execve (_PATH_BSHELL, (char *const *) args, __environ);