Skip Menu |

This queue is for tickets about the Sys-Syslog CPAN distribution.

Report information
The Basics
Id: 34691
Status: resolved
Priority: 0/
Queue: Sys-Syslog

People
Owner: SAPER [...] cpan.org
Requestors: aab [...] aab.cc.purdue.edu
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.25



CC: aab [...] aab.cc.purdue.edu
Subject: Bad sysopen() call in Syslog.pm --
Date: Sat, 5 Apr 2008 00:39:09 -0400 (EDT)
To: bug-Sys-Syslog [...] rt.cpan.org
From: Paul Townsend <aab [...] aab.cc.purdue.edu>
===== I suffered from the same malady that Bug #17723 reports while using a Solaris 8 workstation. I found (via `truss') that the script was attempting to open "/dev/log" with the O_RDONLY flag and then was trying to write to the file. The cause turned out to be that the third and fourth arguments to the sysopen() function were reversed in the Syslog.pm code. The patch below swaps the third and fourth parameters and Sys::Syslog now works fine for "stream sockets". How come this doesn't break for other OSs? I installed it on three revisions of AIX with nary a complaint. FWIW - The "perlfunc" man page says sysopen (FILEHANDLE, FILENAME, MODE, PERMS) while the OS's "open(2)" man pages say open (const char *filename, int flags[, int modes]) I think the "MODE" and the "modes" words got mixed up (;-}) in the case of Syslog.pm. The "perlfunc" man page should probably be modifed a bit, perhaps by changing "MODE" to "FLAGS" or something similar. (Fat chance, right?) -- Paul Townsend (Alpha alpha Beta [at] Purdue Dot edu) --- Syslog.pm.orig 2007-12-31 11:15:28.000000000 -0500 +++ Syslog.pm 2008-04-04 23:39:44.875852000 -0400 @@ -619,7 +619,7 @@ push @$errs, "stream $syslog_path is not writable"; return 0; } - if (!sysopen(SYSLOG, $syslog_path, 0400, O_WRONLY)) { + if (!sysopen(SYSLOG, $syslog_path, O_WRONLY, 0400)) { push @$errs, "stream can't open $syslog_path: $!"; return 0; }
Subject: Re: [rt.cpan.org #34691] Bad sysopen() call in Syslog.pm --
Date: Sat, 5 Apr 2008 16:46:49 +0200
To: bug-Sys-Syslog [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Hello, Paul Townsend wrote: Show quoted text
> I suffered from the same malady that Bug #17723 reports while using a > Solaris 8 workstation. I found (via `truss') that the script was > attempting to open "/dev/log" with the O_RDONLY flag and then was > trying > to write to the file. The cause turned out to be that the third and > fourth arguments to the sysopen() function were reversed in the > Syslog.pm code. The patch below swaps the third and fourth parameters > and Sys::Syslog now works fine for "stream sockets".
Ohh, well spotted. Thanks, I've applied your patch. This error was apparently introduced by me, but the commit came after the problem described in ticket #17723, so it's probably not the root cause of it. » http://svnweb.mongueurs.net/Sys-Syslog/revision/?rev=5 Show quoted text
> How come this doesn't break for other OSs? I installed it on three > revisions of AIX with nary a complaint.
Because other OS will use other mechanisms. What every Unix user should use is the native one, which simply calls the libc syslog(3) functions, but for years, the documented way to use Sys::Syslog was to explicitly call setlogsock("unix") which wants a Unix domain socket. I don't know what is /dev/log under AIX. Given there's no specific code for it, I guess it's a Unix domain socket like under many other Unix. Under HP-UX for example, it's not a socket but a pipe. And on OS which have it as a STREAMS driver (typically some Solaris and IRIX), it's appears as a character device... Yes, it's a mess, that's why I discourage users from using the setlogsock() function at all: in most cases, the module (in its current version on the CPAN) will do a better job of finding the appropriate mechanism for the hosting OS. It now even works on Win32 systems. Using setlogsock() is just the way to make a program less portable. Best Regards -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
Subject: Re: [rt.cpan.org #34691] Bad sysopen() call in Syslog.pm --
Date: Sun, 8 Jun 2008 03:17:42 +0200
To: bug-Sys-Syslog [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
This issue is fixed in version 0.25. Thanks for your report. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.