Skip Menu |
Report information

To: perlbug [...] perl.org
Subject: Intermittent failures in dist/IO/t/io_dir.t
Date: Thu, 27 Dec 2018 21:43:46 -0500
From: James E Keenan <jkeenan [...] pobox.com>
Download (untitled) / with headers
text/plain 1.1k
In smoke test reports we are getting intermittent failures in dist/IO/t/io_dir.t. These failures began to appear after the release of perl-5.29.5 (the November release). See: http://perl5.test-smoke.org/submatrix?test=../dist/IO/t/io_dir.t Or this report from perl-5.29.6 on December 26: http://perl5.test-smoke.org/report/76727 In each case it is test #6 which is failing: Test failures: ~~ ../dist/IO/t/io_dir.t ....................................... FAILED 6 Here is the relevant part of the file which is failing: ##### my $DIR = $^O eq 'MacOS' ? ":" : "."; my $CLASS = "IO::Dir"; my $dot = $CLASS->new($DIR); ok(defined($dot)); my @a = sort <*>; my $first; do { $first = $dot->read } while defined($first) && $first =~ /^\./; ok(+(grep { $_ eq $first } @a)); my @b = sort($first, (grep {/^[^.]/} $dot->read)); ok(+(join("\0", @a) eq join("\0", @b))); ok($dot->rewind,'rewind'); my @c = sort grep {/^[^.]/} $dot->read; ok(+(join("\0", @b) eq join("\0", @c))); # <-- TEST 6 ok($dot->close,'close'); ##### Does anyone have any idea as to cause or how to reproduce this outside the context of smoke-testing? Thank you very much.
Download perl_V.txt
text/plain 3.1k

Message body is not shown because sender requested not to inline it.

RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.4k
On Fri, 28 Dec 2018 02:43:54 GMT, jkeenan@pobox.com wrote: Show quoted text
> In smoke test reports we are getting intermittent failures in > dist/IO/t/io_dir.t. These failures began to appear after the release of > perl-5.29.5 (the November release). > > See: http://perl5.test-smoke.org/submatrix?test=../dist/IO/t/io_dir.t > > Or this report from perl-5.29.6 on December 26: > > http://perl5.test-smoke.org/report/76727 > > In each case it is test #6 which is failing: > > Test failures: > ~~ ../dist/IO/t/io_dir.t ....................................... FAILED 6 > > Here is the relevant part of the file which is failing: > > ##### > my $DIR = $^O eq 'MacOS' ? ":" : "."; > > my $CLASS = "IO::Dir"; > my $dot = $CLASS->new($DIR); > ok(defined($dot)); > > my @a = sort <*>; > my $first; > do { $first = $dot->read } while defined($first) && $first =~ /^\./; > ok(+(grep { $_ eq $first } @a)); > > my @b = sort($first, (grep {/^[^.]/} $dot->read)); > ok(+(join("\0", @a) eq join("\0", @b))); > > ok($dot->rewind,'rewind'); > my @c = sort grep {/^[^.]/} $dot->read; > ok(+(join("\0", @b) eq join("\0", @c))); # <-- TEST 6 > > ok($dot->close,'close'); > ##### > > Does anyone have any idea as to cause or how to reproduce this outside > the context of smoke-testing? > > Thank you very much.
Please review patch attached, which is available for smoke-testing in this branch: smoke-me/jkeenan/smoke-me/jkeenan/133740-io_dir Thank you very much. -- James E Keenan (jkeenan@cpan.org)
Subject: 0001-Conduct-tests-of-IO-Dir-in-temporary-directory.patch
From 233dd1df114316ec88a5d6e52c4410aef99c88bd Mon Sep 17 00:00:00 2001 From: James E Keenan <jkeenan@cpan.org> Date: Fri, 28 Dec 2018 23:05:19 -0500 Subject: [PATCH] Conduct tests of IO::Dir in temporary directory For RT # 133740: After the release of perl-5.29.5, smoke tests intermittently began to report failures in dist/IO/t/io_dir.t. In preceding months, similar intermittent failures had been reported for files testing File::Find (RT 133658) and GDBM_File (RT 133664). In those cases the problem was diagnosed as race conditions under parallel testing where test files and directories were being created in or underneath the current working directory without resort to tempdirs or tempfiles. The testing in dist/IO/t/io_dir.t presumes the existence of a stable set of files and subdirectories in dist/IO/. If additional files or subdirectories are created while this file is being run, that presumption is no longer met. The dist/IO/t/ directory was therefore inspected for test files which, for testing purposes, would create files or directories underneath the dist/IO/. The following test files do so: io_file.t io_linenum.t io_taint.t io_tell.t io_unix.t io_utf8argv.t io_utf8.t io_xs.t Of the above, only io_xs.t takes the precaution of using IO::File->new_tmpfile(). Using File::Temp::tempdir in this file should mitigate the problem. In addition, all tests in io_dir.t now have descriptions. --- dist/IO/t/io_dir.t | 100 ++++++++++++++++++++++++++++----------------- 1 file changed, 62 insertions(+), 38 deletions(-) diff --git a/dist/IO/t/io_dir.t b/dist/IO/t/io_dir.t index 762c452ec8..ba400dee97 100644 --- a/dist/IO/t/io_dir.t +++ b/dist/IO/t/io_dir.t @@ -9,57 +9,81 @@ BEGIN { } use strict; +use File::Temp qw( tempdir ); +use Cwd; -my $DIR = $^O eq 'MacOS' ? ":" : "."; +my $cwd = cwd(); -my $CLASS = "IO::Dir"; -my $dot = $CLASS->new($DIR); -ok(defined($dot)); +{ + my $DIR = tempdir( CLEANUP => 1 ); + chdir $DIR or die "Unable to chdir to $DIR"; + my @IO_files = + ( 'ChangeLog', 'IO.pm', 'IO.xs', 'Makefile.PL', 'poll.c', 'poll.h', 'README' ); + my @IO_subdirs = ( qw| hints lib t | ); -my @a = sort <*>; -my $first; -do { $first = $dot->read } while defined($first) && $first =~ /^\./; -ok(+(grep { $_ eq $first } @a)); + for my $f (@IO_files) { + open my $OUT, '>', $f or die "Unable to open '$DIR/$f' for writing"; + close $OUT or die "Unable to close '$DIR/$f' after writing"; + } + for my $d (@IO_subdirs) { mkdir $d or die "Unable to mkdir '$DIR/$d'"; } -my @b = sort($first, (grep {/^[^.]/} $dot->read)); -ok(+(join("\0", @a) eq join("\0", @b))); + my $CLASS = "IO::Dir"; + my $dot = $CLASS->new($DIR); + ok(defined($dot), "Able to create IO::Dir object for $DIR"); -ok($dot->rewind,'rewind'); -my @c = sort grep {/^[^.]/} $dot->read; -ok(+(join("\0", @b) eq join("\0", @c))); + my @a = sort <*>; + my $first; + do { $first = $dot->read } while defined($first) && $first =~ /^\./; + ok(+(grep { $_ eq $first } @a), "directory entry found"); -ok($dot->close,'close'); -{ local $^W; # avoid warnings on invalid dirhandle -ok(!$dot->rewind, "rewind on closed"); -ok(!defined($dot->read)); -} + my @b = sort($first, (grep {/^[^.]/} $dot->read)); + ok(+(join("\0", @a) eq join("\0", @b)), "two lists of directory entries match (Case 1)"); + + ok($dot->rewind,'rewind'); + my @c = sort grep {/^[^.]/} $dot->read; + ok(+(join("\0", @b) eq join("\0", @c)), "two lists of directory entries match (Case 2)"); + + ok($dot->close,'close'); + { + local $^W; # avoid warnings on invalid dirhandle + ok(!$dot->rewind, "rewind on closed"); + ok(!defined($dot->read), "Directory handle closed; hence 'read' returns undef"); + } -open(FH,'>','X') || die "Can't create x"; -print FH "X"; -close(FH) or die "Can't close: $!"; + open(FH,'>','X') || die "Can't create x"; + print FH "X"; + close(FH) or die "Can't close: $!"; -my %dir; -tie %dir, $CLASS, $DIR; -my @files = keys %dir; + my %dir; + tie %dir, $CLASS, $DIR; + my @files = keys %dir; -# I hope we do not have an empty dir :-) -ok(scalar @files); + # I hope we do not have an empty dir :-) + ok(scalar @files, "Tied hash interface finds directory entries"); -my $stat = $dir{'X'}; -isa_ok($stat,'File::stat'); -ok(defined($stat) && $stat->size == 1); + my $stat = $dir{'X'}; + isa_ok($stat,'File::stat'); + ok(defined($stat) && $stat->size == 1, + "Confirm that we wrote a file of size 1 byte"); -delete $dir{'X'}; + delete $dir{'X'}; -ok(-f 'X'); + ok(-f 'X', "Confirm that file still exists after entry in tied hash has been deleted"); -my %dirx; -tie %dirx, $CLASS, $DIR, DIR_UNLINK; + my %dirx; + tie %dirx, $CLASS, $DIR, DIR_UNLINK; -my $statx = $dirx{'X'}; -isa_ok($statx,'File::stat'); -ok(defined($statx) && $statx->size == 1); + my $statx = $dirx{'X'}; + isa_ok($statx,'File::stat'); + ok(defined($statx) && $statx->size == 1, + "Confirm that we still have the 1-byte file"); -delete $dirx{'X'}; + delete $dirx{'X'}; + + my $description = "Tied hash interface with DIR_UNLINK:"; + $description .= " deleting an element from hash deletes corresponding directory entry"; + ok(!(-f 'X'), $description); + + chdir $cwd or die "Unable to chdir back to $cwd"; +} -ok(!(-f 'X')); -- 2.17.1
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 289b
On Sat, 29 Dec 2018 04:12:12 GMT, jkeenan wrote: [snip] Show quoted text
> > Please review patch attached, which is available for smoke-testing in > this branch: > > smoke-me/jkeenan/smoke-me/jkeenan/133740-io_dir
Branch should be: smoke-me/jkeenan/133740-io_dir -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 491b
On Sat, 29 Dec 2018 04:16:42 GMT, jkeenan wrote: Show quoted text
> On Sat, 29 Dec 2018 04:12:12 GMT, jkeenan wrote: > [snip]
> > > > Please review patch attached, which is available for smoke-testing in > > this branch: > > > > smoke-me/jkeenan/smoke-me/jkeenan/133740-io_dir
> > Branch should be: > > smoke-me/jkeenan/133740-io_dir >
I just got another instance of this error when testing perl on my everyday machine. Please review patch. Thank you very much. -- James E Keenan (jkeenan@cpan.org)
Subject: Re: [perl #133740] Intermittent failures in dist/IO/t/io_dir.t
Date: Tue, 1 Jan 2019 08:55:47 +1100
From: Tony Cook <tony [...] develop-help.com>
CC: perl5-porters [...] perl.org
To: James E Keenan via RT <perlbug-followup [...] perl.org>
Download (untitled) / with headers
text/plain 647b
On Fri, Dec 28, 2018 at 08:12:13PM -0800, James E Keenan via RT wrote: Show quoted text
> Please review patch attached, which is available for smoke-testing in this branch:
The patch seems fine, though some of the test names seem overly verbose. ... Show quoted text
> + ok(-f 'X', "Confirm that file still exists after entry in tied hash has been deleted");
... Show quoted text
> + my $description = "Tied hash interface with DIR_UNLINK:"; > + $description .= " deleting an element from hash deletes corresponding directory entry"; > + ok(!(-f 'X'), $description);
The name of the test doesn't need to be a complete description, as long as it's enough to identify the test. Tony
RT-Send-CC: perl5-porters [...] perl.org
On Mon, 31 Dec 2018 21:56:03 GMT, tonyc wrote: Show quoted text
> On Fri, Dec 28, 2018 at 08:12:13PM -0800, James E Keenan via RT wrote:
> > Please review patch attached, which is available for smoke-testing in > > this branch:
> > The patch seems fine, though some of the test names seem overly > verbose. > > ...
> > + ok(-f 'X', "Confirm that file still exists after entry in tied > > hash has been deleted");
> ...
> > + my $description = "Tied hash interface with DIR_UNLINK:"; > > + $description .= " deleting an element from hash deletes > > corresponding directory entry"; > > + ok(!(-f 'X'), $description);
> > The name of the test doesn't need to be a complete description, as > long as it's enough to identify the test. > > Tony
Thanks for the feedback; I'll revise. In the meantime ... do you have any thoughts on some of my original questions: Do you have any idea why these errors only started showing after the release of perl-5.29.5 (the November release? And is there a way to reproduce them outside the context of smoke-testing? Thank you very much. -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.2k
On Mon, 31 Dec 2018 22:03:21 GMT, jkeenan wrote: Show quoted text
> On Mon, 31 Dec 2018 21:56:03 GMT, tonyc wrote:
> > On Fri, Dec 28, 2018 at 08:12:13PM -0800, James E Keenan via RT > > wrote:
> > > Please review patch attached, which is available for smoke-testing > > > in > > > this branch:
> > > > The patch seems fine, though some of the test names seem overly > > verbose. > > > > ...
> > > + ok(-f 'X', "Confirm that file still exists after entry in tied > > > hash has been deleted");
> > ...
> > > + my $description = "Tied hash interface with DIR_UNLINK:"; > > > + $description .= " deleting an element from hash deletes > > > corresponding directory entry"; > > > + ok(!(-f 'X'), $description);
> > > > The name of the test doesn't need to be a complete description, as > > long as it's enough to identify the test. > > > > Tony
> > Thanks for the feedback; I'll revise. >
Please see additional patch. Show quoted text
> In the meantime ... do you have any thoughts on some of my original > questions: > > Do you have any idea why these errors only started showing after the > release of perl-5.29.5 (the November release? > > And is there a way to reproduce them outside the context of smoke- > testing? > > Thank you very much.
-- James E Keenan (jkeenan@cpan.org)
Subject: 0002-Shorten-test-descriptions.patch
From 64eb20c9fff5bd5ddfa09a1aecda2badb2be6fc2 Mon Sep 17 00:00:00 2001 From: James E Keenan <jkeenan@cpan.org> Date: Tue, 1 Jan 2019 10:27:13 -0500 Subject: [PATCH 2/2] Shorten test descriptions Per recommendation by Tony Cook in RT 133740. --- dist/IO/t/io_dir.t | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/dist/IO/t/io_dir.t b/dist/IO/t/io_dir.t index ba400dee97..6c30143395 100644 --- a/dist/IO/t/io_dir.t +++ b/dist/IO/t/io_dir.t @@ -47,7 +47,7 @@ my $cwd = cwd(); { local $^W; # avoid warnings on invalid dirhandle ok(!$dot->rewind, "rewind on closed"); - ok(!defined($dot->read), "Directory handle closed; hence 'read' returns undef"); + ok(!defined($dot->read), "Directory handle closed; 'read' returns undef"); } open(FH,'>','X') || die "Can't create x"; @@ -68,7 +68,7 @@ my $cwd = cwd(); delete $dir{'X'}; - ok(-f 'X', "Confirm that file still exists after entry in tied hash has been deleted"); + ok(-f 'X', "File still exists after tied hash entry deleted"); my %dirx; tie %dirx, $CLASS, $DIR, DIR_UNLINK; @@ -80,9 +80,7 @@ my $cwd = cwd(); delete $dirx{'X'}; - my $description = "Tied hash interface with DIR_UNLINK:"; - $description .= " deleting an element from hash deletes corresponding directory entry"; - ok(!(-f 'X'), $description); + ok(!(-f 'X'), "Using DIR_UNLINK deletes tied hash element and directory entry"); chdir $cwd or die "Unable to chdir back to $cwd"; } -- 2.17.1
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 1.6k
On Tue, 01 Jan 2019 15:38:13 GMT, jkeenan wrote: Show quoted text
> On Mon, 31 Dec 2018 22:03:21 GMT, jkeenan wrote:
> > On Mon, 31 Dec 2018 21:56:03 GMT, tonyc wrote:
> > > On Fri, Dec 28, 2018 at 08:12:13PM -0800, James E Keenan via RT > > > wrote:
> > > > Please review patch attached, which is available for smoke-testing > > > > in > > > > this branch:
> > > > > > The patch seems fine, though some of the test names seem overly > > > verbose. > > > > > > ...
> > > > + ok(-f 'X', "Confirm that file still exists after entry in tied > > > > hash has been deleted");
> > > ...
> > > > + my $description = "Tied hash interface with DIR_UNLINK:"; > > > > + $description .= " deleting an element from hash deletes > > > > corresponding directory entry"; > > > > + ok(!(-f 'X'), $description);
> > > > > > The name of the test doesn't need to be a complete description, as > > > long as it's enough to identify the test. > > > > > > Tony
> > > > Thanks for the feedback; I'll revise. > >
> > > Please see additional patch. >
Smoke-test results in http://perl.develop-help.com/?b=smoke-me%2Fjkeenan%2F133740-io_dir look good. (No failures except those on smoke-testing rigs which are steadily failing on blead.) Okay to apply the two patches? Show quoted text
>
> > In the meantime ... do you have any thoughts on some of my original > > questions: > > > > Do you have any idea why these errors only started showing after the > > release of perl-5.29.5 (the November release? > > > > And is there a way to reproduce them outside the context of smoke- > > testing? > > > > Thank you very much.
>
Thank you very much. -- James E Keenan (jkeenan@cpan.org)
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 746b
On Thu, 03 Jan 2019 07:07:06 -0800, jkeenan wrote: Show quoted text
> Smoke-test results in http://perl.develop-help.com/?b=smoke- > me%2Fjkeenan%2F133740-io_dir look good. (No failures except those on > smoke-testing rigs which are steadily failing on blead.) > > Okay to apply the two patches?
They look fine to me. On Mon, 31 Dec 2018 14:03:21 -0800, jkeenan wrote: Show quoted text
> In the meantime ... do you have any thoughts on some of my original > questions: > > Do you have any idea why these errors only started showing after the > release of perl-5.29.5 (the November release?
I suspect they were introduced by v5.29.4-41-g9b0adf193c. Show quoted text
> And is there a way to reproduce them outside the context of smoke- > testing?
Test with varying values of TEST_JOBS. Tony
RT-Send-CC: perl5-porters [...] perl.org
Download (untitled) / with headers
text/plain 947b
On Wed, 09 Jan 2019 03:03:58 GMT, tonyc wrote: Show quoted text
> On Thu, 03 Jan 2019 07:07:06 -0800, jkeenan wrote:
> > Smoke-test results in http://perl.develop-help.com/?b=smoke- > > me%2Fjkeenan%2F133740-io_dir look good. (No failures except those on > > smoke-testing rigs which are steadily failing on blead.) > > > > Okay to apply the two patches?
> > They look fine to me.
Thanks. Merging. Will monitor for several days before closing. Show quoted text
> > On Mon, 31 Dec 2018 14:03:21 -0800, jkeenan wrote:
> > In the meantime ... do you have any thoughts on some of my original > > questions: > > > > Do you have any idea why these errors only started showing after the > > release of perl-5.29.5 (the November release?
> > I suspect they were introduced by v5.29.4-41-g9b0adf193c. >
> > And is there a way to reproduce them outside the context of smoke- > > testing?
> > Test with varying values of TEST_JOBS. > > Tony
-- James E Keenan (jkeenan@cpan.org)
Download (untitled) / with headers
text/plain 313b
Thank you for filing this report. You have helped make Perl better. With the release today of Perl 5.30.0, this and 160 other issues have been resolved. Perl 5.30.0 may be downloaded via: https://metacpan.org/release/XSAWYERX/perl-5.30.0 If you find that the problem persists, feel free to reopen this ticket.


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

For issues related to this RT instance (aka "perlbug"), please contact perlbug-admin at perl.org