RE: drop tablespace failed when location contains .. on win32

From: "wangsh(dot)fnst(at)fujitsu(dot)com" <wangsh(dot)fnst(at)fujitsu(dot)com>
To: Andrew Dunstan <andrew(at)dunslane(dot)net>, Michael Paquier <michael(at)paquier(dot)xyz>
Cc: PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Kyotaro Horiguchi <horikyota(dot)ntt(at)gmail(dot)com>
Subject: RE: drop tablespace failed when location contains .. on win32
Date: 2021-09-12 07:33:23
Message-ID: TY2PR01MB421975D9184BAF6FBAC2262BF2D89@TY2PR01MB4219.jpnprd01.prod.outlook.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hi,

> -----Original Message-----
> From: Andrew Dunstan <andrew(at)dunslane(dot)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 Content-Type Size
0001-WIP-change-is_absolute_path-s-action.patch application/octet-stream 828 bytes
0002-WIP-make-canonicalize_path-remove-all-.-in-path.patch application/octet-stream 5.4 KB
0003-WIP-add-a-canonicalize_path-test.patch application/octet-stream 3.7 KB

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Etsuro Fujita 2021-09-12 08:44:16 Doc: Extra type info on postgres-fdw option import_generated in back branches
Previous Message David G. Johnston 2021-09-12 06:03:25 Re: Confusing messages about index row size