Ye olde write_history() return code problem

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: pgsql-hackers(at)postgreSQL(dot)org
Subject: Ye olde write_history() return code problem
Date: 2015-03-14 01:11:52
Message-ID: 30248.1426295512@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

Browse pgsql-hackers by date

  From Date Subject
Next Message David Rowley 2015-03-14 01:51:49 Re: Performance improvement for joins where outer side is unique
Previous Message Peter Geoghegan 2015-03-14 00:54:46 Re: Re: Abbreviated keys for Datum tuplesort