Bug 168539 - screen's 'power detach' function causes konsole reporting: bash has crashed.
Summary: screen's 'power detach' function causes konsole reporting: bash has crashed.
Status: RESOLVED UNMAINTAINED
Alias: None
Product: konsole
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: Ubuntu Linux
: NOR normal
Target Milestone: ---
Assignee: Konsole Developer
URL:
Keywords:
: 249546 (view as bug list)
Depends on:
Blocks:
 
Reported: 2008-08-06 20:10 UTC by Kenny M
Modified: 2017-02-13 18:21 UTC (History)
8 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 Kenny M 2008-08-06 20:10:05 UTC
Version:           2.1 (using KDE 4.1.0)
Installed from:    Ubuntu Packages
OS:                Linux

Running KDE4.1 on kubuntu 8.04 from the ppa packages.

To recreate this bug, open a kde4 konsole run screen, then apply the key combination ctrl+a DD (this invokes screen's power detach function) and the error will appear, the tab is then useless. However the screen session does successfully detach so there is no data loss, even within bash sub-shells, i.e. running bash within bash and starting screen on that shell.
This only affects bash; zsh,csh and ksh all function correctly on a power detach.

Logged into a remote machine is not a problem, the session logs out as expected, but on local sessions bash always crashes.

see also launchpad bug:

https://bugs.launchpad.net/ubuntu/+source/kdebase-kde4/+bug/254943
(screenshot attatchment on the launchpad report)
Comment 1 Kurt Hindenburg 2008-08-10 22:04:34 UTC
Confirmed on trunk

[power detached]
Screen session of $LOGNAME $:cr:$:nl:ended.


Warning: Program '/bin/bash' crashed.


From some searches on the web:
---
  - Command: pow_detach
      (`C-a D D')
      Mainly the same as `detach', but also sends a HANGUP signal to the
      parent process of `screen'.
      _Caution_: This will result in a logout if `screen' was started
      from your login shell.
---
In a power detach (C-a D D), the screen session is detached and the user is logged out of the calling shell.
Comment 2 FiNeX 2008-11-19 20:25:30 UTC
Changed severity to "crash". I hope to have selected only the right bugs (>100) :-)
Comment 3 tobimensch 2010-02-24 12:49:31 UTC
This Bug/Crash is still valid in KDE4.4.0.
Comment 4 Marcel Partap 2010-07-26 16:25:02 UTC
...and it of course also occurs in yakuake which embeds konsole kparts...
> [remote power detached]
> Screen session of $LOGNAME $:cr:$:nl:ended.
> Could not write /var/run/utmp: No such process                                                                                                               
>
> Warning: Program '/bin/bash' crashed.
...Is this "irrelevant" piece of KDE maintained by anyone?...
Comment 5 Shlomi Fish 2010-11-08 16:38:37 UTC
I can reproduce this problem but it is not konsole-specific as it also happens with xterm and gnome-terminal - and they both close the tab/window. Seems like a bash bug.

(Mandriva Cooker / Pentium 4)
Comment 6 Shlomi Fish 2010-12-03 16:37:01 UTC
(In reply to comment #5)
> I can reproduce this problem but it is not konsole-specific as it also happens
> with xterm and gnome-terminal - and they both close the tab/window. Seems like
> a bash bug.
> 
> (Mandriva Cooker / Pentium 4)

Shouldn't this bug be closed?
Comment 7 michel kollenhoven 2011-01-20 16:46:18 UTC
i created a test script run this from your konsole
#!/bin/bash
kill -HUP $PPID

ok first thing firs SIGHUP is a signal that modems used to send(when looing connecion)
many applications do this also for the same purpose(sshd,screen, screenwrappers)
if the shell receives SIGHUP it will exit(nothing crashes afaik)(it will return 129 (128 + 1(hup) ,maybe this is what make konsole notify me) 

for some reason konsole sees this as a crash of bash


as a final note:
this is just gesswork experianced when wrapping screen (i must trap and forward sighup to kill the last shell(yes i have to manny)
i have never looked in the code of konsole or bash
Comment 8 Marcel Partap 2011-02-23 20:51:24 UTC
Rejoice, oh plagued ones! Honestly think this has been fixed as it can't be reproduced since a while...
Comment 9 michel kollenhoven 2011-02-24 11:34:56 UTC
hi i have a sipmle patch could somebody fix and commit for me?

see: https://projects.kde.org/projects/kde/kdebase/konsole/repository/revisions/master/entry/src/Session.cpp#L777


org
---8<----
  if (!_wantedClose || exitStatus != 0)	
  {	
    if (_shellProcess->exitStatus() == QProcess::NormalExit)	
        message = i18n("Program '%1' exited with status %2.", _program, _shellProcess->exitStatus());
    elseif (_shellProcess->exitStatus() > 127)
        message = i18n("Program '%1' receved signal '%2', _program, convertToSignalName(exitStatus-128);
        //according to man bash
    else	
        message = i18n("Program '%1' crashed.", _program);
	
    //FIXME: See comments in Session::monitorTimerDone()	
    KNotification::event("Finished", message , QPixmap(),	
                         QApplication::activeWindow(),	
                         KNotification::CloseWhenWidgetActivated);	
  }		
  if ( !_wantedClose && _shellProcess->exitStatus() != QProcess::NormalExit && _shellProcess->exitStatus() !> 127)	
      terminalWarning(message);	
  else
        emit finished();	
}
--->8---
ok convertToSignalName() is a non exisitant function but should do the same as kill -l $num
i am unsure if i need to use _shellProcess->exitStatus() or exitStatus

b.t.w. i have verified (see link) that konsole  source is the problem of this message and my previus message is true
Comment 10 Walter 2011-03-18 09:54:28 UTC
Confirmed for konsole 2.5.4 in KDE 4.5.5 on Fedora 13 x86 and on Fedora 14 x86_64.
It is not screen specific, just type 
kill -HUP $$
at a Bash prompt in console and the session crashes.
Xterm and gnome-terminal just close the current tab/session with exitcode 0.
Comment 11 michel kollenhoven 2011-03-18 10:02:07 UTC
is there not a sigele kde programmer here ?

(look at my previus comment)
Comment 12 Jekyll Wu 2011-08-02 15:57:35 UTC
The reason why konsole think bash has crashed is not hard to figure out. If you invoke bash from zsh then kill bash with SIGHUP, running 'echo $?' from zsh will print 129. When bash is killed like that in konsole, konsole will get 2 related
information about bash: exitCode is 0, and exitStatus is 1(actually, QProcess::CrashExit). That QProcess::CrashExit will make konsole believe bash has crashed, as its name implies.

The hard question is should konsole add extra code to deal with this case? .
Comment 13 Jekyll Wu 2011-08-02 17:21:52 UTC
*** Bug 249546 has been marked as a duplicate of this bug. ***
Comment 14 michel kollenhoven 2011-08-03 14:48:19 UTC
a message telling me a program has crashed when it is not is a bug

 think the console(-tab?) should be closed(like ^d) or there should be a notification telling me what happens
hanks
Comment 15 Adrián Chaves (Gallaecio) 2012-09-23 07:06:31 UTC
Any news regarding this?

Michel, you should use the ReviewBoard for patches: https://git.reviewboard.kde.org/
Comment 16 Kurt Hindenburg 2017-02-13 18:21:27 UTC
If this still happens on a recent KDE5 version, please open a new ticket