Wonky rename semantics on Windows

From: Thomas Munro <thomas(dot)munro(at)enterprisedb(dot)com>
To: Pg Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Wonky rename semantics on Windows
Date: 2018-11-21 04:43:47
Message-ID: CAEepm=0FV-k+=d9z08cW=ZXoR1=kw9wdpkP6WAuOrKJdz-8ujg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2018-11-21 04:51:17 Re: Wonky rename semantics on Windows
Previous Message Andres Freund 2018-11-21 04:08:37 Re: [RFC] Removing "magic" oids