From owner-freebsd-bugs Thu Dec 23 18:50: 6 1999 Delivered-To: freebsd-bugs@freebsd.org Received: from freefall.freebsd.org (freefall.FreeBSD.ORG [204.216.27.21]) by hub.freebsd.org (Postfix) with ESMTP id 40D3A14D3B for ; Thu, 23 Dec 1999 18:50:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.9.3/8.9.2) id SAA49060; Thu, 23 Dec 1999 18:50:03 -0800 (PST) (envelope-from gnats@FreeBSD.org) Received: from blocker.mincom.com (blocker2.mincom.com [203.15.57.34]) by hub.freebsd.org (Postfix) with ESMTP id 873101574D for ; 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 ; 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 Reply-To: philh@mincom.com To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.2 Subject: misc/15662: [PATCH] perl5 Sys::Hostname fails if no PATH set Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org >Number: 15662 >Category: misc >Synopsis: [PATCH] perl5 Sys::Hostname fails if no PATH set >Confidential: no >Severity: serious >Priority: medium >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Thu Dec 23 18:50:02 PST 1999 >Closed-Date: >Last-Modified: >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: >Unformatted: Phil Homewood To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message