pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Andrew Dunstan <andrew@dunslane.net>
To: Thomas Munro <thomas.munro@gmail.com>
To: Michael Paquier <michael@paquier.xyz>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>
Subject: Re: Checking pgwin32_is_junction() errors
Date: Mon, 1 Aug 2022 16:06:41 -0400
Message-ID: <e516eed3-3555-cdad-663e-e59e4a2b0355@dunslane.net> (raw)
In-Reply-To: <CA+hUKGL97TZhXcaey8Vm0uKt6CTzyXDDQEvffHh6ZkkmAXvjcQ@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>


On 2022-08-01 Mo 01:09, Thomas Munro wrote:
> On Thu, Jul 28, 2022 at 9:31 PM Thomas Munro <thomas.munro@gmail.com> 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






view thread (17+ messages)  latest in thread

Message-ID: <e516eed3-3555-cdad-663e-e59e4a2b0355@dunslane.net>
Permalink:  ../e516eed3-3555-cdad-663e-e59e4a2b0355@dunslane.net/
Also on:    postgresql.org/message-id/e516eed3-3555-cdad-663e-e59e4a2b0355@dunslane.net

 · 

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: andrew@dunslane.net, thomas.munro@gmail.com, michael@paquier.xyz
  Subject: Re: Checking pgwin32_is_junction() errors
  In-Reply-To: <e516eed3-3555-cdad-663e-e59e4a2b0355@dunslane.net>

* 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