Mailing List Archive

Perl 5.001n: Sys::Syslog.pm on Solaris
I assume this has been reported by now, but then, I also thought it may
have been fixed for the 5.001n patch.

The Sys::Syslog module doesn't contain the correct values for the
communications domain, and the socket type. The best way I've heard to
fix the problem is to use the macros defined by Socket.pm.

Another problem is that for some reason Solaris won't let you connect to
localhost. You must use the actual hostname for the local machine. I
haven't looked into the reason for this. The only solution I've seen for
this is to make the default host `hostname` instead of "localhost".

Here's a diff between the 5.001n distribution and my modified version.

/usr/local/lib/perl5: diff Sys/Syslog.pm.dist Sys/Syslog.pm.solaris
8a9,10
> use Socket;
>
37c39
< $host = 'localhost' unless $host; # set $Syslog::host to change
---
> chop($host = `hostname`) unless $host; # set $Syslog::host to change
149,150c151,152
< $af_unix = 1;
< $af_inet = 2;
---
> $af_unix = AF_UNIX;
> $af_inet = AF_INET;
152,153c154,155
< $stream = 1;
< $datagram = 2;
---
> $stream = SOCK_STREAM;
> $datagram = SOCK_DGRAM;

Please note, the same modifications need to be applied to the Perl4
version of syslog.pl.

--
------------------------------------------------------------------------
Dan Peterson Internet: pete@spry.com
Senior Engineering Lead Phone: (206) 957-8000
Spry/CompuServe Internet Division FAX: (206) 957-8510
------------------------------------------------------------------------
Re: Perl 5.001n: Sys::Syslog.pm on Solaris [ In reply to ]
> From: Dan Peterson <pete@spry.com>
>
> The Sys::Syslog module doesn't contain the correct values for the
> communications domain, and the socket type. The best way I've heard to
> fix the problem is to use the macros defined by Socket.pm.

Yes.

> Another problem is that for some reason Solaris won't let you connect to
> localhost. You must use the actual hostname for the local machine. I
> haven't looked into the reason for this. The only solution I've seen for
> this is to make the default host `hostname` instead of "localhost".
>
> Here's a diff between the 5.001n distribution and my modified version.
>
> /usr/local/lib/perl5: diff Sys/Syslog.pm.dist Sys/Syslog.pm.solaris
> 8a9,10
> > use Socket;
> >
> 37c39
> < $host = 'localhost' unless $host; # set $Syslog::host to change
> ---
> > chop($host = `hostname`) unless $host; # set $Syslog::host to change

`hostname` won't work on systems that don't have BSD commands installed.
use Sys::Hostname; and hostname() instead.

Could you post a diff -c patch that includes those changes (that's
the best way to make sure it gets included).

Tim.
Re: Perl 5.001n: Sys::Syslog.pm on Solaris [ In reply to ]
> From: Dan Peterson <pete@spry.com>
>
> The Sys::Syslog module doesn't contain the correct values for the
> communications domain, and the socket type. The best way I've heard to
> fix the problem is to use the macros defined by Socket.pm.

Yes.

> Another problem is that for some reason Solaris won't let you connect to
> localhost. You must use the actual hostname for the local machine. I
> haven't looked into the reason for this. The only solution I've seen for
> this is to make the default host `hostname` instead of "localhost".
>
> Here's a diff between the 5.001n distribution and my modified version.
>
> /usr/local/lib/perl5: diff Sys/Syslog.pm.dist Sys/Syslog.pm.solaris
> 8a9,10
> > use Socket;
> >
> 37c39
> < $host = 'localhost' unless $host; # set $Syslog::host to change
> ---
> > chop($host = `hostname`) unless $host; # set $Syslog::host to change

`hostname` won't work on systems that don't have BSD commands installed.
use Sys::Hostname; and hostname() instead.

Could you post a diff -c patch that includes those changes (that's
the best way to make sure it gets included).

Tim.