Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oKy31-00071L-A1 for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Aug 2022 08:23:39 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oKy30-0006J3-7C for pgsql-hackers@arkaria.postgresql.org; Mon, 08 Aug 2022 08:23:38 +0000 Received: from makus.postgresql.org ([2001:4800:3e1:1::229]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oKy2z-0006Iu-OL for pgsql-hackers@lists.postgresql.org; Mon, 08 Aug 2022 08:23:37 +0000 Received: from mail.postgrespro.ru ([93.174.131.139]) by makus.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oKy2w-0006n9-D5 for pgsql-hackers@postgresql.org; Mon, 08 Aug 2022 08:23:36 +0000 Received: from mail.postgrespro.ru (cyclops.postgrespro.ru [93.174.131.138]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) by mail.postgrespro.ru (Postfix) with ESMTPSA id 1E48221C1AAE; Mon, 8 Aug 2022 11:23:30 +0300 (MSK) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=postgrespro.ru; s=mail; t=1659947011; bh=oQpxNk/zVEPGPruCvT3PPNv4PrwjfVUDrcuTkVPkcOw=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=nozdvrfiv0TtY8tUj7coIXkGIin7UCkHsdJN9KRnq9K0EUq7ZwoUh8lvWIVLjzNlj 9a0VHifTNfw760tydbNHYjlbIQ8ELqmycp5eV8tXdYVCWA4Q7sLE2Ls7BLxDJLKcIq +VbNtj7eEhy6QojjqTnGNRopKCcUL2TCNmSz0P6k= MIME-Version: 1.0 Date: Mon, 08 Aug 2022 15:23:30 +0700 From: r.zharkov@postgrespro.ru To: Thomas Munro Cc: Andrew Dunstan , Michael Paquier , pgsql-hackers Subject: Re: Checking pgwin32_is_junction() errors In-Reply-To: References: <205d5e64-6e0a-dede-5128-a55b54f4356f@dunslane.net> User-Agent: Roundcube Webmail/1.4.11 Message-ID: <4590c37927d7b8ee84f9855d83229018@postgrespro.ru> X-Sender: r.zharkov@postgrespro.ru Content-Type: multipart/mixed; boundary="=_efbcdb742a364ca6856da0b04a17f29c" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --=_efbcdb742a364ca6856da0b04a17f29c Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed 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#L357. 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 --=_efbcdb742a364ca6856da0b04a17f29c Content-Transfer-Encoding: base64 Content-Type: text/x-diff; name=dirmod.c.patch Content-Disposition: attachment; filename=dirmod.c.patch; size=514 ZGlmZiAtLWdpdCBhL3NyYy9wb3J0L2Rpcm1vZC5jIGIvc3JjL3BvcnQvZGlybW9kLmMKaW5kZXgg MjgxOGJmZDJlOTUuLjlkNzM2MjBhNmJhIDEwMDY0NAotLS0gYS9zcmMvcG9ydC9kaXJtb2QuYwor KysgYi9zcmMvcG9ydC9kaXJtb2QuYwpAQCAtMzU0LDcgKzM1NCw4IEBAIHBncmVhZGxpbmsoY29u c3QgY2hhciAqcGF0aCwgY2hhciAqYnVmLCBzaXplX3Qgc2l6ZSkKIAkgKiBJZiB0aGUgcGF0aCBz dGFydHMgd2l0aCAiXD8/XCIsIHdoaWNoIGl0IHdpbGwgZG8gaW4gbW9zdCAoYWxsPykgY2FzZXMs CiAJICogc3RyaXAgdGhvc2Ugb3V0LgogCSAqLwotCWlmIChyID4gNCAmJiBzdHJuY21wKGJ1Ziwg IlxcPz9cXCIsIDQpID09IDApCisJaWYgKHIgPiA0ICYmIHN0cm5jbXAoYnVmLCAiXFw/P1xcIiwg NCkgPT0gMCAmJgorCQlzdHJuY21wKGJ1ZiwgIlxcPz9cXFZvbHVtZSIsIDEwKSAhPSAwKQogCXsK IAkJbWVtbW92ZShidWYsIGJ1ZiArIDQsIHN0cmxlbihidWYgKyA0KSArIDEpOwogCQlyIC09IDQ7 Cg== --=_efbcdb742a364ca6856da0b04a17f29c--