Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 20 Dec 1996 15:24:38 -0500 (EST)
From:      Bill Paul <wpaul@skynet.ctr.columbia.edu>
To:        kuku@gilberto.physik.rwth-aachen.de
Cc:        current@freebsd.org
Subject:   Re: tcsh NIS strangeness
Message-ID:  <199612202024.PAA01194@skynet.ctr.columbia.edu>
In-Reply-To: <199612200834.JAA03309@gilberto.physik.rwth-aachen.de> from "Christoph Kukulies" at Dec 20, 96 09:34:49 am

next in thread | previous in thread | raw e-mail | index | archive | help
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"
=============================================================================



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199612202024.PAA01194>