develooper Front page | perl.perl5.porters | Postings from May 2002

File::stat::stat test issue

Chip Turner
May 28, 2002 23:55
File::stat::stat test issue
Message ID:

The test in the SKIP block of the File::stat test script has a logic
issue.  It assumes that perl's open method behaves like the native
OS's open method with respect to atime.  However, this isn't
necessarily the case, as perl's open may go any number of routes
(perlio, stdio, sfio, etc).  One such route involves a mmap of the
file for faster performance (ie, glibc changed its fopen behavior).
Since perl seems to be calling fopen instead of open in some cases
(-Uuseperlio in this example), I don't believe the specs state that
the atime of the file must be unmodified, as they do with fopen.  So
the test that ensires the atime before and after opening the file read
only are the same is incorrect.  That is, unless perl wants to ensure
this behavior to applications, in which case a lot of other changes
need making in the IO layers.

It's trivial to patch this test away, so I've not included it here.
This, and the previous issue with readonly mmap stdio from the
upcoming glibc 2.3.0, are going to be very common issues as various
linuxes move towards newer glibc's.  The mmap stdio issue is fixed
with -Uuseperlio, though this is probably not quite optimal.


Chip Turner         
                              Red Hat, Inc. Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About