lincheney / rl_custom_function

Inject custom functions into readline
GNU General Public License v3.0
16 stars 2 forks source link

strace shows "$include function ..." in .inputrc was not treated correctly #5

Open Fedora7 opened 2 years ago

Fedora7 commented 2 years ago

On Ubuntu 20.04, complete log files of strace for python, lftp are attached.

cat .inputrc $include function rl_custom_isearch /home/user2/git.local/test2/rl_custom_isearch/target/release/librl_custom_isearch.so "\C-r": rl_custom_isearch

test command: LD_PRELOAD=/home/user2/git.local/rl_custom_function/target/release/librl_custom_function.so strace -o /tmp/strace.python.txt 'python'

important log messages: openat(AT_FDCWD, "/home/user2/git.local/rl_custom_function/target/release/librl_custom_function.so", O_RDONLY|O_CLOEXEC) = 3 access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory) openat(AT_FDCWD, "/lib/x86_64-linux-gnu/libreadline.so.8", O_RDONLY|O_CLOEXEC) = 3

openat(AT_FDCWD, "/home/user2/.inputrc", O_RDONLY) = 3

openat(AT_FDCWD, "function rl_custom_isearch /home/user2/git.local/test2/rl_custom_isearch/target/release/librl_custom_isearch.so", O_RDONLY) = -1 ENOENT (No such file or directory)

The last message showed the syntax of $include function ... in .inputrc was not treated correctly even librl_custom_function.so was preloaded. That caused the portion of "function ... " being loaded as a regular file name.

Any idea what cause the problem ? Thanks

strace.lftp.txt strace.python.txt

lincheney commented 2 years ago

Honestly I have no clue, that looks very strange :( The way it works is it is meant to hijack rl_parse_and_bind but for whatever reason something is going wrong there with yours. If you are willing, perhaps you can try add some logging to https://github.com/lincheney/rl_custom_function/blob/master/src/lib.rs#L96 and see if what is happening?

losnappas commented 1 year ago

Having the same problem. Any logs that would be helpful?