pg.ddx.io  pgsql-hackers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-hackers@lists.postgresql.org
Cc: pgbf@twiska.com
Subject: psql tab completion versus Debian's libedit
Date: Tue, 01 Feb 2022 16:30:11 -0500
Message-ID: <960764.1643751011@sss.pgh.pa.us> (raw)

I chased down the failure that kittiwake has been showing since
02b8048ba [1].  It's not hard to reproduce if you have an older
Debian release and you build --with-libedit-preferred.
Manual experimentation shows that when these versions of libedit
complete a string containing double quotes, they insist on
backslashing all the double quotes :-(.  That is, if you have
a table "foobar" and you type

select * from "foo<TAB>

what you'll get is

select * from \"foobar\"

Digging into the source code, I find that libedit versions prior
to 3.1-20210522 are unshakably convinced that anything you are
completing should be escaped per shell quoting rules :-(.  AFAICT
there is no way to turn that off without replacing the *entire*
tab completion infrastructure.

3.1-20210522 changed this to the extent of disabling quoting
if the application supplies a rl_attempted_completion_function,
as we do.  (Fine for us, sucks for anybody who did want shell
quoting.)

I'm not too sure about the relationship of Debian's version of
libedit to anyone else's.  Apple's version, for one, lacks this
bug.  But it does appear that you don't want to use libedit on
Debian unless you have a very late-model release.

We can paper over the regression failure by making the test
cases allow backslashes, but I wonder if we need something
in the documentation discouraging people from choosing these
versions of libedit over readline.  They're pretty broken for
completions involving double-quoted names even before 02b8048ba.

			regards, tom lane

[1] https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=kittiwake&dt=2022-01-31%2016%3A24%3A48





view thread (5+ messages)  latest in thread

Message-ID: <960764.1643751011@sss.pgh.pa.us>
Permalink:  ../960764.1643751011@sss.pgh.pa.us/
Also on:    postgresql.org/message-id/960764.1643751011@sss.pgh.pa.us

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-hackers@postgresql.org
  Cc: tgl@sss.pgh.pa.us, pgsql-hackers@lists.postgresql.org, pgbf@twiska.com
  Subject: Re: psql tab completion versus Debian's libedit
  In-Reply-To: <960764.1643751011@sss.pgh.pa.us>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox