From philh@mincom.com  Thu Dec 23 18:44:32 1999
Return-Path: <philh@mincom.com>
Received: from blocker.mincom.com (blocker2.mincom.com [203.15.57.34])
	by hub.freebsd.org (Postfix) with ESMTP id 873101574D
	for <FreeBSD-gnats-submit@freebsd.org>; Thu, 23 Dec 1999 18:44:08 -0800 (PST)
	(envelope-from philh@mincom.com)
Received: (from uucp@localhost)
	by blocker.mincom.com (8.9.3/8.9.3) id MAA81240
	for <FreeBSD-gnats-submit@freebsd.org>; Fri, 24 Dec 1999 12:44:06 +1000 (EST)
	(envelope-from philh@portal.mincom.oz.au)
Received: from portal.mincom.oz.au(172.17.100.4)
 via SMTP by blocker.mincom.oz.au, id smtpdd81236; Fri Dec 24 12:44:01 1999
Received: (from philh@localhost)
	by portal.mincom.oz.au (8.9.3/8.8.5) id MAA61440;
	Fri, 24 Dec 1999 12:44:02 +1000 (EST)
Message-Id: <199912240244.MAA61440@portal.mincom.oz.au>
Date: Fri, 24 Dec 1999 12:44:02 +1000 (EST)
From: Phil Homewood <philh@mincom.com>
Reply-To: philh@mincom.com
To: FreeBSD-gnats-submit@freebsd.org
Subject: [PATCH] perl5 Sys::Hostname fails if no PATH set
X-Send-Pr-Version: 3.2

>Number:         15662
>Category:       bin
>Synopsis:       [PATCH] perl5 Sys::Hostname fails if no PATH set
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    markm
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Dec 23 18:50:02 PST 1999
>Closed-Date:    Mon Mar 28 12:51:04 GMT 2005
>Last-Modified:  Mon Mar 28 12:51:04 GMT 2005
>Originator:     Phil Homewood
>Release:        FreeBSD 3.3-STABLE i386
>Organization:
Mincom Limited
>Environment:

	

>Description:

perl5's Sys::Hostname.pm fails to get local host name if called
with undefined $ENV{'PATH'}. This bug was introduced in r1.2 of
src/contrib/perl5/lib/Hostname.pm with the taint fixes for
backticked commands.

The value returned by each eval{} block is in fact $ENV{'PATH'}
instead of the (defined or undefined nature of) $host.

Thus, the block that calls `hostname` will return true IFF the
path is set. If it isn't, the `uname` block fails in the same
way and the function croaks.

>How-To-Repeat:

Run a script that calls Sys::Hostname::hostname() with an undefined
PATH. Watch it croak.


>Fix:
	

--- Hostname.pm.orig	Fri Oct  1 09:31:37 1999
+++ Hostname.pm	Fri Dec 24 12:30:54 1999
@@ -98,6 +98,7 @@
 	local $SIG{__DIE__};
 	$host = `(hostname) 2>/dev/null`; # bsdish
 	$ENV{'PATH'} = $pathstack;
+	$host;
     }
 
     # method 4 - sysV uname command (may truncate)
@@ -107,6 +108,7 @@
 	local $SIG{__DIE__};
 	$host = `uname -n 2>/dev/null`; ## sysVish
 	$ENV{'PATH'} = $pathstack;
+	$host;
     }
 
     # method 5 - Apollo pre-SR10


>Release-Note:
>Audit-Trail:
Responsible-Changed-From-To: freebsd-bugs->markm 
Responsible-Changed-By: sheldonh 
Responsible-Changed-When: Fri Dec 24 00:38:23 PST 1999 
Responsible-Changed-Why:  
Mark's the perl5 maintainer. 

From: Sheldon Hearn <sheldonh@uunet.co.za>
To: philh@mincom.com
Cc: FreeBSD-gnats-submit@FreeBSD.ORG, markm@FreeBSD.org
Subject: Re: misc/15662: [PATCH] perl5 Sys::Hostname fails if no PATH set 
Date: Fri, 24 Dec 1999 10:39:25 +0200

 On Fri, 24 Dec 1999 12:44:02 +1000, Phil Homewood wrote:
 
 > perl5's Sys::Hostname.pm fails to get local host name if called
 > with undefined $ENV{'PATH'}. This bug was introduced in r1.2 of
 > src/contrib/perl5/lib/Hostname.pm with the taint fixes for
 > backticked commands.
 
 I can't help thinking that the real fix for the problem is to get
 SYS_gethostname into syscall.ph .
 
 However, given what r1.2 of the file looks like, your fix is an obvious
 must-do unless we're going to try to make method 2 (syscall) work.
 
 Ciao,
 Sheldon.
 

From: Phil Homewood <pdh@snapgear.com>
To: freebsd-gnats-submit@FreeBSD.org
Cc:  
Subject: Re: misc/15662: [PATCH] perl5 Sys::Hostname fails if no PATH set
Date: Tue, 22 Oct 2002 09:55:51 +1000

 Reports on -stable indicate this problem has broken the
 SpamAssassin port, and the patch herein fixes it.
 
 Three years is a long time. Could someone please commit
 this to -STABLE?
 -- 
 Phil Homewood, Systems Janitor, www.SnapGear.com
 pdh@snapgear.com Ph: +61 7 3435 2810 Fx: +61 7 3891 3630
 SnapGear - Custom Embedded Solutions and Security Appliances

From: "Michael A. Dickerson" <mikey@singingtree.com>
To: freebsd-gnats-submit@freebsd.org
Cc:  
Subject: Re: misc/15662: [PATCH] perl5 Sys::Hostname fails if no PATH set
Date: Mon, 21 Apr 2003 17:44:25 -0700 (PDT)

 I can confirm that this bug still exists in 4.8-STABLE as of 21 April
 2003, and the above patch still fixes it.  The bug prevents one from
 running spamassassin from /etc/aliases.  It sure would be nice if somebody
 would commit this..
 
 M. Dickerson
 
State-Changed-From-To: open->closed 
State-Changed-By: markm 
State-Changed-When: Mon Mar 28 12:50:16 GMT 2005 
State-Changed-Why:  
Base-perl is deprecated. This works in the port version. 

http://www.freebsd.org/cgi/query-pr.cgi?pr=15662 
>Unformatted:
 Phil Homewood
