bugGNU Octave - Bugs: bug #51903, Ctrl-Z causes multiple...


bug #51903: Ctrl-Z causes multiple "^Z" echos at octave prompt

Submitted by:  Dmitri A. Sergatskov <dasergatskov>
Submitted on:  Thu 31 Aug 2017 12:43:05 PM UTC  
Category:  Interpreter Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Other
Status:  Fixed Assigned to:  None
Originator Name:  Open/Closed:  Closed
Release:  dev Operating System:  GNU/Linux

Add a New Comment(Rich Markup)

You are not logged in

Please log in, so followups can be emailed to you.


( Jump to the original submission)

Sun 03 Mar 2019 08:05:53 PM UTC, comment #21:

This is fixed for me now on the default branch (revision 86b8f4986993). I had still been able to reproduce on the default branch with revision be5b43255a38. Closing as fixed.

Mike Miller <mtmiller>
Project Administrator
Sun 03 Mar 2019 07:23:55 PM UTC, comment #20:

Pushed here:


John W. Eaton <jwe>
Project Administrator
Sun 03 Mar 2019 05:47:53 AM UTC, comment #19:

Should the submitted patch be applied to the development branch now that 5.1.0 has been released?

Rik <rik5>
Project Administrator
Wed 12 Dec 2018 12:49:01 AM UTC, comment #18:

Should this patch be applied for the Octave 5.0 release?

I can reproduce with

Rik <rik5>
Project Administrator
Fri 26 Oct 2018 06:18:09 AM UTC, comment #17:

The attached patch works for me. I'm not sure that it's the best implementation, but it's a starting point. The idea is to block SIGTSTP in all threads except the interpreter, and to also unblock it for any processes we create. I didn't add SIGTSTP to the list of async signals in signal-wrappers.c because then it would be unblocked in the thread that watches signals and only delivered with a delay (set a global variable, check it when octave_quit() is called). The nice thing about this method is that we don't have to install our own signal handler for SIGTSTP that might interfere with the one readline installs.

(file #45304)

John W. Eaton <jwe>
Project Administrator
Thu 31 Aug 2017 08:51:18 PM UTC, comment #16:

--no-line-editing works for me too. FC26 has
readline 7.0-5.fc26.x86_64. And, --no-line-editing allows
other options and still OK.

Michael Godfrey <godfrey>
Project Member
Thu 31 Aug 2017 06:51:40 PM UTC, comment #15:

But with 6 it is not 100% reproducible. I was able to
suspend octave without echos a couple times...

Having typed more commands prior to Cntrl-Z seems to increase
the chance to trigger the bug. Size of history matter?


Dmitri A. Sergatskov <dasergatskov>
Thu 31 Aug 2017 06:45:23 PM UTC, comment #14:

I do not have .inputrc
I moved /etc/inputrc to /etc/inputrc.orig
Still problem with readline 6.3:

LD_PRELOAD=/usr/lib64/libreadline.so.6 ./run-octave --no-gui
GNU Octave, version 4.3.0+
octave:1> a=1
a = 1
octave:2> ^Z^Z^Z^Z^Z^Z^Z^Z
[2]+ Stopped LD_PRELOAD=/usr/lib64/libreadline.so.6 ./run-octave --no-gui

Dmitri A. Sergatskov <dasergatskov>
Thu 31 Aug 2017 06:40:05 PM UTC, comment #13:

I'm using readline 6.3-8ubuntu2 and it works. It may be that Ubuntu added a patch or two to the 6.3 version which could help pinpoint what code is in error.

I suppose the next question is whether Octave is at fault or whether the new version 7.0 of readline is wrong. Any bug reports on this yet?

What happens if you remove any .inputrc file you have? Or conversely, change the .inputrc to something you don't usually use like

Rik <rik5>
Project Administrator
Thu 31 Aug 2017 06:29:25 PM UTC, comment #12:

Also readline 7 here, --no-line-editing fixes it, and Octave does not have to be installed, I can also reproduce in build tree.

Mike Miller <mtmiller>
Project Administrator
Thu 31 Aug 2017 06:28:37 PM UTC, comment #11:

I do not see the problem with readline 5.2; do see with 6.3


Dmitri A. Sergatskov <dasergatskov>
Thu 31 Aug 2017 06:24:17 PM UTC, comment #10:

readline 7.0

Name : readline
Version : 7.0
Release : 5.fc26
Architecture: x86_64
Install Date: Tue 13 Jun 2017 12:08:35 PM CDT
Group : Unspecified
Size : 517269
License : GPLv3+
Signature : RSA/SHA256, Sun 12 Feb 2017 11:23:30 PM CST, Key ID 812a6b4b64dab85d
Source RPM : readline-7.0-5.fc26.src.rpm
Build Date : Sat 11 Feb 2017 04:04:43 PM CST
Build Host : buildvm-15.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager : Fedora Project
Vendor : Fedora Project
URL : http://cnswww.cns.cwru.edu/php/chet/readline/rltop.html
Summary : A library for editing typed command lines
Description :
The Readline library provides a set of functions that allow users to
edit command lines. Both Emacs and vi editing modes are available. The
Readline library includes additional functions for maintaining a list
of previously-entered command lines for recalling or editing those
lines, and for performing csh-like history expansion on previous

Dmitri A. Sergatskov <dasergatskov>
Thu 31 Aug 2017 06:21:47 PM UTC, comment #9:

'--no-line-editing' fixes it for me.


Dmitri A. Sergatskov <dasergatskov>
Thu 31 Aug 2017 06:04:58 PM UTC, comment #8:

Results running current dev cf34392c9de9 tip @
on FC 26 x64:
1. run from build:
./run-octave -f --no-gui
octave:1> ^Z^Z
[5]+ Stopped ./run-octave -f --no-gui

Same system installed:
octave -f --no-gui
GNU Octave, version 4.3.0+
Copyright (C) 2016 John W. Eaton and others.
This is free software; see the source code for copying conditions.
FITNESS FOR A PARTICULAR PURPOSE. For details, type 'warranty'.

Octave was configured for "x86_64-pc-linux-gnu".

Additional information about Octave is available at http://www.octave.org.

Please contribute if you find this software useful.
For more information, visit http://www.octave.org/get-involved.html

Read http://www.octave.org/bugs.html to learn how to submit bug reports.
For information about changes from previous versions, type 'news'.

octave:1> ^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^Z^C
octave:1> quit
[godfrey@pbdsl4 octave]$

So, for me the system has to be installed to cause repeated ^Z

Michael Godfrey <godfrey>
Project Member
Thu 31 Aug 2017 05:38:38 PM UTC, comment #7:

Again, doesn't happen for me even with using '--norc --no-gui --no-history'. Taking a stab in the dark, what version of readline are you using and does starting Octave with '--no-line-editing' help?

Rik <rik5>
Project Administrator
Thu 31 Aug 2017 04:26:02 PM UTC, comment #6:

It is never a problem if I just start octave and hit Ctrl-Z --
it suspends immediately. It is always a problem if I do it during a session. a=1 is the simplest command i could think of.
Anything else would do as well. e.g. plot(1:3).
"help <pretty much anything>" does not trigger the problem.


Dmitri A. Sergatskov <dasergatskov>
Thu 31 Aug 2017 04:24:42 PM UTC, comment #5:

I can actually reproduce this as well. Pressing Ctrl-Z once and there is a stream of ^Z appearing. If I then press Ctrl-C to stop, I get a segmentation fault:

Guillaume <gyom>
Thu 31 Aug 2017 04:20:41 PM UTC, comment #4:

I can also reproduce with 4.2.1 and dev with --norc --no-gui --no-history, both built with Qt 5. It doesn't even require any input at the prompt for me.

I can also reproduce with the Debian 4.2.1 packages, which are built with Qt 4.

Hitting Enter allows the signal to actually be processed by Octave, and go into the stopped state.

Mike Miller <mtmiller>
Project Administrator
Thu 31 Aug 2017 04:08:48 PM UTC, comment #3:

It is reproducible on all my computers with either 4.2.1 or dev snapshots. They are all linked with Qt5 and threaded openblas or atlas. I tried
LD_PRELOAD=/usr/lib64/libblas.so /usr/bin/octave -f --no-gui

and it is still the same.
(The number of echos is different, sometimes it just a few.)

I do not see any problem with neither -cli no gui version.
I will try to re-compile with Qt4.


Dmitri A. Sergatskov <dasergatskov>
Thu 31 Aug 2017 03:46:32 PM UTC, comment #2:

I know this is a weird bug, but could you detail the actions necessary to repeat it even more carefully? It seems to work for me.

Note that I did use '-f' so that I don't read any initialization files. I want to make sure that it isn't simply user configuration that is weird. Also, do you have a .inputrc file for readline somewhere? Maybe try removing that temporarily as well.

Rik <rik5>
Project Administrator
Thu 31 Aug 2017 12:48:26 PM UTC, comment #1:

I meant to say:

Press "Ctrl-Z" ONCE at octave:2> prompt


Dmitri A. Sergatskov <dasergatskov>
Thu 31 Aug 2017 12:43:05 PM UTC, original submission:

octave-cli does not have this problem (Qt related?)
Both 4.2.1 and dev are affected.

"a=1" -- it is important to have some octave command executed before hitting "Ctrl-Z"

Press "Ctrl-Z" at octave:> prompt

I wonder if this is related #51886 (but perhaps is easier to debug since there is no crash)?!


Dmitri A. Sergatskov <dasergatskov>


(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attach Files:

Attached Files
file #45304:  tstp-diffs.txt added by jwe (1KiB - text/plain)


Depends on the following items: None found

Items that depend on this one: None found


Carbon-Copy List
  • -email is unavailable- added by jwe (Updated the item)
  • -email is unavailable- added by godfrey (Posted a comment)
  • -email is unavailable- added by gyom (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by dasergatskov (Submitted the item)

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only project members can vote.




    Follow 10 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-03 mtmiller StatusReady For Test => Fixed
        Open/ClosedOpen => Closed
    2019-03-03 jwe StatusPatch Submitted => Ready For Test
    2019-03-03 rik5 Releaseother => dev
    2018-12-12 rik5 Item GroupNone => Other
    2018-10-26 mtmiller Carbon-CopyRemoved 80942 => -
    2018-10-26 jwe Attached File- => Added tstp-diffs.txt, #45304
        StatusConfirmed => Patch Submitted
    2017-08-31 mtmiller StatusWorks For Me => Confirmed
    2017-08-31 rik5 StatusNone => Works For Me

    Back to the top

    Powered by Savane 3.4