Bug 155920 - ctrl+c doesn't breaks foreground job
Summary: ctrl+c doesn't breaks foreground job
Status: RESOLVED FIXED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: VHI normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 156320 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-01-16 16:31 UTC by Pavel Volkovitskiy
Modified: 2008-02-06 13:34 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Pavel Volkovitskiy 2008-01-16 16:31:06 UTC
Version:            (using Devel)
Installed from:    Compiled sources
OS:                Linux

from some time ago ctrl+c stops work
i have 2.1 konsole (kde 4.0.80+r762060 from trunk)

reproduce:
sleep 10 and press ctrl+c

so now i use ctrl+z; kill %1; fg
Comment 1 Urs Wolfer 2008-01-17 19:55:37 UTC
Same problem here.
Another thing which is IMHO releated: the konsole "window cursor" does not get anymore the focus (the cursor gets not filled white).

This issues has appeared some days ago..
Comment 2 Hoàng Đức Hiếu 2008-01-17 20:55:06 UTC
Some info: when I use completion, C-c works (i.e. type "pTABTAB", while bash is tallying the possible completions, C-c stops the process and returns the prompt).

This bug is possibly not in konsole, because yesterday I can't use C-[S-]v to paste in any app (including konsole), or C-l to clear screen (in konsole, gajim and pidgin).

Grepping ~/.xssession-errors only yields one "error" in the search krunner runner.
Comment 3 Thomas Georgiou 2008-01-18 04:49:53 UTC
I get this with new konsole too, it works with some progs like strace, but not with others like ruby (which works fine in a vt).
Comment 4 Urs Wolfer 2008-01-20 21:33:02 UTC
This issue makes working with Konole really hard.. you always need to kill jobs from another Konsole... There are a lot of people asking about this issue on IRC.
Comment 5 Robert Knight 2008-01-21 02:49:51 UTC
I cannot reproduce here.

> I get this with new konsole too, it works with some progs
> like strace, but not with others like ruby (which works fine in a vt). 

That is bizarre.  I cannot think why the behavior might depend on what is running on the terminal.  

>  There are a lot of people asking about this issue on IRC. 

Are they running Konsole from the KDE 4.0 branch or trunk?
Comment 6 Robert Knight 2008-01-21 02:51:48 UTC
> Are they running Konsole from the KDE 4.0 branch or trunk? 

You could winding kdebase/apps/konsole back a few revisions to see if the problem disappears.  If you get as far as the KDE 4.0.0 tagging then it is likely somewhere else.
Comment 7 Dmitry Suzdalev 2008-01-21 14:06:51 UTC
Running trunk. Noticing this for some days.
Working around that by doing "Ctrl-Z and kill %1"...
Comment 8 Robert Knight 2008-01-21 20:46:24 UTC
*** Bug 156320 has been marked as a duplicate of this bug. ***
Comment 9 Robert Knight 2008-01-22 12:49:24 UTC
> Running trunk. Noticing this for some days.

As I cannot reproduce, I need to know which revision introduced the bug.  You can use svn up -r <revision> to change kdebase/apps/konsole/src to an earlier revision.
Comment 10 Paolo Capriotti 2008-01-22 19:58:30 UTC
I can confirm this problem. The first revision where it happens is 760614: http://websvn.kde.org/?view=rev&revision=760614
Comment 11 Christian Muehlhaeuser 2008-01-23 12:37:17 UTC
i'm running trunk. i can ctrl+c svn for example or a compile job. but i can't ctrl+c dselect (or btdownloadcurses or ...)
Comment 12 Pavel Volkovitskiy 2008-01-23 17:20:11 UTC
after i switch to konsole window, cursor doesn't filled and ctrl+c doesn't works, but if i type something then this passes to konsole _and_ cursor became fillled
after that i'm able to use ctrl+c

ie, switch to konsole
press <space> (to get cursor filled)
press ctrl+c (will work now)
Comment 13 Pavel Volkovitskiy 2008-01-23 18:03:05 UTC
this doesn't always work, cursor became filled, but ctrl+c doesn't work

ctrl+c works in bash or read prompt (even with non-filled cursor)
Comment 14 Dmitry Suzdalev 2008-01-26 00:12:55 UTC
Robert, I can confirm what Paolo said: it happens first in 760614 revision (porting to KProcess).

I also noticed this warning in Session.cpp's Session::sendSignal() function:

#warning "TODO: Send the right signal here, QProcess::kill() always sends SIGKILL"

I blindly tried to replace _shellProcess->kill() with _shellProcess->terminate(), but that did not help, so I gave up :)

Maybe this even not that piece of code that causes the problem (although seems quite related).

Maybe you'll have some further ideas.

And I wasn't able to reproduce this bug on my machine at work, although both home and work machines run Debian/testing (but have different hardware).
I'm puzzled what can cause this :)

But while it's reproducable here, at home, I can test your ideas if any.
Comment 15 Robert Knight 2008-01-26 00:25:10 UTC
> I also noticed this warning in Session.cpp's Session::sendSignal() function: 

That is only called at the end of the terminal session to kill the main shell process.  Otherwise Konsole doesn't touch any processes directly - it just sends the key presses you enter to the terminal.

> although both home and work machines run Debian/testing

In other words, they have the same versions of all common software?

> (but have different hardware)

Do they use the same type of CPU?  I don't suppose it could be a 32bit / 64bit difference?
Comment 16 Dmitry Suzdalev 2008-01-26 00:27:58 UTC
Ah, no, seems unrelated :)

How about this:

void Pty::lockPty(bool lock)
{
#warning "TODO: Support for locking the Pty"
  //if (lock)
    //suspend();
  //else
    //resume();
}

Not sure if this is it too...
Comment 17 Dmitry Suzdalev 2008-01-26 00:30:22 UTC
> In other words, they have the same versions of all common software?
Well, currently not, because I forgot that I updated home machine to debian/sid, but I recall that I was seeing this bug before I upgraded.
Mmmm... not 100% sure though. 90% ;)

> Do they use the same type of CPU?  I don't suppose it could be a 32bit / 64bit difference? 
Yep. Both use intel core duo
Comment 18 Robert Knight 2008-01-26 01:00:58 UTC
> Not sure if this is it too... 

No, that is called when Ctrl+S or Ctrl+Q is pressed.

Can you try changing the interrupt key sequence to something else and see if it makes any difference.

For example, change the interrupt key to Ctrl+Y

stty intr ^Y

Then try strace, sleep, make etc. but use Ctrl+Y instead of Ctrl+C to kill them.
Comment 19 Dmitry Suzdalev 2008-01-26 01:02:40 UTC
Chatting with ossi bringed up another very interesting usecase:

Fact: ctrl-c doesn't work in konsole
Next step: launch xterm and launch 
  strace -ttt -o konsole.trace konsole --nofork

Now in that started konsole app, 'make' breaks just ok!
Wonders :)
strace fixes things :)
Comment 20 Dmitry Suzdalev 2008-01-26 01:06:05 UTC
After changing ^C to be ^Y situation is the same for ^Y as it was for ^C:
e.g. ^Y breaks 'strace', but not 'make'
Comment 21 Robert Knight 2008-01-26 01:20:17 UTC
> strace fixes things :) 

You're doing two things there though, running Konsole with strace and also with the --nofork argument.  To be sure which was making a difference, you'd need to:

1.  Run "konsole --nofork" (without strace) and see if the problem is still there.

2.  Start Konsole normally (with no arguments), then attach to it with strace (using strace -ttt -p <pid of konsole>) and see if the problem is still there.
Comment 22 Paolo Capriotti 2008-01-26 02:07:56 UTC
The problem disappears for me with both 1 and 2, while changing the interrupt sequence has no effect just like Dmitry reported.

Any idea where to look in the code, where to set breakpoints, etc...?
Comment 23 Robert Knight 2008-02-06 13:34:24 UTC
Fixed by SVN commit #771570.

"Fix Ctrl+C not killing applications on some users' systems.  Reset all signal handlers to the default (SIG_DFL) in the child process after forking"