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 1nEaKZ-0004f3-Pa for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Jan 2022 17:19:07 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1nEaKY-0000dd-JZ for pgsql-hackers@arkaria.postgresql.org; Mon, 31 Jan 2022 17:19:06 +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 1nEaKY-0000dU-Ae for pgsql-hackers@lists.postgresql.org; Mon, 31 Jan 2022 17:19:06 +0000 Received: from sss.pgh.pa.us ([66.207.139.130]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1nEaKV-0007AS-Bs for pgsql-hackers@lists.postgresql.org; Mon, 31 Jan 2022 17:19:05 +0000 Received: from sss1.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.pgh.pa.us (8.15.2/8.15.2) with ESMTP id 20VHIuf6684310; Mon, 31 Jan 2022 12:18:56 -0500 From: Tom Lane To: Andrew Dunstan cc: Michael Paquier , "wangsh.fnst@fujitsu.com" , Julien Rouhaud , Kyotaro Horiguchi , "pgsql-hackers@lists.postgresql.org" Subject: Re: drop tablespace failed when location contains .. on win32 In-reply-to: <18bc9d6b-4c9d-771f-b7d9-f294f3b34d2e@dunslane.net> References: <20210913.173629.689388354506122738.horikyota.ntt@gmail.com> <1479474.1636584211@sss.pgh.pa.us> <20220117004038.fcywmknzj45kiulz@jrouhaud> <462031.1643579403@sss.pgh.pa.us> <18bc9d6b-4c9d-771f-b7d9-f294f3b34d2e@dunslane.net> Comments: In-reply-to Andrew Dunstan message dated "Mon, 31 Jan 2022 11:58:00 -0500" MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <684308.1643649536.1@sss.pgh.pa.us> Date: Mon, 31 Jan 2022 12:18:56 -0500 Message-ID: <684309.1643649536@sss.pgh.pa.us> List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk Andrew Dunstan writes: > On 1/30/22 16:50, Tom Lane wrote: >> Here's a revised patch version that does it like that. I also >> reviewed and simplified the canonicalize_path logic. I think >> this is committable. > LGTM Pushed, thanks for looking. I think I'm also going to have a look at simplifying some of the dependent code, just because it feels weird to leave that unfinished. In particular, Shenhao-san suggested upthread that we could remove path_contains_parent_reference(). I complained about that at the time, but I hadn't quite absorbed the fact that an absolute path is now *guaranteed* not to have any ".." after canonicalize_path. So the existing calls in adminpack.c and genfile.c are certainly dead code. We probably want to keep path_contains_parent_reference() in case some extension is using it, but seeing that its API spec already requires the input to be canonicalized, it could be simplified to just check for ".." at the start. regards, tom lane