Add in a new FEATURE (off by default) BB_FEATURE_SH_BUILTINS_ALWAYS_WIN.
Make the sh default to using external commands when a path is provided.
This commit is contained in:
		
							
								
								
									
										8
									
								
								Config.h
									
									
									
									
									
								
							
							
						
						
									
										8
									
								
								Config.h
									
									
									
									
									
								
							| @@ -234,6 +234,14 @@ | |||||||
| //among other thing. | //among other thing. | ||||||
| #define BB_FEATURE_SH_STANDALONE_SHELL | #define BB_FEATURE_SH_STANDALONE_SHELL | ||||||
| // | // | ||||||
|  | //When this is enabled, busybox shell builtins can be called using full path | ||||||
|  | //names.  This causes builtins (which includes every single busybox command | ||||||
|  | //when you enable BB_FEATURE_SH_STANDALONE_SHELL) to override real commands on | ||||||
|  | //the filesystem.  When this is enabled, if you run /bin/cat, it will use | ||||||
|  | //BusyBox cat even if /bin/cat exists on the filesystem and is _not_ busybox. | ||||||
|  | //Some systems want this, others do not.  Choose wisely.  :-) | ||||||
|  | //BB_FEATURE_SH_BUILTINS_ALWAYS_WIN | ||||||
|  | // | ||||||
| // Enable tab completion in the shell (not yet  | // Enable tab completion in the shell (not yet  | ||||||
| // working very well -- so don't turn this on) | // working very well -- so don't turn this on) | ||||||
| //#define BB_FEATURE_SH_TAB_COMPLETION | //#define BB_FEATURE_SH_TAB_COMPLETION | ||||||
|   | |||||||
							
								
								
									
										19
									
								
								lash.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								lash.c
									
									
									
									
									
								
							| @@ -1216,7 +1216,24 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||||||
| #ifdef BB_FEATURE_SH_STANDALONE_SHELL | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | ||||||
| 			/* Check if the command matches any busybox internal commands here */ | 			/* Check if the command matches any busybox internal commands here */ | ||||||
| 			while (a->name != 0) { | 			while (a->name != 0) { | ||||||
| 				if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), a->name) == 0) { | #ifdef BB_FEATURE_SH_BUILTINS_ALWAYS_WIN | ||||||
|  | 				if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), | ||||||
|  | 							a->name) == 0)  | ||||||
|  | #else | ||||||
|  | 					/* Check if the command matches any busybox internal | ||||||
|  | 					 * commands ("applets") here.  Following discussions from | ||||||
|  | 					 * November 2000 on busybox@opensource.lineo.com, don't use | ||||||
|  | 					 * get_last_path_component().  This way explicit (with | ||||||
|  | 					 * slashes) filenames will never be interpreted as an | ||||||
|  | 					 * applet, just like with builtins.  This way the user can | ||||||
|  | 					 * override an applet with an explicit filename reference. | ||||||
|  | 					 * The only downside to this change is that an explicit | ||||||
|  | 					 * /bin/foo invocation fill fork and exec /bin/foo, even if | ||||||
|  | 					 * /bin/foo is a symlink to busybox. | ||||||
|  | 					*/ | ||||||
|  | 				if (strcmp(newJob->progs[i].argv[0], a->name) == 0)  | ||||||
|  | #endif | ||||||
|  | 				{ | ||||||
| 					int argc_l; | 					int argc_l; | ||||||
| 					char** argv=newJob->progs[i].argv; | 					char** argv=newJob->progs[i].argv; | ||||||
| 					for(argc_l=0;*argv!=NULL; argv++, argc_l++); | 					for(argc_l=0;*argv!=NULL; argv++, argc_l++); | ||||||
|   | |||||||
							
								
								
									
										19
									
								
								sh.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								sh.c
									
									
									
									
									
								
							| @@ -1216,7 +1216,24 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||||||
| #ifdef BB_FEATURE_SH_STANDALONE_SHELL | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | ||||||
| 			/* Check if the command matches any busybox internal commands here */ | 			/* Check if the command matches any busybox internal commands here */ | ||||||
| 			while (a->name != 0) { | 			while (a->name != 0) { | ||||||
| 				if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), a->name) == 0) { | #ifdef BB_FEATURE_SH_BUILTINS_ALWAYS_WIN | ||||||
|  | 				if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), | ||||||
|  | 							a->name) == 0)  | ||||||
|  | #else | ||||||
|  | 					/* Check if the command matches any busybox internal | ||||||
|  | 					 * commands ("applets") here.  Following discussions from | ||||||
|  | 					 * November 2000 on busybox@opensource.lineo.com, don't use | ||||||
|  | 					 * get_last_path_component().  This way explicit (with | ||||||
|  | 					 * slashes) filenames will never be interpreted as an | ||||||
|  | 					 * applet, just like with builtins.  This way the user can | ||||||
|  | 					 * override an applet with an explicit filename reference. | ||||||
|  | 					 * The only downside to this change is that an explicit | ||||||
|  | 					 * /bin/foo invocation fill fork and exec /bin/foo, even if | ||||||
|  | 					 * /bin/foo is a symlink to busybox. | ||||||
|  | 					*/ | ||||||
|  | 				if (strcmp(newJob->progs[i].argv[0], a->name) == 0)  | ||||||
|  | #endif | ||||||
|  | 				{ | ||||||
| 					int argc_l; | 					int argc_l; | ||||||
| 					char** argv=newJob->progs[i].argv; | 					char** argv=newJob->progs[i].argv; | ||||||
| 					for(argc_l=0;*argv!=NULL; argv++, argc_l++); | 					for(argc_l=0;*argv!=NULL; argv++, argc_l++); | ||||||
|   | |||||||
							
								
								
									
										19
									
								
								shell/lash.c
									
									
									
									
									
								
							
							
						
						
									
										19
									
								
								shell/lash.c
									
									
									
									
									
								
							| @@ -1216,7 +1216,24 @@ static int runCommand(struct job *newJob, struct jobSet *jobList, int inBg, int | |||||||
| #ifdef BB_FEATURE_SH_STANDALONE_SHELL | #ifdef BB_FEATURE_SH_STANDALONE_SHELL | ||||||
| 			/* Check if the command matches any busybox internal commands here */ | 			/* Check if the command matches any busybox internal commands here */ | ||||||
| 			while (a->name != 0) { | 			while (a->name != 0) { | ||||||
| 				if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), a->name) == 0) { | #ifdef BB_FEATURE_SH_BUILTINS_ALWAYS_WIN | ||||||
|  | 				if (strcmp(get_last_path_component(newJob->progs[i].argv[0]), | ||||||
|  | 							a->name) == 0)  | ||||||
|  | #else | ||||||
|  | 					/* Check if the command matches any busybox internal | ||||||
|  | 					 * commands ("applets") here.  Following discussions from | ||||||
|  | 					 * November 2000 on busybox@opensource.lineo.com, don't use | ||||||
|  | 					 * get_last_path_component().  This way explicit (with | ||||||
|  | 					 * slashes) filenames will never be interpreted as an | ||||||
|  | 					 * applet, just like with builtins.  This way the user can | ||||||
|  | 					 * override an applet with an explicit filename reference. | ||||||
|  | 					 * The only downside to this change is that an explicit | ||||||
|  | 					 * /bin/foo invocation fill fork and exec /bin/foo, even if | ||||||
|  | 					 * /bin/foo is a symlink to busybox. | ||||||
|  | 					*/ | ||||||
|  | 				if (strcmp(newJob->progs[i].argv[0], a->name) == 0)  | ||||||
|  | #endif | ||||||
|  | 				{ | ||||||
| 					int argc_l; | 					int argc_l; | ||||||
| 					char** argv=newJob->progs[i].argv; | 					char** argv=newJob->progs[i].argv; | ||||||
| 					for(argc_l=0;*argv!=NULL; argv++, argc_l++); | 					for(argc_l=0;*argv!=NULL; argv++, argc_l++); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user