[PATCH] shell/lash.c: set environment variable

Shaun Jackman sjackman at gmail.com
Fri Jun 30 22:01:02 UTC 2006


On 6/13/06, Rob Landley <rob at landley.net> wrote:
> Ok, svn 15378.  I shrank enough from lash with the previous checkin that I
> didn't feel guilty about adding one more feature. :)

Oops, Rob. You mistakenly checked in my buggy patch from 2006-04-21.
The bug-fixed version was posted on 2006-05-25. Here is an aggregate
patch reverting the former and applying the latter.

Cheers,
Shaun

2006-06-30  Shaun Jackman  <sjackman at gmail.com>

	* shell/lash.c (pseudo_exec): Revert svn r15378.
	(run_command): Allow setting an environment
	variable without an explicit `export'.

--- shell/lash.c	9acd74538cd22832eb2338948f4f10b47826bf28
+++ shell/lash.c	3d11fabe4b08b4f75b08588f40b637b521777b35
@@ -1181,12 +1181,6 @@
 {
 	struct built_in_command *x;

-	/* Check if the command sets an environment variable. */
-	if( strchr(child->argv[0], '=') != NULL ) {
-		child->argv[1] = child->argv[0];
-		_exit(builtin_export(child));
-	}
-
 	/* Check if the command matches any of the non-forking builtins.
 	 * Depending on context, this might be redundant.  But it's
 	 * easier to waste a few CPU cycles than it is to figure out
@@ -1310,6 +1304,12 @@
 		 * is doomed to failure, and doesn't work on bash, either.
 		 */
 		if (newjob->num_progs == 1) {
+			/* Check if the command sets an environment variable. */
+			if (strchr(child->argv[0], '=') != NULL) {
+				child->argv[1] = child->argv[0];
+				return builtin_export(child);
+			}
+
 			for (x = bltins; x->cmd; x++) {
 				if (strcmp(child->argv[0], x->cmd) == 0 ) {
 					int rcode;
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: busybox-lash.diff
Url: http://lists.busybox.net/pipermail/busybox/attachments/20060630/588c7952/attachment.diff 


More information about the busybox mailing list