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 1oIbgk-00042o-63 for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Aug 2022 20:06:54 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1oIbgi-0003aK-S3 for pgsql-hackers@arkaria.postgresql.org; Mon, 01 Aug 2022 20:06:52 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIbgi-0003YA-ID for pgsql-hackers@lists.postgresql.org; Mon, 01 Aug 2022 20:06:52 +0000 Received: from relay4-d.mail.gandi.net ([217.70.183.196]) by magus.postgresql.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1oIbgb-0006bs-IS for pgsql-hackers@postgresql.org; Mon, 01 Aug 2022 20:06:51 +0000 Received: (Authenticated sender: adsend@dunslane.net) by mail.gandi.net (Postfix) with ESMTPSA id E678BE0008; Mon, 1 Aug 2022 20:06:42 +0000 (UTC) Message-ID: Date: Mon, 1 Aug 2022 16:06:41 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.5.0 Subject: Re: Checking pgwin32_is_junction() errors Content-Language: en-US To: Thomas Munro , Michael Paquier Cc: pgsql-hackers References: From: Andrew Dunstan In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk On 2022-08-01 Mo 01:09, Thomas Munro wrote: > On Thu, Jul 28, 2022 at 9:31 PM Thomas Munro wrote: >> There's one curious change in the draft patch attached: you can't >> unlink() a junction point, you have to rmdir() it. Previously, things >> that traverse directories without ever calling pgwin32_is_junction() >> would see junction points as S_ISDIR() and call rmdir(), which was OK, >> but now they see S_ISLNK() and call unlink(). So I taught unlink() to >> try both things. Which is kinda weird, and not beautiful, especially >> when combined with the existing looping weirdness. > Here's a new attempt at unlink(), this time in its own patch. This > version is a little more careful about calling rmdir() only after > checking that it is a junction point, so that unlink("a directory") > fails just like on Unix (well, POSIX says that that should fail with > EPERM, not EACCES, and implementations are allowed to make it work > anyway, but it doesn't seem helpful to allow it to work there when > every OS I know of fails with EPERM or EISDIR). That check is racy, > but should be good enough for our purposes, no (see comment for a note > on that)? > > Longer term, I wonder if we should get rid of our use of symlinks, and > instead just put paths in a file and do our own path translation. But > for now, this patch set completes the set of junction point-based > emulations, and, IMHO, cleans up a confusing aspect of our code. > > As before, 0001 is just for cfbot to add an MSYS checkmark. I'll try it out on fairywren/drongo. cheers andrew -- Andrew Dunstan EDB: https://www.enterprisedb.com