develooper Front page | perl.perl5.porters | Postings from November 2018

[perl #132663] t/io/fs.t failures on NetBSD with noatime mounts

From:
James E Keenan via RT
Date:
November 6, 2018 18:22
Subject:
[perl #132663] t/io/fs.t failures on NetBSD with noatime mounts
Message ID:
rt-4.0.24-8442-1541528518-1035.132663-15-0@perl.org
On Wed, 31 Oct 2018 23:43:07 GMT, jkeenan wrote:
> On Wed, 31 Oct 2018 01:56:13 GMT, jkeenan wrote:
> > On Thu, 28 Dec 2017 15:50:55 GMT, slaven@rezic.de wrote:
> > > >
> > > This is a bug report for perl from slaven@rezic.de,
> > > generated with the help of perlbug 1.40 running under perl 5.26.1.
> > > >
> > > >
> > > -----------------------------------------------------------------
> > > On NetBSD systems t/io/fs.t may fail:
> > > >
> > > >
> > > # Failed test 30 - atime at t/io/fs.t line 324
> > > # Failed test 31 - mtime at t/io/fs.t line 325
> > > # Failed test 36 - atime at t/io/fs.t line 324
> > > # Failed test 37 - mtime at t/io/fs.t line 325
> > > t/io/fs.t .. Failed 4/61 subtests
> > >         (less 5 skipped subtests: 52 okay)
> > > >
> > > Test Summary Report
> > > -------------------
> > > t/io/fs.t (Wstat: 0 Tests: 61 Failed: 4)
> > >   Failed tests:  30-31, 36-37
> > > Files=1, Tests=61,  1 wallclock secs ( 0.28 usr  0.08 sys +  0.20
> > > cusr  0.11 csys =  0.67 CPU)
> > > Result: FAIL
> > > >
> > > >
> > > This happens if the filesystem where the test files are created
> > > s mounted with noatime. Unlike on other OS, it's not possible
> > > to change the accesstime using utime* on NetBSD in this situation.
> > > >
> > > A related issue with more discussion:
> > > https://github.com/golang/go/issues/19293
> > > >
> > > Probably it's best to skip this test if $^O eq 'netbsd' and
> > > `mount | grep $tmpdir` shows that noatime is enabled.
> > > >
> > > As a side note, it looks like the mtime test is also failing,
> > > but this is a limitation in the test script --- probably the last
> > > two fails in check_utime_result() should be differentiated.
> > > >
> > > And as a last note, I don't have a NetBSD machine to test --- the
> > > problem was just suspected by me and confirmed by Nigel Horne.
> > > >
> > > -----------------------------------------------------------------
> > > ---
> > > Flags:
> > >     category=core
> > >     severity=low
> > > ---
> > > This perlbug was built using Perl 5.20.2 - Mon Sep 18 18:13:32 UTC
> > > 2017
> > > It is being executed now by  Perl 5.26.1 - Sat Sep 23 09:36:11 CEST
> > > 2017.
> > > >
> > > (perl -V output is irrelevant --- sent from a different machine)
> > >
> >
> >
> > Today I applied a series of patches to t/io/fs.t which were intended
> > to make the code more readable and the test descriptions more self-
> > documenting.
> >
> > In the course of doing so, I noticed one anomaly at precisely the
> > point in the code where Sevan Janiyan has proposed a patch based on
> > what has been used in NetBSD pkgsrc for several years.  In blead (as
> > of today), that point is:
> >
> > #####
> > 477 sub check_utime_result {
> > 478     ($ut, $accurate_timestamps, $delta) = @_;
> > ...
> > 496         if($atime == $ut && $mtime == $ut + $delta) {
> > 497             pass('atime: granularity test');
> > 498             pass('mtime: granularity test');
> > 499         }
> > 500         else {
> > 501             if ($^O =~ /\blinux\b/i) {
> > ...
> > 521             elsif ($^O eq 'haiku') {
> > 522                 SKIP: {
> > 523                     skip "atime not updated", 1; # <--
> > 524                 }
> > 525                 is($mtime, 500000001, 'mtime');
> > 526             }
> > ...
> > #####
> >
> > Note that in lines 522-524 we have a SKIP block which does not
> > contain
> > any tests to be skipped!  I've been mulling possible explanations for
> > this.
> >
> > * Should the test on line 525 have been *inside* the skip block?  If
> > so, it would never be exercised, because the t/test.pl:skip()
> > function
> > on line 523 has no condition attached to it.  It has no 'if' or
> > 'unless' clause after the number of tests to be skipped.
> >
> > * Is this just a roundabout way of guaranteeing that there are 2
> > tests
> > -- one for 'atime' and one for 'mtime' for each OS?  If so, wouldn't
> > a
> > simple 'pass("atime not updated");' have been sufficient?
> >
> > To investigate this, I performed a series of 'git blame' calls.  It
> > turns out that this code dates back to 2001:
> >
> > #####
> > commit 20dd405caf5525a1659669e686c37f3d71a0ef6e
> > Author:     Michael G. Schwern <schwern@pobox.com
> > AuthorDate: Wed Dec 12 15:33:42 2001 -0500
> > Commit:     Jarkko Hietaniemi <jhi@iki.fi
> > CommitDate: Thu Dec 13 02:47:27 2001 +0000
> >
> > Proper skip tests and VMS unlink
> > ...
> > -} elsif ($^O eq 'beos') {
> > -    if ($mtime == 500000001) {
> > -        pass("mtime (atime not updated)");
> > -    } else {
> > -       fail("mtime $mtime (atime not updated)");
> > ...
> > +        elsif ($^O eq 'beos') {
> > +            SKIP: { skip "atime not updated", 1; }
> > +            is($mtime, 500000001, 'mtime');
> > +        }
> > #####
> >
> > (beos is the OS predecessor of haiku.)
> >
> > So the SKIP block without a skip condition or a test to be skipped
> > dates back to 2001.  The NetBSD patch (once adapted to apply to
> > blead)
> > would entail changing:
> >
> > elsif ($^O eq 'haiku') {
> >
> > to
> >
> > elsif ($^O eq 'haiku' || $^O eq 'netbsd') {
> >
> > But should we leave the body of that 'elsif' block unchanged?
> >
> > Thank you very much.
> 
> In commit b3259969157a58bdc63ef35e4469b04ce5f4aec3 to blead, I adapted
> the patch suggested by Sevan Janiyan from NetBSD pkgsrc.  I changed
> the 'skip' test which lacked a test to skip to a 'pass'.  I'll monitor
> smoke tests of blead several days before closing the ticket.
> 
> Thank you very much.

The only test failure observed in t/io/fs.t (http://perl5.test-smoke.org/report/73374) has been on minix, an operating system on which Sevan has just begun to update Perl 5.  That failure did not occur in the section of the test file affected by this commit.  So I'm resolving this ticket.

Thank you very much.

-- 
James E Keenan (jkeenan@cpan.org)

---
via perlbug:  queue: perl5 status: open
https://rt.perl.org/Ticket/Display.html?id=132663



nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About