Обсуждение: Readline support in psql -- worked earlier for me
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
"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
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 >
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.
"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
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. >
"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
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
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 >
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 >> >