Speaking of ksh

Alexander Dupuy dupuy at douglass.columbia.edu
Sat Jun 4 21:35:28 AEST 1988


In article <300 at hi3.aca.mcc.com.UUCP> King Ables writes: We recently converted
>a sun server to run YP (like the rest of the ones in our department) and I was
>asked to fix ksh so that ~username would work again (since there is no
>significant passwd file on the clients of that server anymore).

>I thought to myself "no big deal... probably just a recompile so the
>getpwnam() call works with YP."  WRONG.  Of course, ksh opens the passwd file
>and reads it.  OK.  Big deal, I yank that code and I put in a call to
>getpwnam() instead... seemed real simple.  But ever since then I've been
>getting segmentation faults down in the bowels of the YP code.

>Has anybody "fixed" ksh anywhere to do this?  I can't believe it can be *THAT*
>difficult... 

Here's the fix: (credit to Chris Maio for finally tracking this down - why he
has to wait until we started running YP on his workstation I don't know :-)

First rip out the crap in shlib/tilde.c and make it use getpwnam() instead.
(It sounds like you have already done this).

Then, patch sh/io.c (your line numbers will vary).

*** old/io.c	Wed Nov 18 11:17:03 1987
--- io.c	Sat Dec  5 18:19:57 1987
***************
*** 606,611 ****
--- 610,622 ----
  
  	if ((iop->_flag&_IOREAD) == 0)
  		return(EOF);
+ 
+ #if BUGFIX
+ 	/* will this let us call getpwnam? */
+ 	if (iop->_base == 0)
+ 		_findbuf(iop);
+ #endif BUGFIX
+ 
  	if(fnobuff(iop))
  	{
  		/* unbuffered reads needed for pipes */

This patch is for ksh-i, but it ought to work for the older ksh as well.

@alex
-- 
inet: dupuy at columbia.edu
uucp: ...!rutgers!columbia!dupuy



More information about the Comp.unix.wizards mailing list