bugGNU Octave - Bugs: bug #45654, Ctrl-C quits all editor windows

 
 

bug #45654: Ctrl-C quits all editor windows

Submitted by:  ImageGfield <imagegfield>
Submitted on:  Thu 30 Jul 2015 09:42:11 AM UTC  
 
Category:  Interpreter Severity:  2 - Minor
Priority:  3 - Low Item Group:  Other
Status:  Patch Submitted Assigned to:  None
Originator Name:  ImageGfield Open/Closed:  Open
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)

Mon 04 Mar 2019 12:29:18 AM UTC, comment #8: 

This bug is still present in Octave 5.1 if the editor is emacs and is run in "async" mode (the defaults for octave-cli users).

As discussed a while ago, the cleanest solution is probably to add a new (possibly internal-use-only) way for Octave to create child processes such that they are not bound to the terminal that Octave is running in and do not receive the same signals that Octave does when running in a terminal emulator.

For example, an easy workaround is setting the EDITOR environment variable to "setsid emacs".

The attached patch adds a "detach" option to the 'system' function, I have not reviewed it or tested it yet.

Mike Miller <mtmiller>
Project Administrator
Mon 07 Aug 2017 12:20:41 PM UTC, comment #7: 

Hello,

Also experiencing that problem.
I am using octave 3.8.2, but since this bug's status is &quot;open&quot;, I guess the problem is not satisfactorily fixed yet.

I can point out that the problem exists only with octave in command line, not with the GUI.

Until a &quot;detach&quot; option is available to &quot;system&quot;, I propose a &quot;shell-based workaround&quot;, which I described in
https://stackoverflow.com/a/45546708/1267815 .

I hope this helps.

Hugo Raguet <snake>
Fri 01 Jul 2016 10:32:00 AM UTC, comment #6: 

The previous patch missed the "username" metadata.

(file #37648)

Lachlan Andrew <lachlan>
Wed 22 Jun 2016 09:47:07 AM UTC, comment #5: 

Here's an updated patch reflecting the change to docstring format.

(file #37543)

Lachlan Andrew <lachlan>
Sat 30 Apr 2016 09:52:45 AM UTC, comment #4: 

Thanks for the feedback, Mike.  You're right that basing this on a string match isn't very clean.

Version 2 of the patch adds the "detach" option to system, as an alternative to "sync" and "async", and makes edit default to using that mode.  I think this is nicer than adding a separate interface to setpgid or setsid, and it is lighter than duplicating "system" just for edit.

Ideally, I'd like the help text to system to depend on whether or not setpgid is available, but that isn't an option yet.  Perhaps it will be if bug #36524 is fixed.

(file #37028)

Lachlan Andrew <lachlan>
Sun 27 Mar 2016 02:50:28 AM UTC, comment #3: 

Calling setpgid or setsid is probably the right way to prevent the editor from being sent the SIGINT, but I really don't like the idea of changing Octave's system() function to always do a setpgid or setsid based on a string match just to fix this scenario with the editor.

Maybe a better solution would be to make the setpgid or setsid functions callable from the interpreter, or to make a special purpose function for executing the editor so that it will be in its own process group and not inherit terminal control sequences.

Mike Miller <mtmiller>
Project Administrator
Mon 25 Jan 2016 10:57:23 AM UTC, comment #2: 

The attached patch fixes the problem under Linux.  The problem is that ^C sends SIGINT to the whole process group, not just the process that would receive the keystroke.

The patch changes system() calls to put any emacs process (any only emacs) into its own process group.

It uses setpgid() which is presumably not portable, but I lack the m4 knowledge to generate the HAVE_SETPGID macro.

If anyone else things this approach is promising, could they please either finish it or give me some tips?  Thanks

(file #36162)

Lachlan Andrew <lachlan>
Mon 25 Jan 2016 04:02:26 AM UTC, comment #1: 

Thanks for the bug report ImageGfield.  (Sorry for the long delay; you had probably forgotten that you submitted this report.)

This still occurs with the current development sources.

It doesn't occur with gvim, or the IDE; emacs tries to link more tightly that gvim does.  I'll look into what is causing it, but it will affect fewer people now that there is an IDE in 4.0.0.

Lachlan Andrew <lachlan>
Thu 30 Jul 2015 09:42:11 AM UTC, original submission:  

Hello folks, first of all: thanks for a wonderful piece of software.

  • Using Octave 3.81 as from my "apt-get install octave"
  • Connected emacs to Octave "edit" command
  • Run a script which takes a while to finish
  • Get to think of a mistake or improvement so I break/abort script using Ctrl+C.

I do get back to the Octave prompt as I should,

but: all windows opened by "edit" command are closed and I have to reopen them again.

This is just a minor inconvenience for me personally as I can write my own file open functions and stuff, but it is maybe worth doing something about if it happens to lots of people.

ImageGfield <imagegfield>

 

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

Attach Files:
   
   
Comment:
   

Attached Files
file #37648:  bug_45654_v3.cset added by lachlan (6KiB - text/x-diff)
file #37543:  bug_45654_v3.cset added by lachlan (5KiB - text/x-diff)
file #37028:  bug_45654_v2.cset added by lachlan (6KiB - text/x-diff)
file #36162:  bug_45654.cset added by lachlan (1KiB - application/octet-stream)

 

Carbon-Copy List
  • -email is unavailable- added by snake (Posted a comment)
  • -email is unavailable- added by lachlan (Posted a comment)
  • -email is unavailable- added by imagegfield (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 17 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2019-03-04 mtmiller Severity3 - Normal => 2 - Minor
        Priority5 - Normal => 3 - Low
        StatusNeed Info => Patch Submitted
        Assigned tolachlan => None
    2019-03-04 mtmiller Carbon-CopyRemoved 80942 => -
    2017-08-31 mtmiller Dependencies- => bugs #51909 is dependent
    2016-07-01 lachlan Attached File- => Added bug_45654_v3.cset, #37648
    2016-06-22 lachlan Attached File- => Added bug_45654_v3.cset, #37543
        Assigned toNone => lachlan
    2016-06-22 lachlan DependenciesRemoved dependency to bugs #36524 => -
    2016-04-30 lachlan Attached File- => Added bug_45654_v2.cset, #37028
        Dependencies- => Depends on bugs #36524
    2016-03-27 mtmiller Dependencies- => bugs #47542 is dependent
    2016-03-27 mtmiller CategoryOctave Function => Interpreter
        StatusNone => Need Info
        Release3.8.1 => dev
    2016-01-25 lachlan Attached File- => Added bug_45654.cset, #36162

    Back to the top


    Powered by Savane 3.5