rc-list - mailing list for the rc(1) shell
 help / color / mirror / Atom feed
* Re: redirection bug
@ 1992-02-12 16:37 Tom Culliton x2278
  0 siblings, 0 replies; 5+ messages in thread
From: Tom Culliton x2278 @ 1992-02-12 16:37 UTC (permalink / raw)
  To: byron, rc

>> Here's the patch to the extra-fork redirection bug that Chris just
>> mentioned:
>> 
>> (this patch comprises all the changes made to walk.c since rc-1.3beta,
>> but fortunately there is just one other minor change in addition to this
>> one:)

I'm confused.  Do you mean that this is a patch for Chris's bug plus
one other minor thing or that there is one other minor patch to 1.3beta
beside this? (maybe the patch for builtin.c?)  In any case 1.3beta has
held up quite well to substantial abuse aside from the oddness with
SIGINT I noted earlier.

As a side note I've collected several hints for other SCO Unix users if
anyone is intrested, everything from patches to system include files to
small rc functions that improve speed substantially.  For example,

	fn true { return 0 }

is a big win vs. firing up the Bourne shell every time through a loop
with "while (true)".

Tom


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: redirection bug
@ 1992-03-20 19:27 Byron Rakitzis
  0 siblings, 0 replies; 5+ messages in thread
From: Byron Rakitzis @ 1992-03-20 19:27 UTC (permalink / raw)
  To: rc

Yes, Brendan, I've already changed the name to "rc panic". I realized
the inappropriateness of the name some while ago! :-)


^ permalink raw reply	[flat|nested] 5+ messages in thread

* redirection bug
  1992-03-20 17:57 schwartz
@ 1992-03-20 19:17 ` Brendan Kehoe
  0 siblings, 0 replies; 5+ messages in thread
From: Brendan Kehoe @ 1992-03-20 19:17 UTC (permalink / raw)
  To: rc

   Date: Fri, 20 Mar 1992 11:57:46 -0600
   From: schwartz@groucho.cs.psu.edu

   rsh roke exec /bin/rc
   >[0=] >[1=] >[2=] >[3=] >[4=] >[5=] >[6=]
   /import/X11R5/bin/xterm -display roke:0 &
   panic: unexpected node in doredirs!

It may be a little late, but could I persuade you to change name of
panic()? :)  Even though it doesn't have any side effects, I always
wake up whenever I see it make a message like that.  I like my sleep.
:)




^ permalink raw reply	[flat|nested] 5+ messages in thread

* redirection bug
@ 1992-03-20 17:57 schwartz
  1992-03-20 19:17 ` Brendan Kehoe
  0 siblings, 1 reply; 5+ messages in thread
From: schwartz @ 1992-03-20 17:57 UTC (permalink / raw)
  To: rc

rsh roke exec /bin/rc
>[0=] >[1=] >[2=] >[3=] >[4=] >[5=] >[6=]
/import/X11R5/bin/xterm -display roke:0 &
panic: unexpected node in doredirs!


^ permalink raw reply	[flat|nested] 5+ messages in thread

* redirection bug
@ 1992-02-12  4:38 Byron Rakitzis
  0 siblings, 0 replies; 5+ messages in thread
From: Byron Rakitzis @ 1992-02-12  4:38 UTC (permalink / raw)
  To: rc

Here's the patch to the extra-fork redirection bug that Chris just
mentioned:

(this patch comprises all the changes made to walk.c since rc-1.3beta,
but fortunately there is just one other minor change in addition to this
one:)

*** beta/walk.c	Tue Feb 11 22:35:48 1992
--- walk.c	Tue Feb 11 22:23:27 1992
***************
*** 12,18 ****
  bool cond = FALSE;
  
  static bool isallpre(Node *);
! static bool dofork(void);
  static void dopipe(Node *);
  
  /* Tail-recursive version of walk() */
--- 12,18 ----
  bool cond = FALSE;
  
  static bool isallpre(Node *);
! static bool dofork(bool);
  static void dopipe(Node *);
  
  /* Tail-recursive version of walk() */
***************
*** 42,48 ****
  	case nNowait: {
  		int pid;
  		if ((pid = rc_fork()) == 0) {
- 			int fd;
  			setsigdefaults();
  #if defined(SIGTTOU) && defined(SIGTTIN) && defined(SIGTSTP)
  			rc_signal(SIGTTOU, SIG_IGN);	/* Berkeleyized version: put it in a new pgroup. */
--- 42,47 ----
***************
*** 52,59 ****
  #else
  			rc_signal(SIGINT, SIG_IGN);	/* traditional backgrounding procedure: ignore SIGINT */
  #endif
! 			fd = rc_open("/dev/null", rFrom);
! 			mvfd(fd, 0);
  			walk(n->u[0].p, FALSE);
  			exit(getstatus());
  		}
--- 51,57 ----
  #else
  			rc_signal(SIGINT, SIG_IGN);	/* traditional backgrounding procedure: ignore SIGINT */
  #endif
! 			mvfd(rc_open("/dev/null", rFrom), 0);
  			walk(n->u[0].p, FALSE);
  			exit(getstatus());
  		}
***************
*** 141,147 ****
  		break;
  	}
  	case nSubshell:
! 		if (dofork()) {
  			setsigdefaults();
  			walk(n->u[0].p, TRUE);
  			rc_exit(getstatus());
--- 139,145 ----
  		break;
  	}
  	case nSubshell:
! 		if (dofork(TRUE)) {
  			setsigdefaults();
  			walk(n->u[0].p, TRUE);
  			rc_exit(getstatus());
***************
*** 233,239 ****
  	case nBrace:
  		if (n->u[1].p == NULL) {
  			WALK(n->u[0].p, TRUE);
! 		} else if (dofork()) {
  			setsigdefaults();
  			walk(n->u[1].p, TRUE); /* Do redirections */
  			redirq = NULL;   /* Reset redirection queue */
--- 231,237 ----
  	case nBrace:
  		if (n->u[1].p == NULL) {
  			WALK(n->u[0].p, TRUE);
! 		} else if (dofork(parent)) {
  			setsigdefaults();
  			walk(n->u[1].p, TRUE); /* Do redirections */
  			redirq = NULL;   /* Reset redirection queue */
***************
*** 273,283 ****
     waits for the child to finish, setting $status appropriately.
  */
  
! static bool dofork() {
  	void (*handler)(int);
  	int pid, sp;
  
! 	if ((pid = rc_fork()) == 0)
  		return TRUE;
  	redirq = NULL; /* clear out the pre-redirection queue in the parent */
  	fifoq = NULL;
--- 271,281 ----
     waits for the child to finish, setting $status appropriately.
  */
  
! static bool dofork(bool parent) {
  	void (*handler)(int);
  	int pid, sp;
  
! 	if (!parent || (pid = rc_fork()) == 0)
  		return TRUE;
  	redirq = NULL; /* clear out the pre-redirection queue in the parent */
  	fifoq = NULL;


^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~1992-03-20 19:27 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1992-02-12 16:37 redirection bug Tom Culliton x2278
  -- strict thread matches above, loose matches on Subject: below --
1992-03-20 19:27 Byron Rakitzis
1992-03-20 17:57 schwartz
1992-03-20 19:17 ` Brendan Kehoe
1992-02-12  4:38 Byron Rakitzis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).