Skip Menu |

This queue is for tickets about the File-Tail CPAN distribution.

Report information
The Basics
Id: 106145
Status: resolved
Priority: 0/
Queue: File-Tail

People
Owner: Nobody in particular
Requestors: nonsolosoft [...] diff.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: 1.2
Fixed in: 1.3



perl test_FileTail.pl 1..3 ok 1 - use File::Tail; ok 2 - file to test is readable by this user not ok 3 - Timeout File::Tail->new has not return object # Failed test 'Timeout File::Tail->new has not return object' # at test_FileTail.pl line 25. # Looks like you failed 1 test of 3. -------- Show quoted text
> uname -a
FreeBSD myhost 9.3-RELEASE FreeBSD 9.3 - Sun Jul 26 11:40:02 UTC 2015 amd64 -------- #!/usr/bin/env perl use strict; use warnings; use Test::More tests=>3; BEGIN { use_ok( 'File::Tail' ); }; my $filename = $ENV{FILE_TAIL_TO_TEST} || '/var/log/auth.log'; ok(-r $filename, 'file to test is readable by this user'); eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm(1); my $fp = File::Tail->new(name=>'/var/log/auth.log', tail=>5); isa_ok($fp,'File::Tail'); alarm 0; }; if ($@) { alarm 0; die unless $@ eq "alarm\n"; # propagate unexpected errors # timed out fail('Timeout File::Tail->new has not return object'); } exit 0;
From: nonsolosoft [...] diff.org
cpan File::Tail [...] File::Tail will be installed without debugging information. This information isn't usefull unless you intend to tinker with the code. To install with debugging enabled, use: perl Makefile.PL LOGIT Checking if your kit is complete... Looks good Writing Makefile for File::Tail Writing MYMETA.yml and MYMETA.json cp Tail.pm blib/lib/File/Tail.pm Manifying blib/man3/File::Tail.3 MGRABNAR/File-Tail-1.2.tar.gz /usr/bin/make -- OK 'YAML' not installed, will not store persistent state Running make test PERL_DL_NONLAZY=1 /usr/local/bin/perl5.16.3 "-MExtUtils::Command::MM" "-e" "test_harness(0, 'blib/lib', 'blib/arch')" t/*.t t/10open.t ......... ok t/20tail.t ......... ok t/30name_change.t .. ok All tests successful. Files=3, Tests=15, 66 wallclock secs ( 0.02 usr 0.02 sys + 0.11 cusr 0.03 csys = 0.18 CPU) Result: PASS MGRABNAR/File-Tail-1.2.tar.gz /usr/bin/make test -- OK Running make install Manifying blib/man3/File::Tail.3 Installing /usr/local/lib/perl5/site_perl/5.16/File/Tail.pm FreeBSD: Registering installation in the package database Cannot create directory /var/db/pkg/bsdpan-File-Tail-1.2: File exists Appending installation info to /usr/local/lib/perl5/5.16/mach/perllocal.pod MGRABNAR/File-Tail-1.2.tar.gz /usr/bin/make install -- OK perl ~ferz/test_FileTail.pl 1..3 ok 1 - use File::Tail; ok 2 - file to test is readable by this user not ok 3 - Timeout File::Tail->new has not return object # Failed test 'Timeout File::Tail->new has not return object' # at /home/ferz/test_FileTail.pl line 27. File::Tail version: 1.2 # Looks like you failed 1 test of 3. cd /tmp/File-Tail-1.0 perl Makefile.PL File::Tail will be installed without debugging information. This information isn't usefull unless you intend to tinker with the code. To install with debugging enabled, use: perl Makefile.PL LOGIT Checking if your kit is complete... Looks good Writing Makefile for File::Tail Writing MYMETA.yml and MYMETA.json u1# make install clean cp Tail.pm blib/lib/File/Tail.pm Manifying blib/man3/File::Tail.3 Installing /usr/local/lib/perl5/site_perl/5.16/File/Tail.pm FreeBSD: Registering installation in the package database Cannot create directory /var/db/pkg/bsdpan-File-Tail-1.0: File exists Appending installation info to /usr/local/lib/perl5/5.16/mach/perllocal.pod rm -f *.a core core.[0-9] blib/arch/auto/File/Tail/extralibs.all core.[0-9][0-9] Tail.bso pm_to_blib.ts MYMETA.json core.[0-9][0-9][0-9][0-9] MYMETA.yml Tail.x perl tmon.out *.o pm_to_blib blib/arch/auto/File/Tail/extralibs.ld blibdirs.ts core.[0-9][0-9][0-9][0-9][0-9] *perl.core core.*perl.*.? Makefile.aperl Tail.def perl core.[0-9][0-9][0-9] mon.out libTail.def perlmain.c perl.exe so_locations Tail.exp rm -rf blib mv Makefile Makefile.old > /dev/null 2>&1 perl ~ferz/test_FileTail.pl 1..3 ok 1 - use File::Tail; ok 2 - file to test is readable by this user ok 3 - The object isa File::Tail File::Tail version: 1.0
Subject: File::Tail is broken on FreeBSD
From: nonsolosoft [...] diff.org
On Wed Jul 29 10:01:22 2015, nonsolosoft@diff.org wrote: Show quoted text
> perl test_FileTail.pl > 1..3 > ok 1 - use File::Tail; > ok 2 - file to test is readable by this user > not ok 3 - Timeout File::Tail->new has not return object > # Failed test 'Timeout File::Tail->new has not return object' > # at test_FileTail.pl line 25. > # Looks like you failed 1 test of 3. > > --------
> > uname -a
> FreeBSD myhost 9.3-RELEASE FreeBSD 9.3 - Sun Jul 26 11:40:02 UTC 2015 > amd64 > -------- > > #!/usr/bin/env perl > > use strict; > use warnings; > use Test::More tests=>3; > > BEGIN { > use_ok( 'File::Tail' ); > }; > > my $filename = $ENV{FILE_TAIL_TO_TEST} || '/var/log/auth.log'; > > ok(-r $filename, 'file to test is readable by this user'); > > eval { > local > $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required > alarm(1); > my $fp = File::Tail->new(name=>'/var/log/auth.log', tail=>5); > isa_ok($fp,'File::Tail'); > alarm 0; > }; > if ($@) { > alarm 0; > die > unless $@ eq "alarm\n"; # propagate unexpected errors > # > timed out > fail('Timeout File::Tail->new has not return object'); > } > > exit 0;
Subject: A test to add to this Perl module
From: nonsolosoft [...] diff.org
Please add this module to your next distribution. There are some security scripts using File::Tail and they don't work with current version even if there is not any error during File::Tail installation and any warnings/failures when they are executed. When this test fails they can downgrade File::Tail to version 1.0 or avoid to run those scripts. Thank you in advance, \ferz
Subject: new_FileTail.t
#!/usr/bin/env perl use strict; use warnings; use Test::More tests=>3; use File::Temp qw/ tempfile /; BEGIN { use_ok( 'File::Tail' ); }; my ($filename); if (exists $ENV{FILE_TAIL_TO_TEST}) { $filename = $ENV{FILE_TAIL_TO_TEST}; } else { $filename = set_up_temp_file(); } ok(-r $filename, 'file to test is readable by this user'); eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm(3); my $fp = new_ok('File::Tail', [name=>$filename, tail=>50]); note("File::Tail $File::Tail::VERSION"); alarm 0; }; if ($@) { alarm 0; die unless $@ eq "alarm\n"; # propagate unexpected errors # timed out fail('Timeout File::Tail->new has not return object'); diag("File::Tail version: $File::Tail::VERSION\n"); } unless (exists $ENV{FILE_TAIL_TO_TEST}) { unlink($filename); } exit 0; sub set_up_temp_file { my ($fh, $filename) = tempfile(); # write something... my @words = qw/aries taurus gemini cancer leo virgo libra scorpio saggittarius capricorn aquarius pisces/; my @verbs = qw/hates loves trusts/; for (0..100) { printf $fh "$words[rand(@words)] $verbs[rand(@verbs)] $words[rand(@words)]\n"; } close($fh); return $filename; } =END =head1 AUTHOR Ferruccio Zamuner <nonsolosoft@diff.org> =head1 LICENSE This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. =cut
Subject: Re: [rt.cpan.org #106145] File::Tail is broken on FreeBSD
Date: Thu, 30 Jul 2015 15:41:18 +0200
To: bug-File-Tail [...] rt.cpan.org, "undisclosed-recipients: ;" [...] serverflow.si
From: Matija Grabnar <matija [...] serverflow.com>
I think you're doing something wrong. I installed freebsd into a virtual machine, installed perl and File::Tail, and your test script WORKS FOR ME, so your claim that File::Tail is incompatible with FreeBSD is bogus. Perhaps if you actually propagated the error you get from eval instead of doing a die without a parameter, you might find out what the real problem was. Next time, if you think File::Tail died unreasonably, try to collect any errors it might have reported, and sending those along instead of throwing them away in your test script. Best regards, Matija Grabnar On 07/29/2015 04:28 PM, nonsolosoft@diff.org via RT wrote: Show quoted text
> Queue: File-Tail > Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=106145 > > > On Wed Jul 29 10:01:22 2015, nonsolosoft@diff.org wrote:
>> perl test_FileTail.pl >> 1..3 >> ok 1 - use File::Tail; >> ok 2 - file to test is readable by this user >> not ok 3 - Timeout File::Tail->new has not return object >> # Failed test 'Timeout File::Tail->new has not return object' >> # at test_FileTail.pl line 25. >> # Looks like you failed 1 test of 3. >> >> --------
>>> uname -a
>> FreeBSD myhost 9.3-RELEASE FreeBSD 9.3 - Sun Jul 26 11:40:02 UTC 2015 >> amd64 >> -------- >> >> #!/usr/bin/env perl >> >> use strict; >> use warnings; >> use Test::More tests=>3; >> >> BEGIN { >> use_ok( 'File::Tail' ); >> }; >> >> my $filename = $ENV{FILE_TAIL_TO_TEST} || '/var/log/auth.log'; >> >> ok(-r $filename, 'file to test is readable by this user'); >> >> eval { >> local >> $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required >> alarm(1); >> my $fp = File::Tail->new(name=>'/var/log/auth.log', tail=>5); >> isa_ok($fp,'File::Tail'); >> alarm 0; >> }; >> if ($@) { >> alarm 0; >> die >> unless $@ eq "alarm\n"; # propagate unexpected errors >> # >> timed out >> fail('Timeout File::Tail->new has not return object'); >> } >> >> exit 0;
> >
tested the freebsd provided version on a freebsd virtual machine, the provided test script does not generate an error.
Subject: Re: [rt.cpan.org #106145] File::Tail is broken on FreeBSD
Date: Thu, 30 Jul 2015 17:15:28 +0200
To: "bug-File-Tail [...] rt.cpan.org" <bug-File-Tail [...] rt.cpan.org>
From: Ferruccio Zamuner <nonsolosoft [...] diff.org>
Hi, I've some freebsd server, with many version of it. I'd also a script that use File::Tail to listen /var/log/auth.log and some other files to ban IPs those are trying brute force ssh attacks. That test fails on any server and on my BSD servers that security script doesn't create any File::Tail, it simply hangs on that first call for anytime, without report any errors. So you think that servers are protected while they aren't. I've written that test script to track the problem, please don't drop it easly: if on some (your) server it succeded you can include that simply test in your distro without problem and help others sysadmin to discover if they have security issues or not. I've same issue on FreeBSD 8.1, 8.4, 9.3 and DragonFlyBSD 4.2.3, I can suppose that there are other BSD (real and not virtual) with same problems. Best regards, \ferz Show quoted text
> Il giorno 30/lug/2015, alle ore 15:41, Matija Grabnar via RT <bug-File-Tail@rt.cpan.org> ha scritto: > > <URL: https://rt.cpan.org/Ticket/Display.html?id=106145 > > > I think you're doing something wrong. > I installed freebsd into a virtual machine, installed perl and > File::Tail, and your test script WORKS FOR ME, so your claim that > File::Tail is incompatible with FreeBSD is bogus. > > Perhaps if you actually propagated the error you get from eval instead > of doing a die without a parameter, you might find out what the real > problem was. > > Next time, if you think File::Tail died unreasonably, try to collect any > errors it might have reported, > and sending those along instead of throwing them away in your test script. > > Best regards, > Matija Grabnar >
>> On 07/29/2015 04:28 PM, nonsolosoft@diff.org via RT wrote: >> Queue: File-Tail >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=106145 > >>
>>> On Wed Jul 29 10:01:22 2015, nonsolosoft@diff.org wrote: >>> perl test_FileTail.pl >>> 1..3 >>> ok 1 - use File::Tail; >>> ok 2 - file to test is readable by this user >>> not ok 3 - Timeout File::Tail->new has not return object >>> # Failed test 'Timeout File::Tail->new has not return object' >>> # at test_FileTail.pl line 25. >>> # Looks like you failed 1 test of 3. >>> >>> --------
>>>> uname -a
>>> FreeBSD myhost 9.3-RELEASE FreeBSD 9.3 - Sun Jul 26 11:40:02 UTC 2015 >>> amd64 >>> -------- >>> >>> #!/usr/bin/env perl >>> >>> use strict; >>> use warnings; >>> use Test::More tests=>3; >>> >>> BEGIN { >>> use_ok( 'File::Tail' ); >>> }; >>> >>> my $filename = $ENV{FILE_TAIL_TO_TEST} || '/var/log/auth.log'; >>> >>> ok(-r $filename, 'file to test is readable by this user'); >>> >>> eval { >>> local >>> $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required >>> alarm(1); >>> my $fp = File::Tail->new(name=>'/var/log/auth.log', tail=>5); >>> isa_ok($fp,'File::Tail'); >>> alarm 0; >>> }; >>> if ($@) { >>> alarm 0; >>> die >>> unless $@ eq "alarm\n"; # propagate unexpected errors >>> # >>> timed out >>> fail('Timeout File::Tail->new has not return object'); >>> } >>> >>> exit 0;
> >
Like Matija, I don't get an error using the attached new_FileTail.t script. My test systems were a physical freebsd 9.2 and virtual freebsd 9.2 and freebsd 10.1. The perls were a couple of self-compiled ones ranging from 5.8.9 to 5.22.0, and the system perl. File::Tail version was always 1.2. Maybe you have another special setup (jails? zfs?). Probably it's best if you could provide a syscall trace from the test script, using ktrace or truss (preferably the trace should be gzipped or provided on another server). On 2015-07-30 11:15:53, nonsolosoft@diff.org wrote: Show quoted text
> Hi, > > I've some freebsd server, with many version of it. > I'd also a script that use File::Tail to listen /var/log/auth.log and > some other files to ban IPs those are trying brute force ssh attacks. > > That test fails on any server and on my BSD servers that security > script doesn't create any File::Tail, it simply hangs on that first > call for anytime, without report any errors. So you think that servers > are protected while they aren't. > > I've written that test script to track the problem, please don't drop > it easly: if on some (your) server it succeded you can include that > simply test in your distro without problem and help others sysadmin to > discover if they have security issues or not. > > I've same issue on FreeBSD 8.1, 8.4, 9.3 and DragonFlyBSD 4.2.3, I can > suppose that there are other BSD (real and not virtual) with same > problems. > > Best regards, \ferz >
> > Il giorno 30/lug/2015, alle ore 15:41, Matija Grabnar via RT <bug- > > File-Tail@rt.cpan.org> ha scritto: > > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=106145 > > > > > I think you're doing something wrong. > > I installed freebsd into a virtual machine, installed perl and > > File::Tail, and your test script WORKS FOR ME, so your claim that > > File::Tail is incompatible with FreeBSD is bogus. > > > > Perhaps if you actually propagated the error you get from eval > > instead > > of doing a die without a parameter, you might find out what the real > > problem was. > > > > Next time, if you think File::Tail died unreasonably, try to collect > > any > > errors it might have reported, > > and sending those along instead of throwing them away in your test > > script. > > > > Best regards, > > Matija Grabnar > >
> >> On 07/29/2015 04:28 PM, nonsolosoft@diff.org via RT wrote: > >> Queue: File-Tail > >> Ticket <URL: https://rt.cpan.org/Ticket/Display.html?id=106145 > > >>
> >>> On Wed Jul 29 10:01:22 2015, nonsolosoft@diff.org wrote: > >>> perl test_FileTail.pl > >>> 1..3 > >>> ok 1 - use File::Tail; > >>> ok 2 - file to test is readable by this user > >>> not ok 3 - Timeout File::Tail->new has not return object > >>> # Failed test 'Timeout File::Tail->new has not return object' > >>> # at test_FileTail.pl line 25. > >>> # Looks like you failed 1 test of 3. > >>> > >>> --------
> >>>> uname -a
> >>> FreeBSD myhost 9.3-RELEASE FreeBSD 9.3 - Sun Jul 26 11:40:02 UTC > >>> 2015 > >>> amd64 > >>> -------- > >>> > >>> #!/usr/bin/env perl > >>> > >>> use strict; > >>> use warnings; > >>> use Test::More tests=>3; > >>> > >>> BEGIN { > >>> use_ok( 'File::Tail' ); > >>> }; > >>> > >>> my $filename = $ENV{FILE_TAIL_TO_TEST} || '/var/log/auth.log'; > >>> > >>> ok(-r $filename, 'file to test is readable by this user'); > >>> > >>> eval { > >>> local > >>> $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required > >>> alarm(1); > >>> my $fp = File::Tail->new(name=>'/var/log/auth.log', tail=>5); > >>> isa_ok($fp,'File::Tail'); > >>> alarm 0; > >>> }; > >>> if ($@) { > >>> alarm 0; > >>> die > >>> unless $@ eq "alarm\n"; # propagate unexpected errors > >>> # > >>> timed out > >>> fail('Timeout File::Tail->new has not return object'); > >>> } > >>> > >>> exit 0;
> > > >
Subject: Re: [rt.cpan.org #106145]
Date: Fri, 31 Jul 2015 11:24:43 +0200
To: bug-File-Tail [...] rt.cpan.org
From: Ferruccio Zamuner <nonsolosoft [...] diff.org>
On 30/07/2015 20:37, Slaven_Rezic via RT wrote: Show quoted text
> <URL: https://rt.cpan.org/Ticket/Display.html?id=106145 > > > Like Matija, I don't get an error using the attached new_FileTail.t script. My test systems were a physical freebsd 9.2 and virtual freebsd 9.2 and freebsd 10.1. The perls were a couple of self-compiled ones ranging from 5.8.9 to 5.22.0, and the system perl. File::Tail version was always 1.2.
Please try using this env before execute it: setenv FILE_TAIL_TO_TEST '/var/log/auth.log' it seems hangs on line 278 of File::Tail::new(): $object->reset_pointers; Anyway I'll investigate better. Thank you. \ferz
On 2015-07-31 05:25:05, nonsolosoft@diff.org wrote: Show quoted text
> On 30/07/2015 20:37, Slaven_Rezic via RT wrote:
> > <URL: https://rt.cpan.org/Ticket/Display.html?id=106145 > > > > > Like Matija, I don't get an error using the attached new_FileTail.t > > script. My test systems were a physical freebsd 9.2 and virtual > > freebsd 9.2 and freebsd 10.1. The perls were a couple of self- > > compiled ones ranging from 5.8.9 to 5.22.0, and the system perl. > > File::Tail version was always 1.2.
> > Please try using this env before execute it: > > setenv FILE_TAIL_TO_TEST '/var/log/auth.log' > > it seems hangs on line 278 of File::Tail::new(): > $object->reset_pointers;
Ok, finally success: on some systems the following runs into the alarm timeout: sudo env FILE_TAIL_TO_TEST='/var/log/auth.log' perl5.X.Y /tmp/new_FileTail.t Maybe it depends on the size of /var/log/auth.log. It does not hang on a system where the log file is small (just 5K) and hangs on the other two with larger size (80 resp. 98K).
On 2015-08-01 02:32:33, SREZIC wrote: Show quoted text
> On 2015-07-31 05:25:05, nonsolosoft@diff.org wrote:
> > On 30/07/2015 20:37, Slaven_Rezic via RT wrote:
> > > <URL: https://rt.cpan.org/Ticket/Display.html?id=106145 > > > > > > > Like Matija, I don't get an error using the attached new_FileTail.t > > > script. My test systems were a physical freebsd 9.2 and virtual > > > freebsd 9.2 and freebsd 10.1. The perls were a couple of self- > > > compiled ones ranging from 5.8.9 to 5.22.0, and the system perl. > > > File::Tail version was always 1.2.
> > > > Please try using this env before execute it: > > > > setenv FILE_TAIL_TO_TEST '/var/log/auth.log' > > > > it seems hangs on line 278 of File::Tail::new(): > > $object->reset_pointers;
> > Ok, finally success: on some systems the following runs into the alarm > timeout: > > sudo env FILE_TAIL_TO_TEST='/var/log/auth.log' perl5.X.Y > /tmp/new_FileTail.t > > Maybe it depends on the size of /var/log/auth.log. It does not hang on > a system where the log file is small (just 5K) and hangs on the other > two with larger size (80 resp. 98K).
... and it seems to hang also on Linux systems. I attached a modified test script which fails on all systems with File::Tail 1.2 (1.0 and older is fine).
Subject: rt106145.t
#!/usr/bin/env perl use strict; use warnings; use Test::More tests=>1; use File::Temp qw/ tempfile /; use File::Tail; my $filename = set_up_temp_file(); eval { local $SIG{ALRM} = sub { die "alarm\n" }; # NB: \n required alarm(3); my $fp = new_ok('File::Tail', [name=>$filename, tail=>5]); note("File::Tail $File::Tail::VERSION"); alarm 0; }; if ($@) { alarm 0; die unless $@ eq "alarm\n"; # propagate unexpected errors # timed out fail('Timeout File::Tail->new has not return object'); diag("File::Tail version: $File::Tail::VERSION\n"); } exit 0; sub set_up_temp_file { my ($fh, $filename) = tempfile(UNLINK => 1); # write something... for (1..6) { print $fh ("x"x80)."\n"; } close($fh); return $filename; } =END =head1 AUTHOR Ferruccio Zamuner <nonsolosoft@diff.org> =head1 LICENSE This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself. =cut
On 2015-08-01 04:47:10, SREZIC wrote: Show quoted text
> On 2015-08-01 02:32:33, SREZIC wrote:
> > On 2015-07-31 05:25:05, nonsolosoft@diff.org wrote:
> > > On 30/07/2015 20:37, Slaven_Rezic via RT wrote:
> > > > <URL: https://rt.cpan.org/Ticket/Display.html?id=106145 > > > > > > > > > Like Matija, I don't get an error using the attached > > > > new_FileTail.t > > > > script. My test systems were a physical freebsd 9.2 and virtual > > > > freebsd 9.2 and freebsd 10.1. The perls were a couple of self- > > > > compiled ones ranging from 5.8.9 to 5.22.0, and the system perl. > > > > File::Tail version was always 1.2.
> > > > > > Please try using this env before execute it: > > > > > > setenv FILE_TAIL_TO_TEST '/var/log/auth.log' > > > > > > it seems hangs on line 278 of File::Tail::new(): > > > $object->reset_pointers;
> > > > Ok, finally success: on some systems the following runs into the > > alarm > > timeout: > > > > sudo env FILE_TAIL_TO_TEST='/var/log/auth.log' perl5.X.Y > > /tmp/new_FileTail.t > > > > Maybe it depends on the size of /var/log/auth.log. It does not hang > > on > > a system where the log file is small (just 5K) and hangs on the other > > two with larger size (80 resp. 98K).
> > ... and it seems to hang also on Linux systems. I attached a modified > test script which fails on all systems with File::Tail 1.2 (1.0 and > older is fine).
A little bit of debugging shows that the first while loop in position() may be an endless loop. At some point, $calclen never increases anymore while $crs stays close below $object->{tail}. Probably unrelated to this problem, but this line looks problematic: $calclen=length($object->{tail})+1024 if $calclen<=length($object->{"tail"}); $object->{tail} is supposed to be a number --- should really length() be called on it?
I just released version 1.3, I believe this bug is fixed there.