Perl / perl5

🐪 The Perl programming language
https://dev.perl.org/perl5/
Other
1.96k stars 556 forks source link

Wishlist about Sys::Syslog. #7905

Closed p5pRT closed 18 years ago

p5pRT commented 19 years ago

Migrated from rt.perl.org#35406 (status was 'resolved')

Searchable as RT35406$

p5pRT commented 19 years ago

From tahi@gb3.so-net.ne.jp

Created by tahi@gb3.so-net.ne.jp

Recently inetutils of Cygwin was updated to include syslogd.

I tried to use Sys​::Syslog\, but it failed. This caused by no reflection of updated sys/syslog.h (_PATH_LOG is newly declared). I guess it will be automatically fixed by recompiling Sys​::Syslog. This is not a problem.

In that circumstance\, while testing Sys​::Syslog\, I came to have some questions about the package.

I think it may be useful that users can specify the unix socket name of syslog in such a environment that doesn't have _PATH_LOG\, but syslogd by unix socket.

I wish Sys​::Syslog​::setlogsock 'unix' to accept the second argument of $syslog_path like 'stream'\, or I wish to know what reason exists why I can't do it?

About 'stream'\, I also have a question. Pod of Sys​::Syslog wrote​:

A value of 'stream' will connect to the stream indicated by the pathname provided as the optional second parameter.

But the function Sys​::Syslog​::connect_stream do at first​:

sub connect_stream { my ($errs) = @​_; # might want syslog_path to be variable based on syslog.h (if only # it were in there!) $syslog_path = '/dev/conslog';

I think this omit the indicated pathname. Why? Though\, I can't use syslog by 'stream' in Cygwin.

I made a patch to realize my wish. I append it to this report.

The problems were solved for me. By this report I intend only to clear my question. So\, I don't need quick response\, but I am glad if I can get a reply.

Inline Patch ```diff --- Sys/Syslog.pm.orig 2005-01-27 20:45:55.001000000 +0900 +++ Sys/Syslog.pm 2005-05-11 17:18:04.389054400 +0900 @@ -228,8 +228,8 @@ @connectMethods = ( 'stream' ); } } elsif (lc($setsock) eq 'unix') { - if (length _PATH_LOG() && !defined $syslog_path) { - $syslog_path = _PATH_LOG(); + if (length _PATH_LOG() || (defined $syslog_path && -w $syslog_path)) { + $syslog_path = _PATH_LOG() if ! defined $syslog_path; @connectMethods = ( 'unix' ); } else { carp 'unix passed to setlogsock, but path not available'; @@ -522,7 +522,7 @@ my ($errs) = @_; # might want syslog_path to be variable based on syslog.h (if only # it were in there!) - $syslog_path = '/dev/conslog'; + $syslog_path = '/dev/conslog' if ! defined $syslog_path; if (!-w $syslog_path) { push(@{$errs}, "stream $syslog_path is not writable"); return 0; @@ -537,11 +537,13 @@ sub connect_unix { my ($errs) = @_; - if (length _PATH_LOG()) { + if (! defined $syslog_path) { + if (length _PATH_LOG()) { $syslog_path = _PATH_LOG(); - } else { + } else { push(@{$errs}, "_PATH_LOG not available in syslog.h"); return 0; + } } my $that = sockaddr_un($syslog_path); if (!$that) { ```
Perl Info ``` Flags: category=library severity=wishlist Site configuration information for perl v5.8.6: Configured by gerrit at Thu Jan 27 11:04:16 EST 2005. Summary of my perl5 (revision 5 version 8 subversion 6) configuration: Platform: osname=cygwin, osvers=1.5.12(0.11642), archname=cygwin-thread-multi-64int uname='cygwin_nt-4.0 loreley 1.5.12(0.11642) 2004-11-10 08:34 i686 unknown unknown cygwin ' config_args='-de -Dmksymlinks -Duse64bitint -Dusethreads -Doptimize=-O3 -Dman3ext=3pm' hint=recommended, useposix=true, d_sigaction=define usethreads=define use5005threads=undef useithreads=define usemultiplicity=define useperlio=define d_sfio=undef uselargefiles=define usesocks=undef use64bitint=define use64bitall=undef uselongdouble=undef usemymalloc=y, bincompat5005=undef Compiler: cc='gcc', ccflags ='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include', optimize='-O3', cppflags='-DPERL_USE_SAFE_PUTENV -fno-strict-aliasing -pipe -I/usr/local/include' ccversion='', gccversion='3.4.1 (cygming special)', gccosandvers='' intsize=4, longsize=4, ptrsize=4, doublesize=8, byteorder=12345678 d_longlong=define, longlongsize=8, d_longdbl=define, longdblsize=12 ivtype='long long', ivsize=8, nvtype='double', nvsize=8, Off_t='off_t', lseeksize=8 alignbytes=8, prototype=define Linker and Libraries: ld='ld2', ldflags =' -s -L/usr/local/lib' libpth=/usr/local/lib /usr/lib /lib libs=-lgdbm -ldb -lcrypt -lgdbm_compat perllibs=-lcrypt -lgdbm_compat libc=/usr/lib/libc.a, so=dll, useshrplib=true, libperl=libperl.a gnulibc_version='' Dynamic Linking: dlsrc=dl_dlopen.xs, dlext=dll, d_dlsymun=undef, ccdlflags=' -s' cccdlflags=' ', lddlflags=' -s -L/usr/local/lib' Locally applied patches: @INC for perl v5.8.6: /usr/lib/perl5/5.8/cygwin /usr/lib/perl5/5.8 /usr/lib/perl5/site_perl/5.8/cygwin /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/site_perl/5.8 /usr/lib/perl5/vendor_perl/5.8/cygwin /usr/lib/perl5/vendor_perl/5.8 /usr/lib/perl5/vendor_perl/5.8 . Environment for perl v5.8.6: HOME=/cygdrive/c/home/tahi LANG (unset) LANGUAGE (unset) LD_LIBRARY_PATH (unset) LOGDIR (unset) PATH=/cygdrive/c/home/tahi/bin:/usr/bin:/usr/lib/subversion/bin:/usr/local/bin:/usr/bin:/bin:/usr/X11R6/bin:.:/cygdrive/c/program files/imagemagick-6.2.1-q16:/cygdrive/c/WINDOWS/system32:/cygdrive/c/WINDOWS:/cygdrive/c/WINDOWS/System32/Wbem:/cygdrive/c/Program Files/ATI Technologies/ATI Control Panel:/cygdrive/c/usr/local/bin:/cygdrive/c/gs/gs7.07/bin:/cygdrive/c/gs/gs7.07/lib:/cygdrive/c/dviout:/cygdrive/c/usr/local/Meadow/2.00/bin:/cygdrive/c/kakasi/bin:/cygdrive/c/Program Files/GnuWin32/bin:/cygdrive/c/Perl/bin:.:/usr/bin:. PERL_BADLANG (unset) SHELL (unset) ```
p5pRT commented 18 years ago

From @maddingue

[...]

I made a patch to realize my wish. I append it to this report.

The problems were solved for me. By this report I intend only to clear my question. So\, I don't need quick response\, but I am glad if I can get a reply.

Thank you for this patch. It will be included in the next release of Sys​::Syslog.

-- Close the world\, txEn eht nepO.

p5pRT commented 18 years ago

The RT System itself - Status changed from 'new' to 'open'

p5pRT commented 18 years ago

From @maddingue

This patch has been included in Sys​::Syslog 0.16\, now on the CPAN.

-- Close the world\, txEn eht nepO.

p5pRT commented 18 years ago

@rgs - Status changed from 'open' to 'resolved'