Wonky rename semantics on Windows - Mailing list pgsql-hackers

From Thomas Munro
Subject Wonky rename semantics on Windows
Date
Msg-id CAEepm=0FV-k+=d9z08cW=ZXoR1=kw9wdpkP6WAuOrKJdz-8ujg@mail.gmail.com
Whole thread Raw
Responses Re: Wonky rename semantics on Windows
List pgsql-hackers
Hi,

I saw this failure:

https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=bowerbird&dt=2018-11-21%2000%3A51%3A32

I think there may be more than one thing going wrong there, but one
things I noticed was this:

2018-11-20 21:49:50.935 EST [9700:18] LOG:  could not rename temporary
statistics file "pg_stat_tmp/global.tmp" to "pg_stat_tmp/global.stat":
Permission denied

That probably has to do with rename() not behaving like Unix, and I
see there have been threads about this before[1].

Googling led me to some recently posted clues on SO and elsewhere
about a flag FILE_RENAME_FLAG_POSIX_SEMANTICS which can be used with
SetFileInformationByHandle(), that wasn't mentioned in the earlier
-hackers threads.  I tried it on AppVeyor.  It appears to work, even
when both source and target file name exist and both files currently
have an open handle.  Perhaps they needed this for the Windows 10 WSL
stuff?

https://github.com/macdice/hello-windows/blob/rename-test/test.c
https://ci.appveyor.com/project/macdice/hello-windows/builds/20450990

I wonder if they also have a new secret fully POSIX unlink() hidden in
there somewhere too.

[1]
https://www.postgresql.org/message-id/flat/CAPpHfds9trA6ipezK3BsuuOSQwEmESiqj8pkOxACFJpoLpcoNw%40mail.gmail.com#9b04576b717175e9dbf03cc991977d3f

-- 
Thomas Munro
http://www.enterprisedb.com


pgsql-hackers by date:

Previous
From: Andres Freund
Date:
Subject: Re: [RFC] Removing "magic" oids
Next
From: Thomas Munro
Date:
Subject: Re: Wonky rename semantics on Windows