[gnu.bash.bug] core dump after interrupted username completion

hhe@IFI.UIO.NO (11/25/89)

	This bug manifests itself on a sun3 running SunOs 4.0.3_EXPORT
	and on a Decstation 3100 running Ultrix v3.0. Bash is gcc-
	compiled with gnu *alloc (at least on the sun3).

	First, I type part of an username and press TAB for completion.
	The completion takes a while (our system has >2000 users), so
	I press ^C and interrupt the completion.

	Then, I write the username in full with a trailing slash and press
	M-? (filename completion) to see the user's files. Core dump....

skakke 1>bash
skakke 1>>echo $BASH_VERSION
1.04.7
skakke 2>>ls ~stei
skakke 2>>ls ~steinar/free: Called with already freed block argument

Tell anders@ifi.uio.no to fix this someday.
Mailing a bug report...No From line in rmail
done.
Stopping myself...Abort (core dumped)

					Hans Henrik Eriksen (hhe@ifi.uio.no)
					University of Oslo

chet@cwns1.CWRU.EDU (Chet Ramey) (11/27/89)

In article <8911251056.AA19997@slembe.uio.no> hhe@IFI.UIO.NO writes:
>	First, I type part of an username and press TAB for completion.
>	The completion takes a while (our system has >2000 users), so
>	I press ^C and interrupt the completion.
>
>	Then, I write the username in full with a trailing slash and press
>	M-? (filename completion) to see the user's files. Core dump....

As reported by Paul Placeway here some time ago, this is a bug in YP,
not bash.  The Sun getpw* routines close and re-open a socket to the YP
server when they think they need to, which is not always correct.  Based
on this assumption, they inappropriately free resources, which is why bash
dumps core.

Chet Ramey


-- 
Chet Ramey
Network Services Group				"Where's my froggie?"
Case Western Reserve University
chet@ins.CWRU.Edu			

news@bbn.COM (News system owner ID) (12/08/89)

In article <913@cwjcc.CWRU.Edu> chet@cwns1.INS.CWRU.Edu (Chet Ramey) writes:
< In article <8911251056.AA19997@slembe.uio.no> hhe@IFI.UIO.NO writes:
< >	First, I type part of an username and press TAB for completion.
< >	The completion takes a while (our system has >2000 users), so
< >	I press ^C and interrupt the completion.
< >
< >	Then, I write the username in full with a trailing slash and press
< >	M-? (filename completion) to see the user's files. Core dump....
< 
< As reported by Paul Placeway here some time ago, this is a bug in YP,
< not bash.  The Sun getpw* routines close and re-open a socket to the YP
< server when they think they need to, which is not always correct.  Based
< on this assumption, they inappropriately free resources, which is why bash
< dumps core.

Correct.  Here is the latest version of how tcsh side-steps the issue
(calls to fix_yp_bugs() should be placed at the end of each group of
getpw* calls):

   #ifdef YPBUGS

   fix_yp_bugs()
   {
       char *mydomain;

       /*
	* PWP: The previous version assumed that yp domain was the same as the
	* internet name domain.  This isn't allways true.
	* (Thanks to Mat Landau <mlandau@bbn.com> for the original version
	* of this.)
	*/
       if (yp_get_default_domain(&mydomain) == 0) { /* if we got a name */
	   yp_unbind(mydomain);
       }	
   }

   #endif /* YPBUGS */

		-- Paul Placeway
		   (new address: <pplaceway@bbn.com>)