From owner-freebsd-current Fri Dec 20 12:27:06 1996 Return-Path: Received: (from root@localhost) by freefall.freebsd.org (8.8.4/8.8.4) id MAA06689 for current-outgoing; Fri, 20 Dec 1996 12:27:06 -0800 (PST) Received: from skynet.ctr.columbia.edu (skynet.ctr.columbia.edu [128.59.64.70]) by freefall.freebsd.org (8.8.4/8.8.4) with SMTP id MAA06683 for ; Fri, 20 Dec 1996 12:27:01 -0800 (PST) Received: (from wpaul@localhost) by skynet.ctr.columbia.edu (8.6.12/8.6.9) id PAA01194; Fri, 20 Dec 1996 15:24:39 -0500 From: Bill Paul Message-Id: <199612202024.PAA01194@skynet.ctr.columbia.edu> Subject: Re: tcsh NIS strangeness To: kuku@gilberto.physik.rwth-aachen.de Date: Fri, 20 Dec 1996 15:24:38 -0500 (EST) Cc: current@freebsd.org In-Reply-To: <199612200834.JAA03309@gilberto.physik.rwth-aachen.de> from "Christoph Kukulies" at Dec 20, 96 09:34:49 am X-Mailer: ELM [version 2.4 PL24] Content-Type: text Sender: owner-current@freebsd.org X-Loop: FreeBSD.org Precedence: bulk Of all the gin joints in all the towns in all the world, Christoph Kukulies had to walk into mine and say: > > > > > Okay, well I just compiled tcsh 6.07.02 on my FreeBSD 2.2-ALPHA test > > box. It seems to work fine. For the record, I compiled it as follows: > > > > - Unpack archive > > - cd tcsh-6.07.02 > > - cp config/bsd4.4 config.h > > - vi Makefile.std (add -lcrypt to the LIBES line) > > - make -f Makefile.std > > I built it from ports, btw, and there are a bunch of patches, > most of them NLS related, one deals with .login .cshrc and one > with setpgrp/setpgid. Anyway, I'll try your binary. Yikes!!! I found the problem! Here's a patch: *** yplib.c.orig Fri Dec 20 14:37:49 1996 --- yplib.c Fri Dec 20 14:38:11 1996 *************** *** 79,84 **** --- 79,85 ---- int (*ypresp_allfn)(); void *ypresp_data; + static void _yp_unbind __P(( struct dom_binding * )); struct dom_binding *_ypbindlist; static char _yp_domain[MAXHOSTNAMELEN]; int _yplib_timeout = 10; *************** *** 230,236 **** ysd = _ypbindlist; while(ysd) { if(ysd->dom_client != NULL) ! clnt_destroy(ysd->dom_client); ysd2 = ysd->dom_pnext; free(ysd); ysd = ysd2; --- 231,237 ---- ysd = _ypbindlist; while(ysd) { if(ysd->dom_client != NULL) ! _yp_unbind(ysd); ysd2 = ysd->dom_pnext; free(ysd); ysd = ysd2; When ktracing ls, I noticed that the problem was that it couldn't write to stdout (descriptor 1). When you fork(), _yp_dobind() is supposed to invalidate all binding information in the child so as not to share descriptors with the parent. The trouble is that you have to be _very_ careful when you do this since the top level application may have have stepped on the cached socket descriptors. The _yp_unbind() function tests for this and deals with it, so that works, whereas summarily calling clnt_destroy() may destroy a descriptor that doesn't belong to us. I compiled a new tcsh with a replacment yplib.o that has this patch and put in in place of the old one on ftp.ctr.columbia.edu:/pub/misc/freebsd. If you can test it for me and confirm that it works, or apply the patch and build a new libc.so, I would appreciate it. I have already committed this patch to -current, but I want to make sure it fixes your problem before I put it in the 2.2 branch. -Bill -- ============================================================================= -Bill Paul (212) 854-6020 | System Manager, Master of Unix-Fu Work: wpaul@ctr.columbia.edu | Center for Telecommunications Research Home: wpaul@skynet.ctr.columbia.edu | Columbia University, New York City ============================================================================= "It is not I who am crazy; it is I who am mad!" - Ren Hoek, "Space Madness" =============================================================================