Re: longjmp in psql considered harmful - Mailing list pgsql-hackers

From Martijn van Oosterhout
Subject Re: longjmp in psql considered harmful
Date
Msg-id 20060613083108.GA19212@svana.org
Whole thread Raw
In response to Re: longjmp in psql considered harmful  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
On Mon, Jun 12, 2006 at 08:14:01PM -0400, Tom Lane wrote:
> I had interpreted the readline documentation to mean that readline would
> discard a partially typed line upon catching SIGINT.  Experimentation
> shows that this is not so, at least not with the version of readline I
> use here.  It does catch the signal and reset some internal state, but
> the partially typed line is NOT discarded.  Grumble.

Yeah, the documentation in readline there was pretty obtuse, but since
it didn't explicitly include typed characters as state, I figured it
didn't clear the line.

> I'll work on reviewing and applying the patch.  I don't much like the
> side-effects on the /scripts directory though ... there must be a better
> way than that.  Is it sane to declare the flag variable in print.c?

The problem is basically that some of those files are symlinked across
the tree and included from various different places. Some places
include print.c but don't include the signal handler stuff, which left
we with linker errors about undefined symbols.

In psql the symbol comes from common.c and so I also added it to
scripts/common.c, which cleared up all the errors. This would allow
psql to work and all other programs that included print.c would only
ever see zero in that variable.

Maybe some other arrangement is possible. Maybe like you suggest,
declare the symbol in print.c and make the declaration in common.c an
extern. The end result is the same though.

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

pgsql-hackers by date:

Previous
From: Simon Riggs
Date:
Subject: Re: [PATCHES] Non-transactional pg_class, try 2
Next
From: Kris Kennaway
Date:
Subject: Re: postgresql and process titles