You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Mladen Turk <mt...@mappingsoft.com> on 2001/07/10 16:41:09 UTC

Error in apr_stat for WIN platform

Hi all,
I don't now who is in charge for that particular peace of code, but...
 
First of all, can someone explain to me what would be the counterpart of
APR_FINFO_DEV and APR_FINFO_INODE on Windows platform, and also browsing
entire source I didn't found any reference to those two defines even on
UNIX, but those two defines are combined in APR_FINFO_NORM, and
implications on using it on apr_stat on WIN32 platform are that existing
file is reported as non-existing.
One example of that is that the htpasswd (Apache 2) utility doesn't work
on WIN32, well you can create the file and initial user, but you can't
add any further user to the same file because apr_stat reports that the
requested file does not exists. Of course if you use APR_FINFO_MIN in
call to apr_stat, then it reports that file as existent.
 
To resolve the problems when using flag APR_FINFO_NORM on WIN32 platform
I've added the following on line 272 in file 
file_io/win32/filestat.c
    finfo->valid |= APR_FINFO_DEV | APR_FINFO_INODE;
after that the apr_stat behaves as should (I hope). I know that this
disables checking for those two flags, but as I said what would be the
purpose for them at all.
 
Cheers,
 
Mladen Turk
MCSE/GIS Specialist
Sisiceva 10,
10000 Zagreb, Croatia
mailto: mturk@mappingsoft.com
http://www.mappingsoft.com
 

Re: Error in apr_stat for WIN platform

Posted by "William A. Rowe, Jr." <wr...@rowe-clan.net>.
From: "Mladen Turk" <mt...@mappingsoft.com>
Sent: Tuesday, July 10, 2001 9:41 AM


> Hi all,
> I don't now who is in charge for that particular peace of code, but...

APR doesn't have 'owners' in the sense that 1.3 ports and modules had official
'maintainers', but I'll address most anything on the Win32 port.

> First of all, can someone explain to me what would be the counterpart of
> APR_FINFO_DEV and APR_FINFO_INODE on Windows platform, and also browsing
> entire source I didn't found any reference to those two defines even on
> UNIX, but those two defines are combined in APR_FINFO_NORM, and
> implications on using it on apr_stat on WIN32 platform are that existing
> file is reported as non-existing.

The APR_FINFO_family of flags are results that _may_ be returned on a given
platform as apr_finfo_t->valid bits.  If you ask, and they can't be given
(but the general function succeeded) the result should be APR_INCOMPLETE.

APR_FINFO_INODE corresponds to the ->inode member, APR_FINFO_DEV is the ->device
member.  On NT, we can only get these members through an open file handle, so
we don't return them unless we are asked for those members (heavy cpu waste).
The two together are also known as APR_FINFO_IDENT, meaning device:inode should
return a unique identity for the file.

So please retest and let us know what error you are getting.  If it's a not found
or access error, it seems the system is unable to open the handle to the file.
Perhaps something was broken in the fileopen.c code that is hurting us here.

> One example of that is that the htpasswd (Apache 2) utility doesn't work
> on WIN32, well you can create the file and initial user, but you can't
> add any further user to the same file because apr_stat reports that the
> requested file does not exists. Of course if you use APR_FINFO_MIN in
> call to apr_stat, then it reports that file as existent.

And that's all that's required, I'll patch, thanks!

> To resolve the problems when using flag APR_FINFO_NORM on WIN32 platform
> I've added the following on line 272 in file 
> file_io/win32/filestat.c
>     finfo->valid |= APR_FINFO_DEV | APR_FINFO_INODE;
> after that the apr_stat behaves as should (I hope). I know that this
> disables checking for those two flags, but as I said what would be the
> purpose for them at all.

Because you CAN'T start flagging invalid/unimplemented fields as valid.
So this patch is entirely wrong.

I'll look at the bigger picture, but check for an APR_INCOMPLETE result specifically,
and you should be OK on any platform (OS2/Win32/Netware/Amiga) that doesn't support
even where a given stat field is not supported.

Bill