Re: psql bug

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Teodor Sigaev <teodor(at)sigaev(dot)ru>
Cc: Pgsql Hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: psql bug
Date: 2012-05-22 03:44:02
Message-ID: 17378.1337658242@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Teodor Sigaev <teodor(at)sigaev(dot)ru> writes:
>> Seems system() call cleanups sigaction state on FreeBSD.

> The root of problem is a threading library. In FreeBSD there are two versions of
> sigaction() (system() and others) depending on thread enabled. libpq library is
> compiled by default with -pthread switch but psql is linked without that.
> This mixed linkage is a reason why system() call for external program loses
> signal handler.

> Next, configure script correctly sets PTHREAD_* variables but PTHREAD_LIBS is
> not used for psql linking.

> What is the best way to fix that? I suggest to add PTHREAD_LIBS to linking psql
> at least. Although, suppose, it could be a reason for other cryptic bugs.

We could probably "fix" this by adding something like this to
Makefile.freebsd:

libpq += $(PTHREAD_LIBS)

However, the more I think about this, the more I think it is a FreeBSD
bug and the right solution is to complain loudly to the maintainers of
that platform. The above hack might fix things for programs we ship as
part of Postgres, but what of other programs using libpq? It cannot be
rational to expect that if libpq is linked to libpthread, then every
program that links to libpq must also be explicitly linked to
libpthread. FreeBSD's linker is broken and they need to fix it, or
else they need to fix libpthread to be less invasive.

(Another reason for thinking this is that surely we'd have heard about
it before if this behavior were of long standing. My money is on a
fairly recently introduced bug.)

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Qi Huang 2012-05-22 05:02:38 Strange query planner behavior
Previous Message Noah Misch 2012-05-22 01:54:44 Re: Draft release notes complete