Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

seq fault on Cntrl-q #20

Closed
bkerin opened this issue Nov 6, 2017 · 15 comments
Closed

seq fault on Cntrl-q #20

bkerin opened this issue Nov 6, 2017 · 15 comments

Comments

@bkerin
Copy link

bkerin commented Nov 6, 2017

when I do ddgr hello world, then type Cntrl-q at the prompt, ddgr dies with a seg fault

It would be sort of nice if Cntrl-q also meant quit. I have a bit of a crazed personal mission of making
Cntrl-q mean "get rid of the current thing" across all my software. Of course it sort of works as it is so maybe I shouldn't be reporting this issue :)

@jarun
Copy link
Owner

jarun commented Nov 6, 2017

I know Linux GUI apps quit on ^Q but ^Q has an entirely different meaning in the CLI world:

$ stty -a
...
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; discard = ^O;
min = 1; time = 0;
...

We have three ways to quit from the utility. Should be enough.

Also can you please share the exact steps? I am pressing ^Q at the prompt but I don't see the segfault.

@bkerin
Copy link
Author

bkerin commented Nov 6, 2017 via email

@jarun
Copy link
Owner

jarun commented Nov 7, 2017

Can you please share the output from from the Exception?

@jarun jarun closed this as completed Nov 9, 2017
@bkerin
Copy link
Author

bkerin commented Nov 9, 2017 via email

@jarun
Copy link
Owner

jarun commented Nov 10, 2017

I copied the content above into ~/.inputrc and tried ^Q. No exception.

users who stand a good chance of caring about this sort of customizability

No, my other utility googler has thousands of users already over several years and no one came up with this issue so far. it's very much your personal customization.

As I requested in my last comment, if you can provide the output_in_the_terminal when this Exception happens, I'll see if I can make something out of it.

@bkerin
Copy link
Author

bkerin commented Nov 10, 2017 via email

@bkerin
Copy link
Author

bkerin commented Nov 10, 2017 via email

@jarun
Copy link
Owner

jarun commented Nov 10, 2017

I believe the answer lies in the core dump. Can you share the backtrace from it?

@bkerin
Copy link
Author

bkerin commented Nov 10, 2017 via email

@jarun
Copy link
Owner

jarun commented Nov 10, 2017

It's the correct procedure. Also, the top 3 frames show that readline is invoked to handle the input and it fails:

#1  0x00007fbbde1ab92e in rl_callback_read_char ()
   from /lib/x86_64-linux-gnu/libreadline.so.6
#2  0x00007fbbde3cd0b2 in readline_until_enter_or_signal (
    prompt=0x7fbbddf2ec40 "\033[7mddgr (? for help)\033[0m ",
    signal=0x7fff0e366d98)
    at /scratch/packages/python/3.4/python3.4-3.4.2/Modules/readline.c:1103
#3  0x00007fbbde3cd203 in call_readline (
    sys_stdin=0x7fbbe0d0a4e0 <_IO_2_1_stdin_>,
    sys_stdout=0x7fbbe0d0a2a0 <_IO_2_1_stdout_>,
    prompt=0x7fbbddf2ec40 "\033[7mddgr (? for help)\033[0m ")
    at /scratch/packages/python/3.4/python3.4-3.4.2/Modules/readline.c:1191
...

The 3 params passed over from the python subsystem (stdin, stdout and prompt string) have nothing unusual in them (stdin and stdout are from the env without any modifications and the prompt is a simple string). I believe this has to be looked into by the readline team for further info on what's going wrong.

@jarun
Copy link
Owner

jarun commented Nov 10, 2017

What happens if you comment out the import readline block towards the top of the ddgr file?

diff --git a/ddgr b/ddgr
index df6802d..df9ae91 100755
--- a/ddgr
+++ b/ddgr
@@ -29,10 +29,12 @@ import sys
 import textwrap
 import urllib.parse
 from urllib3.util import parse_url
+'''
 try:
     import readline
 except ImportError:
     pass
+'''
 import webbrowser

 # Basic setup

@jarun jarun removed the no response label Nov 10, 2017
@bkerin
Copy link
Author

bkerin commented Nov 10, 2017 via email

@jarun
Copy link
Owner

jarun commented Nov 10, 2017

That isolates the problem to the GNU readline library. I believe you can reproduce it easily without ddgr. Write a simple 3-line python3 script, import readline and call input('somestring ').

#!/usr/bin/env python3

import readline

input('myprompt: ')

@bkerin
Copy link
Author

bkerin commented Nov 11, 2017 via email

@jarun
Copy link
Owner

jarun commented Nov 12, 2017

👍

@github-actions github-actions bot locked and limited conversation to collaborators Jun 16, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants