pg.ddx.io pgsql-hackers@postgresql.org mailing list archive
help / color / mirror / Atom feed From: r.zharkov@postgrespro.ru
To: Thomas Munro <thomas.munro@gmail.com>
Cc: Andrew Dunstan <andrew@dunslane.net>
Cc: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Checking pgwin32_is_junction() errors
Date: Mon, 08 Aug 2022 15:23:30 +0700
Message-ID: <4590c37927d7b8ee84f9855d83229018@postgrespro.ru> (raw )
In-Reply-To: <CA+hUKGK+V61MRXsjUEO5GnhmpveoL6v5Ud7by2DFwVTeZuUBeg@mail.gmail.com >
References: <CA+hUKGLfOOeyZpm5ByVcAt7x5Pn-=xGRNCvgiUPVVzjFLtnY0w@mail.gmail.com >
<YmEOJwmmKPugH41o@paquier.xyz >
<CA+hUKG+ntyS1CDxf5z9qNS41uYasqCQf+o44X3ALD9XnUmmqRA@mail.gmail.com >
<CA+hUKGL97TZhXcaey8Vm0uKt6CTzyXDDQEvffHh6ZkkmAXvjcQ@mail.gmail.com >
<e516eed3-3555-cdad-663e-e59e4a2b0355@dunslane.net >
<205d5e64-6e0a-dede-5128-a55b54f4356f@dunslane.net >
<CA+hUKGKn7Krpdx1+Wy5jMzKBZBP7hUX8igyMYXRRrDiQy_rPZw@mail.gmail.com >
<CA+hUKGKWR3=B_=qg_+bmX=pjtQ5Zk_3Agco7xg8GgpvZBafJ7w@mail.gmail.com >
<CA+hUKGK+V61MRXsjUEO5GnhmpveoL6v5Ud7by2DFwVTeZuUBeg@mail.gmail.com >
On 2022-08-06 08:02, Thomas Munro wrote:
>
> Pushed.
>
> Hmm, this stuff could *really* use a little test framework that's run
> by check-world, that exercises these various replacement operations.
> But I also suspect that problems in this area are likely to be due to
> concurrency. It's hard to make a simple test that simulates the case
> where a file is unlinked between system calls within stat() and hits
> the STATUS_DELETE_PENDING case. That check is code I cargo-culted in
> this patch. So much of the stuff we've had in the tree relating to
> that area has been wrong in the past...
Hello, hackers!
initdb on my windows 10 system stopped working after the commit
c5cb8f3b: "Provide lstat() for Windows."
The error message is: creating directory C:/HOME/data ... initdb:
error: could not create directory "C:/HOME": File exists
"C:/HOME" is the junction point to the second volume on my hard drive -
"\??\Volume{GUID}\" which name pgreadlink() erroneously strips here:
https://github.com/postgres/postgres/blob/7e29a79a46d30dc236d097825ab849158929d977/src/port/dirmod.c... .
So initdb could not stat the file with name "Volume{GUID}", tried to
create it and failed.
With the attached patch initdb works fine again.
--
regards,
Roman
Attachments:
dirmod.c.patch (text/x-diff, 514B) download
diff --git a/src/port/dirmod.c b/src/port/dirmod.c
index 2818bfd2e95..9d73620a6ba 100644
--- a/src/port/dirmod.c
+++ b/src/port/dirmod.c
@@ -354,7 +354,8 @@ pgreadlink(const char *path, char *buf, size_t size)
* If the path starts with "\??\", which it will do in most (all?) cases,
* strip those out.
*/
- if (r > 4 && strncmp(buf, "\\??\\", 4) == 0)
+ if (r > 4 && strncmp(buf, "\\??\\", 4) == 0 &&
+ strncmp(buf, "\\??\\Volume", 10) != 0)
{
memmove(buf, buf + 4, strlen(buf + 4) + 1);
r -= 4;
view thread (17+ messages) latest in thread
Message-ID: <4590c37927d7b8ee84f9855d83229018@postgrespro.ru>
Permalink: ../4590c37927d7b8ee84f9855d83229018@postgrespro.ru/
Also on: postgresql.org/message-id/4590c37927d7b8ee84f9855d83229018@postgrespro.ru
copy link · copy postgr.es · copy git am
reply Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-hackers@postgresql.org
Cc: r.zharkov@postgrespro.ru, thomas.munro@gmail.com, andrew@dunslane.net, michael@paquier.xyz
Subject: Re: Checking pgwin32_is_junction() errors
In-Reply-To: <4590c37927d7b8ee84f9855d83229018@postgrespro.ru>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox