[BusyBox] strange sh bug

Larry Doolittle ldoolitt at recycle.lbl.gov
Thu Jan 4 17:54:57 UTC 2001


I had to turn off BB_FEATURE_SH_STANDALONE_SHELL for
one of my targets (x86, libc-2.0.7, kernel 2.0.36).
I couldn't get scripting to work properly with it
turned on.  Something to do with the state of the
input stream getting corrupted.

I will look at it more later, I hope.  The following patch
looks necessary, but is not sufficient to solve my problem.

      - Larry

--- /home/ldoolitt/cvs/busybox/sh.c	Thu Jan  4 08:38:58 2001
+++ sh.c	Thu Jan  4 09:45:32 2001
@@ -1629,6 +1629,17 @@
 	argc = argc_l;
 	argv = argv_l;
 
+#ifdef BB_FEATURE_STANDALONE_SHELL
+/* These variables need re-initializing when recursing */
+	local_pending_command = NULL;
+	job_list.head = NULL;
+	job_list.fg = NULL;
+#ifdef BB_FEATURE_SH_ENVIRONMENT
+	last_bg_pid=-1;
+	last_return_code=-1;
+	show_x_trace=FALSE;
+#endif
+#endif
 
 	if (argv[0] && argv[0][0] == '-') {
 		  FILE *input;





More information about the busybox mailing list