pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Nathan Bossart <nathandbossart@gmail.com>
Cc: Fujii Masao <masao.fujii@oss.nttdata.com>
Cc: Andy Fan <zhihuifan1213@163.com>
Cc: pgsql-hackers@lists.postgresql.org
Subject: Re: pgbench error: (setshell) of script 0; execution of meta-command failed
Date: Mon, 13 Jan 2025 17:51:54 -0500
Message-ID: <570943.1736808714@sss.pgh.pa.us> (raw)
In-Reply-To: <Z4U5j_FWpNLjtdU8@nathan>
References: <87msfz5qv2.fsf@163.com>
	<87ikqn5em7.fsf@163.com>
	<e03fc711-8c48-4fb8-ba94-0862c920c30f@oss.nttdata.com>
	<b0afe844-84b7-4154-ad2c-6763ff84d876@oss.nttdata.com>
	<2422778.1736521065@sss.pgh.pa.us>
	<2425050.1736522451@sss.pgh.pa.us>
	<127979.1736622253@sss.pgh.pa.us>
	<Z4U5j_FWpNLjtdU8@nathan>

Nathan Bossart <nathandbossart@gmail.com> writes:
> On Sat, Jan 11, 2025 at 02:04:13PM -0500, Tom Lane wrote:
>> What I propose doing in the released branches is what's shown in
>> the attached patch for v17: rename port/pqsignal.c's function to
>> pqsignal_fe in frontend, but leave it as pqsignal in the backend.
>> Leaving it as pqsignal in the backend preserves ABI for extension
>> modules, at the cost that it's not entirely clear which pqsignal
>> an extension that's also linked with libpq will get.  But that
>> hazard affects none of our code, and it existed already for any
>> third-party extensions that call pqsignal.  In principle using
>> "pqsignal_fe" in frontend creates an ABI hazard for outside users of
>> libpgport.a.  But I think it's not really a problem, because we don't
>> support that as a shared library.  As long as people build with
>> headers and .a files from the same minor release, they'll be OK.

> I don't have any concrete reasons to think you are wrong about this, but it
> does feel somewhat risky to me.  It might be worth testing it with a couple
> of third-party projects that use the frontend version of pqsignal().
> codesearch.debian.net shows a couple that may be doing so [0] [1] [2].

It's fair to worry about this, but I don't think my testing that would
prove a lot.  AFAICS, whether somebody runs into trouble would depend
on many factors like their specific build process and what versions of
which packages they have installed.

In any case, I think we have a very limited amount of wiggle room.
We definitely cannot change libpq's ABI without provoking howls of
anguish.

I have been wondering whether it would help to add something like
this at the end of port/pqsignal.c in the back branches:

	#ifdef FRONTEND
	#undef pqsignal

	/* ABI-compatibility wrapper */
	pqsigfunc
	pqsignal(int signo, pqsigfunc func)
	{
	    return pqsignal_fe(signo, func);
	}
	#endif

(plus or minus an extern or so, but you get the idea).  The point of
this is that compiling against old headers and then linking against
newer libpgport.a would still work.  It does nothing however for the
reverse scenario of compiling against new headers and then linking
against old libpgport.a.  So I haven't persuaded myself that it's
worth the trouble -- but I'm happy to include it if others think
it would help.

			regards, tom lane





view thread (17+ messages)  latest in thread

Message-ID: <570943.1736808714@sss.pgh.pa.us>
Permalink:  ../570943.1736808714@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/570943.1736808714@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, nathandbossart@gmail.com, masao.fujii@oss.nttdata.com, zhihuifan1213@163.com, pgsql-hackers@lists.postgresql.org
  Subject: Re: pgbench error: (setshell) of script 0; execution of meta-command failed
  In-Reply-To: <570943.1736808714@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox