From pgl@yoyo.org  Thu May  2 04:16:53 2002
Return-Path: <pgl@yoyo.org>
Received: from armadillo.yoyo.org (armadillo.yoyo.org [195.40.6.65])
	by hub.freebsd.org (Postfix) with ESMTP id B35B337B405
	for <FreeBSD-gnats-submit@freebsd.org>; Thu,  2 May 2002 04:16:51 -0700 (PDT)
Received: by armadillo.yoyo.org (Postfix, from userid 135)
	id 8638144160; Thu,  2 May 2002 12:16:39 +0100 (BST)
Message-Id: <20020502111639.8638144160@armadillo.yoyo.org>
Date: Thu,  2 May 2002 12:16:39 +0100 (BST)
From: Peter Lowe <pgl@yoyo.org>
Reply-To: Peter Lowe <pgl@yoyo.org>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: man(1) fails to display anything if $PAGER is set but blank
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         37662
>Category:       bin
>Synopsis:       man(1) fails to display anything if $PAGER is set but blank
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    eric
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu May 02 04:20:01 PDT 2002
>Closed-Date:    Tue Sep 03 14:55:07 PDT 2002
>Last-Modified:  Tue Sep 03 14:55:07 PDT 2002
>Originator:     Peter Lowe
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
>Environment:
FreeBSD mili.pha.ct.cz 4.5-RELEASE FreeBSD 4.5-RELEASE #1: Thu Apr 25 09:57:40 GMT 2002 pgl@mili.pha.ct.cz:/usr/src/sys/compile/MILI i386


>Description:
man(1) fails to display anything if $PAGER is set but blank. This can be confusing
as unset environment variables and ones with no value appear to be the same when
echoing.
>How-To-Repeat:
[mili:pgl]:~ $ export PAGER=
[mili:pgl]:~ $ man man
>Fix:
patch man's source to check for $PAGER with a non-zero value.
>Release-Note:
>Audit-Trail:

From: David Malone <dwmalone@maths.tcd.ie>
To: Peter Lowe <pgl@yoyo.org>
Cc: FreeBSD-gnats-submit@FreeBSD.org
Subject: Re: bin/37662: man(1) fails to display anything if $PAGER is set but blank
Date: Mon, 6 May 2002 10:14:56 +0100

 On Thu, May 02, 2002 at 12:16:39PM +0100, Peter Lowe wrote:
 > >Fix:
 > patch man's source to check for $PAGER with a non-zero value.
 
 I think this is actually a bug in the FreeBSD version of sh.
 It accepts the command:
 
 	(echo hello |)
 
 as valid, where as most Bourne like shells don't.
 
 	David.

From: "dave" <erigol@optushome.com.au>
To: <pgl@yoyo.org>
Cc: <dwmalone@maths.tcd.ie>, <freebsd-gnats-submit@FreeBSD.org>
Subject: Re: bin/37662: man(1) fails to display anything if $PAGER is set but blank
Date: Tue, 28 May 2002 07:29:46 +1000

 This will work for both 'unset PAGER' and 'export PAGER='
 
    if (pager == NULL || *pager == '\0')
 -    if ((pager = getenv ("PAGER")) == NULL)
 +    if ((pager = getenv ("PAGER")) == NULL || *pager == '\0')
        pager = strdup (PAGER);
 
 Dave
 
 

From: "dave" <erigol@optushome.com.au>
To: <freebsd-gnats-submit@FreeBSD.org>
Cc: <pgl@yoyo.org>, <eric@FreeBSD.org>
Subject: Re: bin/37662: man(1) fails to display anything if $PAGER is set but blank
Date: Sun, 30 Jun 2002 01:23:58 +1000

 Upon re-reading, maybe this, or something similiar would be the appropriate
 solution? Not sure exactly if this handles errors in the correct way. Feel
 free to change at will!
 
 --- man.c.orig  Sun Jun 30 00:49:28 2002
 +++ man.c       Sun Jun 30 01:17:26 2002
 @@ -836,10 +836,16 @@
      {
        char *expander = get_expander (file);
 
 -      if (expander != NULL)
 +      if (expander != NULL && pager != NULL && *pager != '\0')
         snprintf (command, sizeof(command), "%s %s | %s", expander, file,
 pager);
 -      else
 +      else if (expander != NULL && pager != NULL && *pager == '\0')
 +       snprintf (command, sizeof(command), "%s %s", expander, file);
 +      else if (pager != NULL && *pager != '\0')
         snprintf (command, sizeof(command), "%s %s", pager, file);
 +      else {
 +       perror("no expander or pager. do not know how to display manpage");
 +       exit(1);
 +      }
 
        found = do_system_command (command);
      }
 
 
 Dave
 
Responsible-Changed-From-To: freebsd-bugs->eric 
Responsible-Changed-By: eric 
Responsible-Changed-When: Sat Jun 29 11:53:43 PDT 2002 
Responsible-Changed-Why:  
I'm taking good a look at this. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37662 
State-Changed-From-To: open->closed 
State-Changed-By: eric 
State-Changed-When: Tue Sep 3 14:52:06 PDT 2002 
State-Changed-Why:  
committed a variation of the first patch 

http://www.freebsd.org/cgi/query-pr.cgi?pr=37662 
>Unformatted:
