Path: utzoo!attcan!uunet!husc6!ukma!gatech!rutgers!columbia!douglass!dupuy From: dupuy@douglass.columbia.edu (Alexander Dupuy) Newsgroups: comp.unix.wizards Subject: Re: Speaking of ksh Message-ID: <5669@columbia.edu> Date: 4 Jun 88 11:35:28 GMT References: <300@hi3.aca.mcc.com.UUCP> Sender: nobody@columbia.edu Reply-To: dupuy@douglass.columbia.edu (Alexander Dupuy) Followup-To: comp.unix.wizards Organization: Columbia University Computer Science Dept. Lines: 47 In article <300@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@columbia.edu uucp: ...!rutgers!columbia!dupuy