pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Readline support in psql -- worked earlier for me
10+ messages / 3 participants
[nested] [flat]

* Readline support in psql -- worked earlier for me
@ 2008-06-19 13:15  Peter Kovacs <maxottovonstirlitz@gmail.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Peter Kovacs @ 2008-06-19 13:15 UTC (permalink / raw)
  To: pgsql-admin

Hi,

It appears as though psql ignored the settings in my ~/.inputrc file:

-----------------
[pkovacs@pokkermann bin]$ cat ~/.inputrc
set editing-mode vi
set disable-completion on
-----------------

psql persists in emacs mode and completion is not disabled either.

-----------------
[pkovacs@pokkermann bin]$ psql --version
psql (PostgreSQL) 8.3.3
contains support for command-line editing
-----------------

Any suggestions appreciated!

Thanks
Peter



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Readline support in psql -- worked earlier for me
@ 2008-06-19 15:24  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter Kovacs <maxottovonstirlitz@gmail.com>
  0 siblings, 1 reply; 10+ messages in thread

From: Tom Lane @ 2008-06-19 15:24 UTC (permalink / raw)
  To: Peter Kovacs <maxottovonstirlitz@gmail.com>; +Cc: pgsql-admin

"Peter Kovacs" <maxottovonstirlitz@gmail.com> writes:
> It appears as though psql ignored the settings in my ~/.inputrc file:

Seems to work for me in 8.3.3.  Maybe a permissions problem on your
.inputrc file?  If you can't figure it out, one way to attack the
problem is to strace psql startup, then look through the output to
find where it tries to open .inputrc, and see what happens exactly.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Readline support in psql -- worked earlier for me
@ 2008-06-19 15:36  Peter Kovacs <maxottovonstirlitz@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 2 replies; 10+ messages in thread

From: Peter Kovacs @ 2008-06-19 15:36 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin

It doesn't appear to be interested in my ~/.inputrc file:

--------------
[pkovacs@pokkermann bin]$ grep '\/home\/pkovacs\/\.' f
stat64("/home/pkovacs/.pgpass", {st_mode=S_IFREG|0600, st_size=66, ...}) = 0
open("/home/pkovacs/.pgpass", O_RDONLY|O_LARGEFILE) = 4
access("/home/pkovacs/.psqlrc-8.3.3", R_OK) = -1 ENOENT (No such file
or directory)
access("/home/pkovacs/.psqlrc", R_OK)   = -1 ENOENT (No such file or directory)
open("/home/pkovacs/.psql_history", O_RDONLY) = 5
stat64("/home/pkovacs/.terminfo", 0xbf8f3a94) = -1 ENOENT (No such
file or directory)
open("/home/pkovacs/.psql_history", O_WRONLY|O_CREAT|O_TRUNC, 0600) = 4
--------------

But looks into /etc/inputrc:

--------------
[pkovacs@pokkermann bin]$ grep 'inputrc' f
stat64("/etc/inputrc", {st_mode=S_IFREG|0644, st_size=758, ...}) = 0
open("/etc/inputrc", O_RDONLY)          = 5
--------------

Should I, perhaps, set something in ~/.psqlrc ? Or is there something
to set in /etc/inputrc ?

Thanks
Peter

On Thu, Jun 19, 2008 at 5:24 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> "Peter Kovacs" <maxottovonstirlitz@gmail.com> writes:
>> It appears as though psql ignored the settings in my ~/.inputrc file:
>
> Seems to work for me in 8.3.3.  Maybe a permissions problem on your
> .inputrc file?  If you can't figure it out, one way to attack the
> problem is to strace psql startup, then look through the output to
> find where it tries to open .inputrc, and see what happens exactly.
>
>                        regards, tom lane
>



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Readline support in psql -- worked earlier for me
@ 2008-06-19 16:13  Alvaro Herrera <alvherre@commandprompt.com>
  parent: Peter Kovacs <maxottovonstirlitz@gmail.com>
  1 sibling, 1 reply; 10+ messages in thread

From: Alvaro Herrera @ 2008-06-19 16:13 UTC (permalink / raw)
  To: Peter Kovacs <maxottovonstirlitz@gmail.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-admin

Peter Kovacs escribió:
> It doesn't appear to be interested in my ~/.inputrc file:

Maybe your readline version stopped looking at ~/.inputrc for some
reason.  Check what bash looks like in strace -- if it's consistent with
what psql does then it's readline.

-- 
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Readline support in psql -- worked earlier for me
@ 2008-06-19 17:27  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Peter Kovacs <maxottovonstirlitz@gmail.com>
  1 sibling, 1 reply; 10+ messages in thread

From: Tom Lane @ 2008-06-19 17:27 UTC (permalink / raw)
  To: Peter Kovacs <maxottovonstirlitz@gmail.com>; +Cc: pgsql-admin

"Peter Kovacs" <maxottovonstirlitz@gmail.com> writes:
> It doesn't appear to be interested in my ~/.inputrc file:

Weird.  What readline version are you using, on what platform?

> But looks into /etc/inputrc:

Could there be something in /etc/inputrc that tells it not to look
at your private file?

When you say "worked earlier", what does that mean exactly ---
was it with a different readline version?

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Readline support in psql -- worked earlier for me
@ 2008-06-19 17:40  Peter Kovacs <maxottovonstirlitz@gmail.com>
  parent: Alvaro Herrera <alvherre@commandprompt.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Peter Kovacs @ 2008-06-19 17:40 UTC (permalink / raw)
  To: Alvaro Herrera <alvherre@commandprompt.com>; +Cc: Tom Lane <tgl@sss.pgh.pa.us>; pgsql-admin

bash honors the settings in ~/.inputrc . Completion gets disabled in a
new bash shell.

Thanks
Peter

On Thu, Jun 19, 2008 at 6:13 PM, Alvaro Herrera
<alvherre@commandprompt.com> wrote:
> Peter Kovacs escribió:
>> It doesn't appear to be interested in my ~/.inputrc file:
>
> Maybe your readline version stopped looking at ~/.inputrc for some
> reason.  Check what bash looks like in strace -- if it's consistent with
> what psql does then it's readline.
>
> --
> Alvaro Herrera                                http://www.CommandPrompt.com/
> The PostgreSQL Company - Command Prompt, Inc.
>



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Readline support in psql -- worked earlier for me
@ 2008-06-19 18:06  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 10+ messages in thread

From: Tom Lane @ 2008-06-19 18:06 UTC (permalink / raw)
  To: Peter Kovacs <maxottovonstirlitz@gmail.com>; +Cc: pgsql-admin

"Peter Kovacs" <maxottovonstirlitz@gmail.com> writes:
> Gosh, it is working now -- now that I am connected to my local
> postgresql instance. I assume psql's behavior doesn't depend on the
> version/location/readline-support of backend, correct?

I just found that psql on my Fedora machine ignores ~/.inputrc,
just like you said.  Some poking around turned up the reason;

$ env | grep -i inp
INPUTRC=/etc/inputrc

Per the readline manual:

	Any user can customize programs that use Readline by
	putting commands in an "inputrc" file, conventionally in his home
	directory.  The name of this file is taken from the value of the
	environment variable `INPUTRC'.  If that variable is unset, the default
	is `~/.inputrc'.  If that file does not exist or cannot be read, the
	ultimate default is `/etc/inputrc'.

Further poking found this in /etc/profile:

if [ -z "$INPUTRC" -a ! -f "$HOME/.inputrc" ]; then
    INPUTRC=/etc/inputrc
fi

So the answer seems to be that if you create an ~/.inputrc that wasn't
there before, it won't work till you start a new shell, at least if
you've got a system that presets INPUTRC for you like this.

I find this pretty stupid, actually, since per the manual readline
can fall back to /etc/inputrc all by itself; all the /etc/profile code
is accomplishing is to screw up this corner case.  Off to file something
in bugzilla.

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Readline support in psql -- worked earlier for me
@ 2008-06-19 18:13  Tom Lane <tgl@sss.pgh.pa.us>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 10+ messages in thread

From: Tom Lane @ 2008-06-19 18:13 UTC (permalink / raw)
  To: Peter Kovacs <maxottovonstirlitz@gmail.com>; +Cc: pgsql-admin

I wrote:
> I find this pretty stupid, actually, since per the manual readline
> can fall back to /etc/inputrc all by itself; all the /etc/profile code
> is accomplishing is to screw up this corner case.  Off to file something
> in bugzilla.

Somebody already did ...
https://bugzilla.redhat.com/show_bug.cgi?id=443717

			regards, tom lane



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Readline support in psql -- worked earlier for me
@ 2008-06-19 21:05  Peter Kovacs <maxottovonstirlitz@gmail.com>
  parent: Tom Lane <tgl@sss.pgh.pa.us>
  0 siblings, 1 reply; 10+ messages in thread

From: Peter Kovacs @ 2008-06-19 21:05 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin

Thank  you, Tom!

Peter

On Thu, Jun 19, 2008 at 8:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
> I wrote:
>> I find this pretty stupid, actually, since per the manual readline
>> can fall back to /etc/inputrc all by itself; all the /etc/profile code
>> is accomplishing is to screw up this corner case.  Off to file something
>> in bugzilla.
>
> Somebody already did ...
> https://bugzilla.redhat.com/show_bug.cgi?id=443717
>
>                        regards, tom lane
>



^ permalink  raw  reply  [nested|flat] 10+ messages in thread

* Re: Readline support in psql -- worked earlier for me
@ 2008-08-21 07:08  Peter Kovacs <maxottovonstirlitz@gmail.com>
  parent: Peter Kovacs <maxottovonstirlitz@gmail.com>
  0 siblings, 0 replies; 10+ messages in thread

From: Peter Kovacs @ 2008-08-21 07:08 UTC (permalink / raw)
  To: Tom Lane <tgl@sss.pgh.pa.us>; +Cc: pgsql-admin

Loosely related:

Fedora is apparently not the only Linux distribution showing a
hard-to-explain predilection for messing with readline. With one
particular debian-etch-based distro (voyage linux), having ~/.inputrc
with just "set editing-mode vi" results into bash using ksh completion
keybindings. I needed to add "TAB complete" to get the default bash
behaviour back.

Peter

On Thu, Jun 19, 2008 at 11:05 PM, Peter Kovacs
<maxottovonstirlitz@gmail.com> wrote:
> Thank  you, Tom!
>
> Peter
>
> On Thu, Jun 19, 2008 at 8:13 PM, Tom Lane <tgl@sss.pgh.pa.us> wrote:
>> I wrote:
>>> I find this pretty stupid, actually, since per the manual readline
>>> can fall back to /etc/inputrc all by itself; all the /etc/profile code
>>> is accomplishing is to screw up this corner case.  Off to file something
>>> in bugzilla.
>>
>> Somebody already did ...
>> https://bugzilla.redhat.com/show_bug.cgi?id=443717
>>
>>                        regards, tom lane
>>
>



^ permalink  raw  reply  [nested|flat] 10+ messages in thread


end of thread, other threads:[~2008-08-21 07:08 UTC | newest]

Thread overview: 10+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2008-06-19 13:15 Readline support in psql -- worked earlier for me Peter Kovacs <maxottovonstirlitz@gmail.com>
2008-06-19 15:24 ` Tom Lane <tgl@sss.pgh.pa.us>
2008-06-19 15:36   ` Peter Kovacs <maxottovonstirlitz@gmail.com>
2008-06-19 16:13     ` Alvaro Herrera <alvherre@commandprompt.com>
2008-06-19 17:40       ` Peter Kovacs <maxottovonstirlitz@gmail.com>
2008-06-19 17:27     ` Tom Lane <tgl@sss.pgh.pa.us>
2008-06-19 18:06       ` Tom Lane <tgl@sss.pgh.pa.us>
2008-06-19 18:13         ` Tom Lane <tgl@sss.pgh.pa.us>
2008-06-19 21:05           ` Peter Kovacs <maxottovonstirlitz@gmail.com>
2008-08-21 07:08             ` Peter Kovacs <maxottovonstirlitz@gmail.com>

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