On Wed, 17 Jul 2019 at 15:04, Branko Čibej <br...@apache.org> wrote: > > On 17.07.2019 10:18, Steve Hay wrote: > > On Tue, 16 Jul 2019 at 18:31, Steve Hay <steve.m....@googlemail.com> wrote: > >> On Tue, 16 Jul 2019 at 14:53, William A Rowe Jr <wr...@rowe-clan.net> > >> wrote: > >>> On Tue, Jul 16, 2019 at 8:10 AM Steve Hay <steve.m....@googlemail.com> > >>> wrote: > >>>> I'm in the process of preparing a new mod_perl release and have run > >>>> into a few test failures on Windows 10 which are caused by apr_stat() > >>>> sometimes returning APR_INCOMPLETE (70008). > >>>> > >>>> I'm only getting this on Windows 10. If I run the same build of > >>>> everything on Windows 7 then everything is fine. I've built everything > >>>> from scratch with VS2019. I get the same behaviour with VS2015. > >>>> > >>>> I'm using apr-1.7.0 / apr-util-1.6.1. Is it worth trying the latest > >>>> dev versions? > >>> > >>> Would you retest with apr-1.6.5? Minor changes to the handling of symbolic > >>> links (junction/reparse points) on Win32 in 1.7.0 may be to blame. > >>> > >>> (Yes, I understand that you are not looking at a symlink in this case.) > >>> > >>> > >> I've built everything in a fresh directory tree in exactly the same > >> way as before but using 1.6.5 instead of 1.7.0 and it behaves the > >> same. > > An update on this: The following program reproduces the problem for > > me, using either branch of the if-block: > > > > use strict; > > use warnings FATAL => 'all'; > > > > use File::Temp qw(tempfile); > > > > use APR::Finfo (); > > use APR::Pool (); > > use APR::Const -compile => qw(FINFO_NORM); > > > > my($fh, $file); > > if (0) { > > ($fh, $file) = tempfile(DIR => '.', UNLINK => 1); > > close $fh; > > } > > else { > > $file = 'test.txt'; > > open $fh, '>', $file; > > close $fh; > > } > > > > print "Testing $file\n"; > > > > my $finfo = APR::Finfo::stat($file, APR::Const::FINFO_NORM, > > APR::Pool->new()); > > > > So it's nothing specific about the way httpd.conf is created. > > > > But if I manually create a file in Windows Explorer and then point the > > above program at that file then it works OK. > > > I suggest you turn off your virus scanner and try again. > > Windows virus scanners are notorious for blocking access to newly > created files for an unreasonable amount of time, causing downstream > operations to fail. In Subversion, we had to code an exponential-backoff > retry loop into our IO operation wrappers, but only on Windows. >
Unfortunately, I'm on a PC controlled by domain admins and I'm unable to disable the virus scanner. The weird permissions thing that I reported in my previous post was due to me having used Cygwin's gzip & tar to extract the mod_perl tarball, which left files and folders with very odd permissions :-/ I've now dodged that trouble by using 7-Zip instead, but now the above script is failing even for files that I manually create! It may be due to virus scanner trouble, but it's unfortunate that apr_stat() fails where C stat() and Perl stat() have no trouble. The attached slightly longer test.pl script tries both apr_stat() (via Perl) and Perl's own stat() on three different files (two temp files made by different means, and one file that I manually created earlier) and I see apr_stat() fail every time but stat() works every time: D:\Dev\Temp\mp2\mod_perl-2.0.11-rc1>perl -Mblib test.pl Testing Fjnk0eaLgS stat() ran OK apr_stat() failed Testing test.txt stat() ran OK apr_stat() failed Testing C:\test.txt stat() ran OK apr_stat() failed More importantly here (to remove Perl from the equation) the attached test.c program also works every time, but the APR-equivalent testapr.c fails every time. Can anyone else reproduce this? There either seems to be something actually wrong in apr_stat() or else it's just trying to be too clever and do too much and maybe needs some backoff & retry logic in it in order to succeed in that, since it currently seems useless compared to C's stat() and Perl's stat() under my set of conditions, which are not at all unusual (simply: Windows 10 with AV turned on).
#include <sys/stat.h> #include <stdio.h> void main(void) { struct _stat buf; const char* file = "C:\\test.txt"; if (_stat(file, &buf) == 0) { printf("stat() ran OK\n"); } else { perror("stat() failed"); } }
#include <apr_pools.h> #include <apr_file_info.h> #include <stdio.h> void main(void) { apr_pool_t* p; apr_finfo_t finfo; const char* file = "C:\\test.txt"; apr_int32_t wanted = APR_FINFO_NORM; apr_status_t status = apr_initialize(); if (status != APR_SUCCESS) { printf("apr_initialize() failed\n"); return; } status = apr_pool_create(&p, NULL); if (status != APR_SUCCESS) { char errbuf[256]; apr_strerror(status, errbuf, sizeof(errbuf)); printf("apr_pool_create() failed: %s\n", errbuf); return; } status = apr_stat(&finfo, file, wanted, p); if (status == APR_SUCCESS) { printf("apr_stat() ran OK\n"); } else { char errbuf[256]; apr_strerror(status, errbuf, sizeof(errbuf)); printf("apr_stat() failed: %s\n", errbuf); } apr_pool_destroy(p); }
test.pl
Description: Binary data