Re: APR 1.0 released - Mailing list pgsql-hackers

From Andrew Dunstan
Subject Re: APR 1.0 released
Date
Msg-id 2671.24.211.141.25.1094470744.squirrel@www.dunslane.net
Whole thread Raw
In response to Re: APR 1.0 released  (Reini Urban <rurban@x-ray.at>)
Responses Re: APR 1.0 released  (Reini Urban <rurban@x-ray.at>)
List pgsql-hackers
Reini Urban said:
> Bruce Momjian schrieb:
>> I looked at the APR code to get some ideas for the Win32 port.  Some
>> of the ideas were good, but in other places like rename they didn't do
>> very well we were better off doing it ourselves and getting it right.
>>
>> I remember looking at their code to fix the rename/unlink while the
>> file is open problem, and they didn't seem to have a fix for that so
>> we developed our own method that works like Unix.
>
> sorry, but your rename doesn't work on cygwin. maybe it works with
> mingw.
>
> cygwin has it's own and working way of doing rename's.
> maybe you should have looked at the cygwin sources instead.
> (src/winsup/cygwin/syscalls.cc)
>
> first doing a WinAPI MoveFileEx and then after a failure trying the
> cygwin version, which will also try its own MoveFile loop, will not
> work. they are conflicting.
>
> same with unlink, but at least the mingw and cygwin unlink versions
> don't conflict here. here you don't stack two conflicting loops
> together. nevertheless cygwin's unlink is much better than pgunlink in
> case of  locking problems. it does its own sort of delayed removal
> then.
>
> IMHO port/dirmod.c is a dirty and half-baked hack, which works for
> mingw  only.


Are you sure you are reading this code correctly? Your reading would only be
correct if WIN32 is defined on Cygwin - it isn't IIRC (don't have a
convenient way to test ATM). The relevant code is this:

#ifdef WIN32while (!MoveFileEx(from, to, MOVEFILE_REPLACE_EXISTING))
#endif
#ifdef __CYGWIN__    while (rename(from, to) < 0)
#endif

If the code doesn't work, please submit empirical proof, rather than make
assertions of "half-baked hack". If it's broken we'll fix it. Bruce's point
about the usefulness of APR remains, nonetheless.

cheers

andrew






pgsql-hackers by date:

Previous
From: Tatsuo Ishii
Date:
Subject: Re: huge execution time difference with almost same plan
Next
From: Reini Urban
Date:
Subject: Re: APR 1.0 released