svn commit: trunk/busybox/shell: hush_test/hush-misc

vda at busybox.net vda at busybox.net
Tue Jun 17 12:28:44 UTC 2008


Author: vda
Date: 2008-06-17 05:28:44 -0700 (Tue, 17 Jun 2008)
New Revision: 22397

Log:
hush: fix $$ handling



Added:
   trunk/busybox/shell/hush_test/hush-misc/pid.right
   trunk/busybox/shell/hush_test/hush-misc/pid.tests

Modified:
   trunk/busybox/shell/hush.c


Changeset:
Modified: trunk/busybox/shell/hush.c
===================================================================
--- trunk/busybox/shell/hush.c	2008-06-17 12:11:34 UTC (rev 22396)
+++ trunk/busybox/shell/hush.c	2008-06-17 12:28:44 UTC (rev 22397)
@@ -395,6 +395,7 @@
 	int run_list_level;
 	pid_t saved_task_pgrp;
 	pid_t saved_tty_pgrp;
+	pid_t root_pid;
 	int last_jobid;
 	struct pipe *job_list;
 	struct pipe *toplevel_list;
@@ -441,6 +442,7 @@
 #define run_list_level   (G.run_list_level  )
 #define saved_task_pgrp  (G.saved_task_pgrp )
 #define saved_tty_pgrp   (G.saved_tty_pgrp  )
+#define root_pid         (G.root_pid        )
 #define last_jobid       (G.last_jobid      )
 #define job_list         (G.job_list        )
 #define toplevel_list    (G.toplevel_list   )
@@ -2353,7 +2355,7 @@
 		/* Highest bit in first_ch indicates that var is double-quoted */
 		case '$': /* pid */
 			/* FIXME: (echo $$) should still print pid of main shell */
-			val = utoa(getpid()); /* rootpid? */
+			val = utoa(root_pid);
 			break;
 		case '!': /* bg pid */
 			val = last_bg_pid ? utoa(last_bg_pid) : (char*)"";
@@ -3752,6 +3754,8 @@
 
 	INIT_G();
 
+	root_pid = getpid();
+
 	/* Deal with HUSH_VERSION */
 	shell_ver = const_shell_ver; /* copying struct here */
 	top_var = &shell_ver;

Added: trunk/busybox/shell/hush_test/hush-misc/pid.right
===================================================================
--- trunk/busybox/shell/hush_test/hush-misc/pid.right	                        (rev 0)
+++ trunk/busybox/shell/hush_test/hush-misc/pid.right	2008-06-17 12:28:44 UTC (rev 22397)
@@ -0,0 +1 @@
+0

Added: trunk/busybox/shell/hush_test/hush-misc/pid.tests
===================================================================
--- trunk/busybox/shell/hush_test/hush-misc/pid.tests	                        (rev 0)
+++ trunk/busybox/shell/hush_test/hush-misc/pid.tests	2008-06-17 12:28:44 UTC (rev 22397)
@@ -0,0 +1 @@
+test `(echo $$)` = `echo $$`; echo $?


Property changes on: trunk/busybox/shell/hush_test/hush-misc/pid.tests
___________________________________________________________________
Name: svn:executable
   + *




More information about the busybox-cvs mailing list