Bug 15662

Summary: [PATCH] perl5 Sys::Hostname fails if no PATH set
Product: Base System Reporter: Phil Homewood <philh>
Component: binAssignee: Mark Murray <markm>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.3-STABLE   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Phil Homewood 1999-12-24 02:50:02 UTC
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.
Comment 1 Sheldon Hearn freebsd_committer freebsd_triage 1999-12-24 08:38:23 UTC
Responsible Changed
From-To: freebsd-bugs->markm

Mark's the perl5 maintainer. 

Comment 2 Sheldon Hearn 1999-12-24 08:39:25 UTC
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.
Comment 3 Phil Homewood 2002-10-22 00:55:51 UTC
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
Comment 4 Michael A. Dickerson 2003-04-22 01:44:25 UTC
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
Comment 5 Mark Murray freebsd_committer freebsd_triage 2005-03-28 13:50:16 UTC
State Changed
From-To: open->closed

Base-perl is deprecated. This works in the port version.