RE: drop tablespace failed when location contains .. on win32 - Mailing list pgsql-hackers

From wangsh.fnst@fujitsu.com
Subject RE: drop tablespace failed when location contains .. on win32
Date
Msg-id TY2PR01MB421975D9184BAF6FBAC2262BF2D89@TY2PR01MB4219.jpnprd01.prod.outlook.com
Whole thread Raw
In response to Re: drop tablespace failed when location contains .. on win32  (Andrew Dunstan <andrew@dunslane.net>)
Responses Re: drop tablespace failed when location contains .. on win32
List pgsql-hackers
Hi,

> -----Original Message-----
> From: Andrew Dunstan <andrew@dunslane.net>
> Sent: Thursday, September 9, 2021 8:30 PM

> I think I would say that we should remove any "." or ".." element in the
> path except at the beginning, and in the case of ".." also remove the
> preceding element, unless someone can convince me that there's a problem
> with that.

These WIP patches try to remove all the '.' or '..' in the path except at
the beginning.

0001 is a small fix, because I find that is_absolute_path is not appropriate,
see comment in skip_drive:
> * On Windows, a path may begin with "C:" or "//network/".

But this modification will lead to a regress test failure on Windows:
> -- Will fail with bad path
> CREATE TABLESPACE regress_badspace LOCATION '/no/such/location';
> -ERROR:  directory "/no/such/location" does not exist
> +ERROR:  tablespace location must be an absolute path

Do you think this modification is necessary ?

Rest of the modification is in 0002. I think this patch need more test and review.

0003 is a test extension for me to check the action of canonicalize_path.
Do you think is necessary to add this test extension(and some test scripts) to master ?
If necessary,  maybe I can use the taptest to test the action of canonicalize_path
in Linux and Windows.


I will add this to next commitfest after further test .

Regards.
Shenhao Wang

Attachment

pgsql-hackers by date:

Previous
From: "David G. Johnston"
Date:
Subject: Re: Confusing messages about index row size
Next
From: Etsuro Fujita
Date:
Subject: Doc: Extra type info on postgres-fdw option import_generated in back branches