bugGNU Octave - Bugs: bug #44397, Non functioning Ctrl-C...

 
 

bug #44397: Non functioning Ctrl-C copy/interrupt

Submitter:  John Donoghue <lostbard>
Submitted:  Sun 01 Mar 2015 01:34:13 PM UTC
   
 
Category:  GUI Severity:  3 - Normal
Priority:  5 - Normal Item Group:  Incorrect Result
Status:  Fixed Assigned to:  None
Originator Name:  JohnD Open/Closed:  * Closed
Release:  * dev Operating System:  * Any
Fixed Release:  None Planned Release:  None
* Mandatory Fields

Add a New Comment Rich Markup
   

Jump to the original submission

Thu 05 Mar 2015 02:58:01 AM UTC, comment #13: 

The cset works for me.  I can now interrupt an ordinary m-file started in the editor, by using Ctrl+C in the command window.

Rik <rik5>
Group administrator
Wed 04 Mar 2015 08:11:10 PM UTC, comment #12: 

I have pushed changeset
http://hg.savannah.gnu.org/hgweb/octave/rev/26281bc8d23b
which fixes the issue with interrupting function executed via the editor.

If the function name is not a valid identifier Fsource () is used which is not interruptable by Ctrl-C.

Torsten Lilge <ttl>
Group Member
Mon 02 Mar 2015 10:37:33 PM UTC, comment #11: 

Fsource and Ffeval can not be interrupted by Ctrl-C (is there a reason why?). When switching back to executing the function via the command-editor, Ctrl-C works again. I will prepare changeset.

@Jordi: Concerning the possible shell injection discussed in bug #42307, if the function name is checked for a valid identifier before executing via command-editor, there should be no risk for a shell injection, is that right? If so, I propose to execute via command-editor if the function name is a valid identifier and via Fsource if it is not (without debugging and without Ctrl-C).

Torsten Lilge <ttl>
Group Member
Mon 02 Mar 2015 04:06:33 PM UTC, comment #10: 

@Torsten: On Linux, Ctrl+C does not work when the script is launched from the editor.

Steps:

1) Open tst_loop.m in editor
2) Run script with "Save File and Run" button
3) Switch to Command Window
4) Enter Ctrl+C (many times)
5) script completes normally

On Windows, it works.  But, I may have an old version before you made the change from Fsource to Feval.

Rik <rik5>
Group administrator
Mon 02 Mar 2015 07:55:21 AM UTC, comment #9: 

The Ctrl-C shortcut for copying in the editor was disabled directly after the settings dialog was closed since the related shortcut was activated for the terminal window without checking the current focus. Changeset http://hg.savannah.gnu.org/hgweb/octave/rev/b403780efe90 should fix this.

Rik, does Ctrl-C break a script for you when it is run from the editor?

Torsten Lilge <ttl>
Group Member
Mon 02 Mar 2015 03:10:59 AM UTC, comment #8: 

I reversed the cset in MXE octave that added the /B switch to the run command.  That will make things work again, for the most part, in Windows.

Rik <rik5>
Group administrator
Sun 01 Mar 2015 08:56:09 PM UTC, comment #7: 

When calling the script from the terminal window, Ctrl-C is working but when running the script from the editor, Ctrl-C does not interrupt it. I have changed the mechanism for running a script from the editor in cset http://hg.savannah.gnu.org/hgweb/octave/rev/034bcac0b61c, now using Ffeval ().

Concerning the copying in the editor, this might be related to cset hg.savannah.gnu.org/hgweb/octave/rev/bd1369a2a651.

I will have a look at both csets within the next days.

Torsten Lilge <ttl>
Group Member
Sun 01 Mar 2015 08:39:13 PM UTC, comment #6: 

There is obviously something going on.

Test results:

Linux:
  1) Break between system calls : WORKS
  2) Break in Octave code       : WORKS

Windows:
  1) Break between system calls : FAILS
  2) Break in Octave code       : FAILS


According to Windows "start' documentation


/b : Starts an application without opening a new Command Prompt window. CTRL+C handling is ignored unless the application enables CTRL+C processing. Use CTRL+BREAK to interrupt the application.


If I change octave.bat to eliminate the '/B' switch then Ctrl+C goes back to working.  Also, If I use the vbs script, the Ctrl+C processing works.  The problem, as reported on the bug report about cmd windows, is that the vbs script fails to show the window if the Config Wizard needs to be run.

It seems like we need to figure out how to call the Raise Window function in Qt before the Config Wizard.

Rik <rik5>
Group administrator
Sun 01 Mar 2015 07:36:47 PM UTC, comment #5: 

Yeah I believe system calls were not interruptable, but in 3.8.2 it would break after the sleep, so if I pressed ctrl-c 5 seconds into the run, I would see 5 'ticks' only.

Running your example in linux, it does interrupt, with either global shortcut option.
Windows ignores it for both.

In both, the editor also seems to ignore the shortcut settings.

John Donoghue <lostbard>
Group Member
Sun 01 Mar 2015 07:15:04 PM UTC, comment #4: 

Your test code works for me, but the call to sleep(1) will go out to a system library.  I seem to remember a report about system calls being uninterruptible.

Could you try the attached tst_loop.m?  It stays entirely within Octave using a cascaded for loop as a delay element.  If Ctrl+C works (in Linux) with this file then I think we can start to narrow down what is wrong.



(file #33221)

Rik <rik5>
Group administrator
Sun 01 Mar 2015 06:55:45 PM UTC, comment #3: 

Maybe I am doing something wrong but in linux:


[jade@speedster build]$ hg head
changeset:   19874:6b7aee95c54c
bookmark:    @
tag:         tip
user:        Rik <rik@octave.org>
date:        Fri Feb 27 16:29:14 2015 -0800
summary:     Test directly for '|' character at front of drawnow "file".


With and without Disable global shortcuts set.

Running script:

for i = 1:10
 sleep(1)
 fprintf("tick\n");
endfor


Pressing ctrl-C doesnt seem to do anything - after 10 seconds, I get 10 ticks.

John Donoghue <lostbard>
Group Member
Sun 01 Mar 2015 04:23:58 PM UTC, comment #2: 

Is this the same as bug #37672 (GUI doesn't react to Ctrl+C)?

Also, what is the value in the Preferences->Shortcuts->Disable global shortcuts when terminal window has focus?

Are you running a version that has been compile after bug #44204 (Ctrl+C won't interrupt running scripts if Copy shortcut has been changed) was fixed?

For me, Linux seems to work, but Windows seems to ignore Ctrl+C.

Rik <rik5>
Group administrator
Sun 01 Mar 2015 02:02:16 PM UTC, comment #1: 

Is not working in Linux GUI either.

John Donoghue <lostbard>
Group Member
Sun 01 Mar 2015 01:34:13 PM UTC, original submission:  

I'm running devel version of mxe-octave using c/s http://hg.savannah.gnu.org/hgweb/octave/rev/2f2220bfd379, so not sure yet when it was broken.

Ctrl-C to copy in any of the GUI windows, or interrupt a running script in the terminal does not appear to be working.

Copy via the menus still works, and Ctrl-V etc works ok.

Using the shortcut manager, I can set copy to something else - Ctrl-Y in this case, although I did also try others) and I can copy from the terminal ok, but the shortcut doesn't work in the editor (it does in other windows), and ctrl-c or ctrl-Y doesn't interrupt running code.

John Donoghue <lostbard>
Group Member

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #33221:  tst_loop.m added by rik5 (121B - text/x-objcsrc)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by ttl (Posted a comment)
  • -email is unavailable- added by rik5 (Posted a comment)
  • -email is unavailable- added by lostbard (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

    Only group members can vote.

     

    Follow 7 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2015-03-08 rik5 StatusReady For Test Fixed
        Open/ClosedOpen Closed
    2015-03-04 ttl StatusNone Ready For Test
    2015-03-01 ttl StatusConfirmed None
    2015-03-01 rik5 StatusNone Confirmed
    2015-03-01 rik5 Attached File- Added tst_loop.m, #33221
    2015-03-01 lostbard Operating SystemMicrosoft Windows Any

    Back to the top

    Powered by Savane 3.13-3230.
    Corresponding source code