Forwarded message:
Date: Sat, 23 Dec 1995 12:57:59 -0500 (EST)
From: "H.J. Lu" <hjl@nynexst.com>
Subject: libc-5.3.0 caught a bug in man.
To: Kevin Donovan <kdonovan@panix.com>
Cc: David Engel <david@ods.com>, G.Wilford@ee.surrey.ac.uk,
        Linux Developer -- Craig Groeschel <craig@metrolink.com>,
        David Bonn <bonn@eskimo.com>, "Eric C. Newton" <ecn@clark.net>,
        Ulrich Drepper <drepper@ipd.info.uni-karlsruhe.de>,
        Huw Rogers <Huw.Rogers@ska.com>, Laser Moon <ian@lasermoon.co.uk>,
        "John W. Christy" <jchristy@bga.com>, Warner Losh <imp@village.org>,
        Mat Hostetter <mat@ardi.com>, Brian Bourgault <brian@mathworks.com>,
        Michael Meissner <meissner@cygnus.com>,
        Kenneth Osterberg <lmfken@lmf.ericsson.se>,
        Kenneth Albanowski <kjahds@kjahds.com>,
        Andy Dougherty <doughera@lafcol.lafayette.edu>,
        The Linux C library list <linux-gcc@vger.rutgers.edu>
In-Reply-To: <199512231514.KAA15439@panix4.panix.com>
Message-Id: <Pine.3.07.9512231255.A627-c100000@jalod>
Mime-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII


On Sat, 23 Dec 1995, Kevin Donovan wrote:

> I installed libc-5.3.0 last evening from libc-5.3.0.bin.tar.gz and I
> can't use the man command to read manual pages.  libc-5.2.19 gave the
> same problem.  Man works fine with libc-5.2.18, and I have now gone
> back to 5.2.18.
> 
> I am using version 2.7.2 of gcc (the "old" gcc), which I compiled
> myself.  Kernel version is 1.3.47.  The man pager I use keeps
> references to the pages in dbm files.  I can execute /usr/bin/man, but
> it crashes if I try to read any documents.  If I type "man --version",
> it responds:
> 
> man, version 2.3.5, db 2.3.1, April 21st, 1995 (G.Wilford@ee.surrey.ac.uk)
> 
> If you to need to know more, please let me know.
> 
> Kevin

The new malloc from Doug Lea caught a bug in

man, version 2.3.10, db 2.3.1, July 12th, 1995 (G.Wilford@ee.surrey.ac.uk)

The setlocale man page under Linux doesn't say the string returned by
setlocale () will be overwritten by a subsequent call to setlocale(),
which is mentioned in the SunOS version.

BTW, libc 5.3.0 looks pretty good. If you find your program doesn't
work anymore with 5.3.0, please debug your program first. man
is the second bogus libc 5.3.0 report I got.


H.J.
-----
diff -rc man-2.3.10/src/catman.c man-2.3.10.fixed/src/catman.c
*** man-2.3.10/src/catman.c	Wed Sep 20 14:31:58 1995
--- man-2.3.10.fixed/src/catman.c	Sat Dec 23 12:54:52 1995
***************
*** 387,392 ****
--- 387,396 ----
  
  #ifdef HAVE_SETLOCALE	
  	locale = NLS_INIT;
+ 	if (locale)
+ 	{
+ 		locale = xstrdup (locale);
+ 	}
  #endif /* HAVE_SETLOCALE */
  
  	while ((c = getopt_long (argc, argv, args,
Only in man-2.3.10.fixed/src: lexgrog.c
diff -rc man-2.3.10/src/man.c man-2.3.10.fixed/src/man.c
*** man-2.3.10/src/man.c	Wed Sep 20 14:31:58 1995
--- man-2.3.10.fixed/src/man.c	Sat Dec 23 12:50:06 1995
***************
*** 675,680 ****
--- 675,684 ----
  	/* initialise the locale */
  #ifdef HAVE_SETLOCALE
  	internal_locale = NLS_INIT;
+ 	if (internal_locale)
+ 	{
+ 		internal_locale = xstrdup (internal_locale);
+ 	}
  #endif /* HAVE_SETLOCALE */
  
  /* export argv, it might be needed when invoking the vendor supplied browser */
***************
*** 730,735 ****
--- 734,743 ----
  	   issued as an argument or in $MANOPT */
  	if (locale) {
  		internal_locale = setlocale(LC_MESSAGES, locale);
+ 		if (internal_locale)
+ 		{
+ 			internal_locale = xstrdup (internal_locale);
+ 		}
  #  ifdef NLS
  		NLS_CLOSE;
  		catfd = catopen("man_db", MCLoadBySet);
diff -rc man-2.3.10/src/whatis.c man-2.3.10.fixed/src/whatis.c
*** man-2.3.10/src/whatis.c	Wed Sep 20 14:31:59 1995
--- man-2.3.10.fixed/src/whatis.c	Sat Dec 23 12:54:39 1995
***************
*** 497,502 ****
--- 497,506 ----
  
  #ifdef HAVE_SETLOCALE
  	locale = NLS_INIT;
+ 	if (locale)
+ 	{
+ 		locale = xstrdup (locale);
+ 	}
  #endif /* HAVE_SETLOCALE */
  	                
  	while ((c = getopt_long (argc, argv, args,


Wilf.
-- 
	Dept. of Electronic Eng.	Phone: Mon-Wed: 01483-259826
	University of Surrey		Phone: Thu-Fri: 01483-300800 x2259
	Guildford			Fax: 01483-34139    
	Surrey GU2 5XH.			email: g.wilford@ee.surrey.ac.uk
