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

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: "wangsh(dot)fnst(at)fujitsu(dot)com" <wangsh(dot)fnst(at)fujitsu(dot)com>
Cc: Andrew Dunstan <andrew(at)dunslane(dot)net>, 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-13 07:06:52
Message-ID: YT74jO2LwChTmE58@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Sep 12, 2021 at 07:33:23AM +0000, wangsh(dot)fnst(at)fujitsu(dot)com wrote:
> 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/".

#define is_absolute_path(filename) \
( \
- IS_DIR_SEP((filename)[0]) || \
+ (IS_DIR_SEP((filename)[0]) && IS_DIR_SEP((filename)[1])) || \
(isalpha((unsigned char) ((filename)[0])) && (filename)[1] == ':' && \
IS_DIR_SEP((filename)[2])) \
With this change you would consider a path beginning with "/foo/.." as
not being an absolute path, but that's not correct. Or am I missing
something obvious?

> 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 am not sure that this is worth the cycles spent on, so I would
discard it. This will help a lot in reviewing this patch, for sure.
And you could add some regression tests to show how much testing you
have done, for both WIN32 and non-WIN32. I do that from time to time,
and was actually thinking to test this API this way.
--
Michael

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Kyotaro Horiguchi 2021-09-13 07:12:47 Re: Allow escape in application_name
Previous Message Corey Huinker 2021-09-13 06:45:04 Re: WIP: System Versioned Temporal Table