Ye olde write_history() return code problem - Mailing list pgsql-hackers

From Tom Lane
Subject Ye olde write_history() return code problem
Date
Msg-id 30248.1426295512@sss.pgh.pa.us
Whole thread Raw
List pgsql-hackers
David Johnston's recent gripe reminded me of the problem we've been
working around for many years, that readline and libedit don't agree
on the return code convention for write_history().  We've attempted
to work around that by supposing that if errno becomes set to nonzero
during write_history() then there was a failure, regardless of whether
the library returned a failure code or not.  Well, this was always
fragile, and I suspect that it may be broken in David's environment.

But: it turns out that "they don't agree" is obsolete information!
libedit fixed their code to agree with readline back around 2006;
they both now do "0 if ok, errno code if not".

I would imagine therefore that just about any Linux distribution
in current use is shipping a libedit that works "correctly".
I poked into Apple's source code and found that OS X has this
fixed in 10.5 (Leopard) and later, so there also it's fairly
likely that nobody's still using old libedit.  (Um, well,
prairiedog.  But I could install readline on that.)

So it seems like we could change our code to rely on the readline
return convention instead of doing something that neither library
promises to work.

Thoughts?  Should we back-patch that, or not?
        regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Geoghegan
Date:
Subject: Re: Re: Abbreviated keys for Datum tuplesort
Next
From: David Rowley
Date:
Subject: Re: Performance improvement for joins where outer side is unique