From brian@Awfulhak.org  Tue Jul 11 18:10:42 2000
Return-Path: <brian@Awfulhak.org>
Received: from Awfulhak.org (tun.AwfulHak.org [194.242.139.173])
	by hub.freebsd.org (Postfix) with ESMTP id E73A237BABC
	for <FreeBSD-gnats-submit@freebsd.org>; Tue, 11 Jul 2000 18:09:31 -0700 (PDT)
	(envelope-from brian@Awfulhak.org)
Received: from hak.lan.Awfulhak.org (root@hak.lan.awfulhak.org [172.16.0.12])
	by Awfulhak.org (8.9.3/8.9.3) with ESMTP id CAA84762
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 12 Jul 2000 02:10:08 +0100 (BST)
	(envelope-from brian@hak.lan.Awfulhak.org)
Received: (from brian@localhost)
	by hak.lan.Awfulhak.org (8.9.3/8.9.3) id CAA29246;
	Wed, 12 Jul 2000 02:09:26 +0100 (BST)
	(envelope-from brian)
Message-Id: <200007120109.CAA29246@hak.lan.Awfulhak.org>
Date: Wed, 12 Jul 2000 02:09:26 +0100 (BST)
From: brian@Awfulhak.org
Reply-To: brian@Awfulhak.org
To: FreeBSD-gnats-submit@freebsd.org
Subject: mergemasters interpretation of $PAGER is incorrect [PATCH]
X-Send-Pr-Version: 3.2

>Number:         19858
>Category:       bin
>Synopsis:       mergemasters interpretation of $PAGER is incorrect [PATCH]
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    billf
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Tue Jul 11 18:20:00 PDT 2000
>Closed-Date:    Wed Aug 9 13:59:34 PDT 2000
>Last-Modified:  Wed Aug  9 14:10:01 PDT 2000
>Originator:     Brian Somers
>Release:        FreeBSD 5.0-CURRENT i386
>Organization:
Awfulhak Ltd.
>Environment:

	Stock -current system

>Description:

	Mergemaster treats ``more'' as an exception to it's requirement
that $PAGER specifies a full path name.  It also tests if ${PAGER%% *}
is executable which is incorrect when ${PAGER} is not absolute.

>How-To-Repeat:

	Run mergemaster with a $PAGER that contains a non-absolute path name.

>Fix:

Index: mergemaster.sh
===================================================================
RCS file: /home/ncvs/src/usr.sbin/mergemaster/mergemaster.sh,v
retrieving revision 1.8
diff -u -r1.8 mergemaster.sh
--- mergemaster.sh	2000/05/12 03:09:57	1.8
+++ mergemaster.sh	2000/06/30 10:04:40
@@ -252,7 +252,7 @@
 #
 case "${DONT_CHECK_PAGER}" in
 '')
-  while [ "${PAGER}" != "more" -a -n "${PAGER}" -a ! -x "${PAGER%% *}" ]; do
+  while ! type "${PAGER%% *}" >/dev/null && [ -n "$PAGER" ]; do
     echo " *** Your PAGER environment variable specifies '${PAGER}', but"
     echo "     I cannot execute it. In general it is good practice to"
     echo "     specify the full path for environment variables like"


>Release-Note:
>Audit-Trail:

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: brian@Awfulhak.org
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, Doug Barton <DougB@gorean.org>
Subject: Re: bin/19858: mergemasters interpretation of $PAGER is incorrect [PATCH] 
Date: Wed, 12 Jul 2000 10:30:58 +0200

 On Wed, 12 Jul 2000 02:09:26 +0100, brian@Awfulhak.org wrote:
 
 > >Number:         19858
 > >Category:       bin
 > >Synopsis:       mergemasters interpretation of $PAGER is incorrect [PATCH]
 
 Since Doug is not a committer, I can't assign this PR to him.  As far as
 I know, he was going to come up with some text to clarify mergemaster's
 handling of the PATH environment variable.
 
 Ciao,
 Sheldon.
 
Responsible-Changed-From-To: freebsd-bugs->billf 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Wed Jul 12 05:43:46 PDT 2000 
Responsible-Changed-Why:  
Over to the one of the two maintainers who is a committer. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19858 

From: Brian Somers <brian@Awfulhak.org>
To: Sheldon Hearn <sheldonh@uunet.co.za>
Cc: brian@Awfulhak.org, FreeBSD-gnats-submit@FreeBSD.org,
	Doug Barton <DougB@gorean.org>, brian@storm.FreeBSD.org.uk
Subject: Re: bin/19858: mergemasters interpretation of $PAGER is incorrect [PATCH] 
Date: Wed, 12 Jul 2000 14:04:47 +0100

 > 
 > 
 > On Wed, 12 Jul 2000 02:09:26 +0100, brian@Awfulhak.org wrote:
 > 
 > > >Number:         19858
 > > >Category:       bin
 > > >Synopsis:       mergemasters interpretation of $PAGER is incorrect [PATCH]
 > 
 > Since Doug is not a committer, I can't assign this PR to him.  As far as
 > I know, he was going to come up with some text to clarify mergemaster's
 > handling of the PATH environment variable.
 
 Yes.  I sent this patch to Doug and got no response.  While cleaning 
 out the `M's in my tree I spotted this and figured I'd make the local 
 modification go away.  Normally I'd commit, but as Doug has taken 
 exception to previous commits to mergemaster, I used send-pr.
 
 I'm sure Doug will find this eventually and either argue that it 
 should be closed or committed :-)
 
 > Ciao,
 > Sheldon.
 
 -- 
 Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
       <http://www.Awfulhak.org>                   <brian@[uk.]OpenBSD.org>
 Don't _EVER_ lose your sense of humour !
 
 
 

From: Doug Barton <DougB@gorean.org>
To: Brian Somers <brian@Awfulhak.org>
Cc: Sheldon Hearn <sheldonh@uunet.co.za>,
	FreeBSD-gnats-submit@FreeBSD.org, brian@storm.FreeBSD.org.uk
Subject: Re: bin/19858: mergemasters interpretation of $PAGER is incorrect 
 [PATCH]
Date: Wed, 12 Jul 2000 09:36:14 -0700

 Brian Somers wrote:
 > 
 > >
 > >
 > > On Wed, 12 Jul 2000 02:09:26 +0100, brian@Awfulhak.org wrote:
 > >
 > > > >Number:         19858
 > > > >Category:       bin
 > > > >Synopsis:       mergemasters interpretation of $PAGER is incorrect [PATCH]
 > >
 > > Since Doug is not a committer, I can't assign this PR to him.  As far as
 > > I know, he was going to come up with some text to clarify mergemaster's
 > > handling of the PATH environment variable.
 > 
 > Yes.  I sent this patch to Doug and got no response. 
 
 	Sorry... I thought I'd responded to that. I had some mergemaster time
 carved out over the Independence day holiday, but it got sucked up by
 family commitments. I was planning to return to it this weekend. I need to
 experiment with the behavior of your patch under various conditions, but it
 looks like a good concept. 
 
 > While cleaning
 > out the `M's in my tree I spotted this and figured I'd make the local
 > modification go away.  Normally I'd commit, but as Doug has taken
 > exception to previous commits to mergemaster, I used send-pr.
 
 	I appreciate the courtesy. 
  
 > I'm sure Doug will find this eventually and either argue that it
 > should be closed or committed :-)
 
 	*Nod* Been extra busy at work lately, so I'm a day or two behind on my
 freebsd mail. 
 
 Doug
 

From: Doug Barton <DougB@gorean.org>
To: brian@Awfulhak.org
Cc: FreeBSD-gnats-submit@freebsd.org
Subject: Re: bin/19858: mergemasters interpretation of $PAGER is incorrect 
 [PATCH]
Date: Thu, 27 Jul 2000 14:13:09 -0700

 This is a multi-part message in MIME format.
 --------------D0D4FF9966126A55F41FF9FE
 Content-Type: text/plain; charset=us-ascii
 Content-Transfer-Encoding: 7bit
 
 brian@Awfulhak.org wrote:
 
 > >Synopsis:       mergemasters interpretation of $PAGER is incorrect [PATCH]
 > >Description:
 > 
 >         Mergemaster treats ``more'' as an exception to it's requirement
 > that $PAGER specifies a full path name. 
 
 	The reason being that it's contained in the PATH that mm already uses, so
 I didn't need to worry about testing for it. 
 
 > It also tests if ${PAGER%% *}
 > is executable which is incorrect when ${PAGER} is not absolute.
 
 	Yes, someone suggested that fix to me....  :)
 
 	Your solution of using 'type' is quite elegant, and I've incorporated that
 into the following patches for -Stable and -Current, along with the
 previously discussed amendments to the message about PAGER, and taking the
 presence of 'less' in the system into account. 
 
 	Brian, please feel free to commit the attached patches. I sent them to
 someone else already, but he hasn't responded yet. 
 
 Thanks,
 
 Doug
 --------------D0D4FF9966126A55F41FF9FE
 Content-Type: text/plain; charset=us-ascii;
  name="mm-4.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="mm-4.diff"
 
 Index: mergemaster.sh
 ===================================================================
 RCS file: /usr/ncvs/src/usr.sbin/mergemaster/mergemaster.sh,v
 retrieving revision 1.6
 diff -u -r1.6 mergemaster.sh
 --- mergemaster.sh	2000/02/12 22:14:02	1.6
 +++ mergemaster.sh	2000/07/25 10:12:49
 @@ -107,15 +107,14 @@
  #
  case "${DONT_CHECK_PAGER}" in
  '')
 -  if [ -n "${PAGER}" -a ! -x "${PAGER%% *}" ]; then
 +  if ! type "${PAGER%% *}" >/dev/null && [ -n "${PAGER}" ]; then
      echo " *** Your PAGER environment variable specifies '${PAGER}', but"
 -    echo "     I cannot execute it. In general it is good practice to"
 -    echo "     specify the full path for environment variables like"
 -    echo "     PAGER and EDITOR. Meanwhile, what would you like to do?"
 +    echo "     due to the limited PATH that I use for security reasons,"
 +    echo "     I cannot execute it. So, what would you like to do?"
      echo ''
      echo "  Use 'e' to exit mergemaster and fix your PAGER variable"
 -    if [ -x /usr/local/bin/less ]; then
 -    echo "  Use 'l' to set PAGER to /usr/local/bin/less for this run"
 +    if [ -x /usr/bin/less -o -x /usr/local/bin/less ]; then
 +    echo "  Use 'l' to set PAGER to 'less' for this run"
      fi
      echo "  Use 'm' to use plain old 'more' as your PAGER for this run"
      echo ''
 @@ -127,7 +126,17 @@
         exit 0
         ;;
      [lL]*)
 -       PAGER=/usr/local/bin/less
 +       if [ -x /usr/bin/less ]; then
 +         PAGER=/usr/bin/less
 +       elif [ -x /usr/local/bin/less ]; then
 +         PAGER=/usr/local/bin/less
 +       else
 +         echo ''
 +         echo " *** Fatal Error:"
 +         echo "     You asked to use 'less' as your pager, but I can't"
 +         echo "     find it in /usr/bin or /usr/local/bin"
 +         exit 1
 +       fi
         ;;
      *)
         PAGER=more
 
 --------------D0D4FF9966126A55F41FF9FE
 Content-Type: text/plain; charset=us-ascii;
  name="mm-5.diff"
 Content-Transfer-Encoding: 7bit
 Content-Disposition: inline;
  filename="mm-5.diff"
 
 Index: mergemaster.sh
 ===================================================================
 RCS file: /usr/ncvs/src/usr.sbin/mergemaster/mergemaster.sh,v
 retrieving revision 1.8
 diff -u -r1.8 mergemaster.sh
 --- mergemaster.sh	2000/05/12 03:09:57	1.8
 +++ mergemaster.sh	2000/07/25 10:16:40
 @@ -252,15 +252,14 @@
  #
  case "${DONT_CHECK_PAGER}" in
  '')
 -  while [ "${PAGER}" != "more" -a -n "${PAGER}" -a ! -x "${PAGER%% *}" ]; do
 +  while ! type "${PAGER%% *}" >/dev/null && [ -n "${PAGER}" ]; do
      echo " *** Your PAGER environment variable specifies '${PAGER}', but"
 -    echo "     I cannot execute it. In general it is good practice to"
 -    echo "     specify the full path for environment variables like"
 -    echo "     PAGER and EDITOR. Meanwhile, what would you like to do?"
 +    echo "     due to the limited PATH that I use for security reasons,"
 +    echo "     I cannot execute it. So, what would you like to do?"
      echo ''
      echo "  Use 'e' to exit mergemaster and fix your PAGER variable"
 -    if [ -x /usr/local/bin/less ]; then
 -    echo "  Use 'l' to set PAGER to /usr/local/bin/less for this run"
 +    if [ -x /usr/bin/less -o -x /usr/local/bin/less ]; then
 +    echo "  Use 'l' to set PAGER to 'less' for this run"
      fi
      echo "  Use 'm' to use plain old 'more' as your PAGER for this run"
      echo ''
 @@ -272,8 +271,16 @@
         exit 0
         ;;
      [lL])
 -       if [ -x /usr/local/bin/less ]; then
 +       if [ -x /usr/bin/less ]; then
 +         PAGER=/usr/bin/less
 +       elif [ -x /usr/local/bin/less ]; then
           PAGER=/usr/local/bin/less
 +       else
 +         echo ''
 +         echo " *** Fatal Error:"
 +         echo "     You asked to use 'less' as your pager, but I can't"
 +         echo "     find it in /usr/bin or /usr/local/bin"
 +         exit 1
         fi
         ;;
      [mM]|'')
 
 --------------D0D4FF9966126A55F41FF9FE--
 
 
State-Changed-From-To: open->closed 
State-Changed-By: brian 
State-Changed-When: Wed Aug 9 13:59:34 PDT 2000 
State-Changed-Why:  
Fixed in -current.  I'll MFC in 1 week assuming no problems. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=19858 

From: Brian Somers <brian@Awfulhak.org>
To: Doug Barton <DougB@gorean.org>
Cc: brian@Awfulhak.org, FreeBSD-gnats-submit@FreeBSD.org,
	brian@Awfulhak.org
Subject: Re: bin/19858: mergemasters interpretation of $PAGER is incorrect [PATCH] 
Date: Wed, 09 Aug 2000 21:52:18 +0100

 [.....]
 > 	Brian, please feel free to commit the attached patches. I sent them to
 > someone else already, but he hasn't responded yet. 
 
 Sorry for the delay... I was away.
 
 I've committed the changes, although the diffs didn't apply cleanly 
 :-/
 
 > Thanks,
 
 Thank you.
 
 > Doug
 
 -- 
 Brian <brian@Awfulhak.org>                        <brian@[uk.]FreeBSD.org>
       <http://www.Awfulhak.org>                   <brian@[uk.]OpenBSD.org>
 Don't _EVER_ lose your sense of humour !
 
 
 
>Unformatted:
