postgresql/src/bin
Tom Lane 2ec477dc81 Cope with Readline's failure to track SIGWINCH events outside of input.
It emerges that libreadline doesn't notice terminal window size change
events unless they occur while collecting input.  This is easy to stumble
over if you resize the window while using a pager to look at query output,
but it can be demonstrated without any pager involvement.  The symptom is
that queries exceeding one line are misdisplayed during subsequent input
cycles, because libreadline has the wrong idea of the screen dimensions.

The safest, simplest way to fix this is to call rl_reset_screen_size()
just before calling readline().  That causes an extra ioctl(TIOCGWINSZ)
for every command; but since it only happens when reading from a tty, the
performance impact should be negligible.  A more valid objection is that
this still leaves a tiny window during entry to readline() wherein delivery
of SIGWINCH will be missed; but the practical consequences of that are
probably negligible.  In any case, there doesn't seem to be any good way to
avoid the race, since readline exposes no functions that seem safe to call
from a generic signal handler --- rl_reset_screen_size() certainly isn't.

It turns out that we also need an explicit rl_initialize() call, else
rl_reset_screen_size() dumps core when called before the first readline()
call.

rl_reset_screen_size() is not present in old versions of libreadline,
so we need a configure test for that.  (rl_initialize() is present at
least back to readline 4.0, so we won't bother with a test for it.)
We would need a configure test anyway since libedit's emulation of
libreadline doesn't currently include such a function.  Fortunately,
libedit seems not to have any corresponding bug.

Merlin Moncure, adjusted a bit by me
2015-12-16 16:59:35 -05:00
..
initdb Refactor Perl test code 2015-12-02 18:46:16 -03:00
pg_archivecleanup Make WAL-related utilities handle .partial WAL files properly. 2015-07-03 11:53:58 +09:00
pg_basebackup Cleanup some problems in new Perl test code 2015-12-07 19:39:57 -03:00
pg_config Translation updates 2015-06-28 23:56:55 -04:00
pg_controldata Cleanup some problems in new Perl test code 2015-12-07 19:39:57 -03:00
pg_ctl Refactor Perl test code 2015-12-02 18:46:16 -03:00
pg_dump Adopt the GNU convention for handling tar-archive members exceeding 8GB. 2015-11-21 20:21:31 -05:00
pg_resetxlog Make pg_controldata report newest XID with valid commit timestamp 2015-09-24 23:31:17 +09:00
pg_rewind Add missing cleanup logic in pg_rewind/t/005_same_timeline.pl test. 2015-12-14 19:22:50 -05:00
pg_test_fsync Move pg_test_fsync from contrib/ to src/bin/ 2015-04-19 22:20:49 -04:00
pg_test_timing Move pg_test_timing from contrib/ to src/bin/ 2015-04-20 21:30:12 -04:00
pg_upgrade pg_upgrade: fix CopyFile() on Windows to fail on file existence 2015-11-24 17:18:28 -05:00
pg_xlogdump Improve includes introduced in the replication origins patch. 2015-08-06 12:41:46 +02:00
pgbench Fix incorrect tps number calculation in "excluding connections establishing". 2015-09-30 10:53:31 +09:00
pgevent Update copyright for 2015 2015-01-06 11:43:47 -05:00
psql Cope with Readline's failure to track SIGWINCH events outside of input. 2015-12-16 16:59:35 -05:00
scripts Fix behavior of printTable() and friends with externally-invoked pager. 2015-12-02 18:20:41 -05:00
Makefile Move pg_xlogdump from contrib/ to src/bin/ 2015-04-21 19:03:49 -04:00