[comp.sources.bugs] problems with tcsh for 4.3

stjohn@oswego.UUCP (David St. John) (10/02/87)

When I type a tab on the command line as the first character the tcsh gives
me a 'segmentation fault (core dump)'. I really don't have the time to look
for this bug, (it doesn't do this if 4.2 code is used) so I was hoping
that someone else has encountered this error or knows how to fix it (maybe
even fixed it) and could give me some help.

Thanks in advance
			Dave St. John

---------------------------------------------------------------------------
David St. John		      ....!rutgers!rochester!rocksvax!oswego!stjohn
					or
There is more than		Instructional Computing Center
one way to skin a cat:  	SUNY College at Oswego
way #27 -- use an electric	Oswego, N.Y. 13126
	   sander.	
---------------------------------------------------------------------------

conrad@cgl.ucsf.edu (Conrad Huang%CGL) (10/05/87)

In article <433@oswego.UUCP> stjohn@oswego.UUCP (David St. John) writes:
>When I type a tab on the command line as the first character the tcsh gives
>me a 'segmentation fault (core dump)'.

There is a small bug in the tw_add_builtins() function in file tw.init.c
where it passes an uninitialized pointer to another function.  Here is a
context diff:

*** tw.init.c	Fri Oct  2 14:43:03 1987
--- tw.init.old	Mon Oct  5 13:53:30 1987
***************
*** 124,130 ****
  #ifdef	OUTDEF
      for (bptr = bfunc; cp = bptr->bname; bptr++) {
  #endif
! 	tw_add_comm_name (bptr->bname);
      }
  }
  
--- 124,130 ----
  #ifdef	OUTDEF
      for (bptr = bfunc; cp = bptr->bname; bptr++) {
  #endif
! 	tw_add_comm_name (cp);
      }
  }
  
Conrad

paul@tut.cis.ohio-state.edu (Paul W. Placeway) (10/09/87)

In article <433@oswego.UUCP> stjohn@oswego.UUCP (David St. John) writes:
< When I type a tab on the command line as the first character the tcsh gives
< me a 'segmentation fault (core dump)'. I really don't have the time to look
< for this bug, (it doesn't do this if 4.2 code is used) so I was hoping
< that someone else has encountered this error or knows how to fix it (maybe
< even fixed it) and could give me some help.

This is an easy one.  In 4.3 csh, they re-arranged the way that
builtins were indexed, so in tw.init.c, tw_add_builtins() should be:

tw_add_builtins() {
    register struct biltins *bptr;

    for (bptr = bfunc; bptr < &bfunc[nbfunc]; bptr++) { */ /* for 4.3 csh */
/*  for (bptr = bfunc; bptr->bname; bptr++) { */ /* for 4.2 csh */
	tw_add_comm_name (bptr->bname);
    }
}
-- 
		 -- Paul Placeway
		    ...!cbosgd!osu-cis!tut!paul
		    paul@ohio-state.arpa, paul@cis.ohio-state.edu

paul@tut.cis.ohio-state.edu (Paul W. Placeway) (10/09/87)

In article <385@tut.cis.ohio-state.edu> I said...
< tw_add_builtins() {
<     register struct biltins *bptr;
< 
<     for (bptr = bfunc; bptr < &bfunc[nbfunc]; bptr++) { */ /* for 4.3 csh */
< /*  for (bptr = bfunc; bptr->bname; bptr++) { */ /* for 4.2 csh */
< 	tw_add_comm_name (bptr->bname);
<     }
< }

OOPS!!  That should read:

tw_add_builtins() {
    register struct biltins *bptr;

    for (bptr = bfunc; bptr < &bfunc[nbfunc]; bptr++) { /* for 4.3 csh */
/*  for (bptr = bfunc; bptr->bname; bptr++) { */ /* for 4.2 csh */
	tw_add_comm_name (bptr->bname);
    }
}

(note the lack of a */ at the end of the for loop...

-- 
		 -- Paul Placeway
		    ...!cbosgd!osu-cis!tut!paul
		    paul@ohio-state.arpa, paul@cis.ohio-state.edu