help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: inputrc issue


From: Mike Miller
Subject: Re: inputrc issue
Date: Sun, 16 Oct 2005 12:57:03 -0500 (CDT)

On Sun, 16 Oct 2005, John W. Eaton wrote:

| Where does Octave read the global inputrc?

Octave doesn't. Readline does. So it happens when readline is initialized. But, there is a function in newer versions of Octave to tell readline to read an init file:

read_readline_init_file is a built-in function

-- Built-in Function:  read_readline_init_file (FILE)
    Read the readline library initialiazation file FILE.  If FILE is
    omitted, read the default initialization file (normally
    `~/.inputrc'.

Nice. After putting an inputrc file in the right place, I added this to my global octaverc file:

read_readline_init_file("/usr/local/share/octave/2.1.71/m/startup/inputrc")

It worked perfectly.


Internally, this just sets the global (C, readline library) variable
rl_readline_name to the tilde-expanded, absolute name of FILE, then
calls rl_re_read_init_file (0, 0).  The assumption is that the init
file is read when readline is first initialized, so we call
rl_re_read_init_file instead of rl_read_init_file.  Is that somehow
not happening on your system?  I suppose you could check with a gdb
(try setting a breakpoint in rl_read_init_file):

 gdb octave
 ...
 (gdb) b main
 (gdb) r
 ...
 (gdb) b rl_read_init_file
 (gdb) c
 ...

or maybe use strace to see if the ~/.inputrc file is ever opened.


Well, I don't really understand this stuff, but this is what I get when I run some of those commands (before setting octaverc to load inputrc):

gdb octave
GNU gdb Red Hat Linux (6.3.0.0-1.62rh)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB.  Type "show warranty" for details.
This GDB was configured as "i386-redhat-linux-gnu"...Using host libthread_db library 
"/lib/tls/libthread_db.so.1".

(gdb) b main
Breakpoint 1 at 0x8048731: file main.c, line 36.
(gdb) r
Starting program: /home/mbmiller/local/bin/octave

Breakpoint 1, main (argc=1, argv=0xbfffa464) at main.c:36
36      main.c: No such file or directory.
        in main.c
(gdb) b rl_read_init_file
Breakpoint 2 at 0x65de16
(gdb) c
Continuing.

Breakpoint 2, 0x0065de16 in rl_read_init_file () from /usr/lib/libreadline.so.4
(gdb) quit
The program is running.  Exit anyway? (y or n) yes


Here are some lines from strace:


open("/home/mbmiller/local/lib/octave-2.1.71/libreadline.so.4", O_RDONLY) = -1 
ENOENT (No such file or directory)
open("/usr/lib/libreadline.so.4", O_RDONLY) = 3
stat64("/etc/inputrc", {st_mode=S_IFREG|0644, st_size=709, ...}) = 0
open("/etc/inputrc", O_RDONLY)          = 3
stat64("/etc/inputrc", {st_mode=S_IFREG|0644, st_size=709, ...}) = 0
open("/etc/inputrc", O_RDONLY)          = 3


Well, dummy that I am, I can still see the "No such file" entry there. So I do this:

cd /home/mbmiller/local/lib/octave-2.1.71/
ln -s ../../../../../usr/lib/libreadline.so.4


But now I'm left with this:

open("/home/mbmiller/local/lib/octave-2.1.71/libreadline.so.4", O_RDONLY) = 3
stat64("/etc/inputrc", {st_mode=S_IFREG|0644, st_size=709, ...}) = 0
open("/etc/inputrc", O_RDONLY)          = 3
stat64("/etc/inputrc", {st_mode=S_IFREG|0644, st_size=709, ...}) = 0
open("/etc/inputrc", O_RDONLY)          = 3


So doesn't this mean that Octave is only reading /etc/inputrc and not reading ~/.inputrc?

Thanks very much, John!

Mike



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]