octave-bug-tracker
[Top][All Lists]
Advanced

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

[Octave-bug-tracker] [bug #52146] CTRL+C and cursor up results in segfau


From: Dan Sebald
Subject: [Octave-bug-tracker] [bug #52146] CTRL+C and cursor up results in segfault
Date: Sat, 30 Sep 2017 13:03:27 -0400 (EDT)
User-agent: Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:55.0) Gecko/20100101 Firefox/55.0

Follow-up Comment #2, bug #52146 (project octave):

I can't repeat that here, but that doesn't mean this isn't an Octave bug.

The error message you are seeing originates from GNU readline, so I doubt you
would have a chance to use the debugger to much effect unless readline were
built with debug info.  Since I can't replicate the crash and get the message,
I'm not 100% sure which readline is being used on my system (5.2 or 6.3):


sebald@ ~ $ ls /lib/x86_64-linux-gnu/libreadline.so*
/lib/x86_64-linux-gnu/libreadline.so.5
/lib/x86_64-linux-gnu/libreadline.so.5.2
/lib/x86_64-linux-gnu/libreadline.so.6
/lib/x86_64-linux-gnu/libreadline.so.6.3


If Octave ends up using 6.3, perhaps that is more robust to this situation.

My thinking is this could be a simple one or two line change.

First hypothesis
----------------
The readline library needs to be initialized with using_history():

https://tiswww.case.edu/php/chet/readline/history.html#SEC10

and one line of thought is that without an .octave_hist file present, perhaps
Octave is inadvertently skipping the call to using_history() such that
readline's innards aren't properly initialized when the up-arrow initiates a
fetch from readline's symbol list.

However, it's strange that only such an error would occur after a Cntrl-C
rather than an up-arrow immediately upon launch.  What is it about Cntrl-C
that would affect the history list internal to GNU readline?  Is Cntrl-C
removing a command from the list?

OK, I don't think it is an initialization issue.  I've printed out a comment
at every location there is a using_history() [why it appears so often, I don't
know]:


sebald@ ~ $ rm .octave_hist 
sebald@ ~ $ /usr/local/src/octave/octave/build1/run-octave --no-gui
[snip]
using_history #5
octave:1> 


So, using_history() does get called.

Second hypothesis
-----------------
Given that the error is occurring in readline, it must be readline's use of
history, for which prev-history (up arrow) is described here

http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC15

Could it be that SIGINT handling is doing something strange?

http://cnswww.cns.cwru.edu/php/chet/readline/readline.html#SEC44

"
When a SIGINT is received, the Readline signal handler performs some
additional work, which will cause any partially-entered line to be aborted
(see the description of rl_free_line_state() below).
"

That would seem like a bug in library readline, wouldn't it?

Could you try the following?


rm .octave_hist
./run-octave --no-gu
typesometext
<cntrl-C>
<up-arrow>


Are you ever seeing a crash in that case?

    _______________________________________________________

Reply to this item at:

  <http://savannah.gnu.org/bugs/?52146>

_______________________________________________
  Message sent via/by Savannah
  http://savannah.gnu.org/




reply via email to

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