NetBSD Problem Report #365

From gnats  Mon Jul 25 18:01:08 1994
Received: from Collatz.McRCIM.McGill.EDU (Collatz.McRCIM.McGill.EDU [132.206.78.1]) by sun-lamp.cs.berkeley.edu (8.6.9/8.6.9) with ESMTP id SAA10091 for <gnats-bugs@sun-lamp.cs.berkeley.edu>; Mon, 25 Jul 1994 18:01:05 -0700
Message-Id: <199407260100.VAA01123@Collatz.McRCIM.McGill.EDU>
Date: Mon, 25 Jul 1994 21:00:33 -0400
From: der Mouse <mouse@Collatz.McRCIM.McGill.EDU>
Reply-To: mouse@Collatz.McRCIM.McGill.EDU
To: gnats-bugs@sun-lamp.cs.berkeley.edu
Subject: $MANPATH vs two-arg man(1)
X-Send-Pr-Version: 3.2

>Number:         365
>Category:       bin
>Synopsis:       man(1) ignores the section argument if $MANPATH is set
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    gnats-admin
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jul 25 18:05:04 +0000 1994
>Closed-Date:    Thu Apr 20 04:12:21 +0000 1995
>Last-Modified:  
>Originator:     der Mouse
>Release:        
>Organization:

>Environment:
	SPARC
	Sources supped from sun-lamp just this afternoon (1994 July 25)
	sccsid strings:
		config.c:static char sccsid[] = "@(#)config.c	8.5 (Berkeley) 11/26/93";
		man.c:static char sccsid[] = "@(#)man.c	8.13 (Berkeley) 12/20/93";
>Description:
	man(1) ignores the section argumennt when a MANPATH environment
	variable exists.  (It still does minimal checking, to tell the
	difference between a section argument and another man page
	name.)
>How-To-Repeat:
	Set a MANPATH environment variable (eg,
	"setenv MANPATH /usr/share/man").  Ask for a man page that
	exists in more than one section, with an explicit section
	argument.  Notice you always get the same one, regardless of
	what the section argument is, even if the man page doesn't
	exist in that section.

	Unset the MANPATH variable.  Repeat the attempts, and notice
	that this time man pays attention to the section argument.

	Precisely:

		[Callisto] 9> mkdir /tmp/man
		[Callisto] 10> cp /usr/src/usr.bin/man/* /tmp/man
		[Callisto] 11> cd /tmp/man
		[Callisto] 12> make
		cc -O   -c config.c
		cc -O   -c man.c
		cc   -o man config.o man.o 
		nroff -mandoc man.1 > man.0
		nroff -mandoc man.conf.5 > man.conf.0
		[Callisto] 13> setenv MANPATH /usr/share/man
		[Callisto] 14> /tmp/man/man 5 crontab
	(at this point, $PAGER fires up, displaying crontab(1))
		[Callisto] 15> unsetenv MANPATH
		[Callisto] 16> /tmp/man/man 5 crontab
	(at this point, $PAGER fires up, displaying crontab(5))

	This also happens if MANPATH is unset but the -M flag is used,
	as in "/tmp/man/man -M /usr/share/man 5 crontab" in the sample
	above.  -m does not provoke the misbehavior.
>Fix:
	Not known, sorry.  I suspect the code around lines 150-275 of
	man.c, but haven't looked at it in enough detail to feel I know
	what's going on there.
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->closed 
State-Changed-By: mycroft 
State-Changed-When: Wed Apr 19 21:12:21 PDT 1995 
State-Changed-Why:  
Fixed. 
>Unformatted:

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.