Re: pgsql: Move tablespace path re-creation from the makefiles to pg_regres

From: Michael Paquier <michael(at)paquier(dot)xyz>
To: Noah Misch <noah(at)leadboat(dot)com>
Cc: Robert Haas <robertmhaas(at)gmail(dot)com>, Christoph Berg <myon(at)debian(dot)org>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: pgsql: Move tablespace path re-creation from the makefiles to pg_regres
Date: 2021-04-09 06:00:31
Message-ID: YG/tf6HTZFj4hWlb@paquier.xyz
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers pgsql-hackers

On Wed, Mar 24, 2021 at 07:56:59PM -0700, Noah Misch wrote:
> That would entail forbidding various shell metacharacters in @testtablespace(at)(dot)
> One could avoid imposing such a restriction by adding a mkdir() function to
> regress.c and writing it like:
>
> CREATE FUNCTION mkdir(text)
> RETURNS void AS '@libdir@/regress(at)DLSUFFIX@', 'regress_mkdir'
> LANGUAGE C STRICT\;
> REVOKE ALL ON FUNCTION mkdir FROM public;
> SELECT mkdir('@testtablespace@');
> CREATE TABLESPACE regress_tblspace LOCATION '@testtablespace@';

Sounds simple.

>> I doubt that all the Windows environments would be able to get their
>> hands on that.
>
>> And I am not sure either that this would work when it
>> comes to the CI case, again on Windows.
>
> How might a CI provider break that?

I am wondering about potential issues when it comes to create the
base tablespace path from the Postgres backend, while HEAD does it
while relying on a restricted token obtained when starting
pg_regress.

I have compiled a simple patch that uses a SQL function for the base
tablespace directory creation, that I have tested on Linux and MSVC.
To get some coverage with the CF bot, I am adding a CF entry with this
thread.

I am still not sure if people would prefer this approach over what's
on HEAD. So if there are any opinions, please feel free.
--
Michael

Attachment Content-Type Size
regress-mkdir.patch text/x-diff 3.7 KB

In response to

Responses

Browse pgsql-committers by date

  From Date Subject
Next Message Amit Kapila 2021-04-09 06:42:02 Re: pgsql: Add a new GUC and a reloption to enable inserts in parallel-mode
Previous Message Michael Paquier 2021-04-09 04:56:16 pgsql: Fix typos and grammar in documentation and code comments

Browse pgsql-hackers by date

  From Date Subject
Next Message Thomas Munro 2021-04-09 06:11:35 Re: buildfarm instance bichir stuck
Previous Message Amit Kapila 2021-04-09 05:04:38 Re: missing documentation for streaming in-progress transactions