Bug 221726

Summary: Session Finished With Non-Zero Status popup notification for bash exit 0
Product: [Applications] konsole Reporter: M. P. Čtyři <spiro.multimax+kdebugzilla>
Component: generalAssignee: Konsole Developer <konsole-devel>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 0.9   
Target Milestone: ---   
Platform: Gentoo Packages   
OS: Linux   
Latest Commit: Version Fixed In: 2.8
Attachments: trigger the notification only when terminal process finishes with non-zero exitcode

Description M. P. Čtyři 2010-01-07 23:32:21 UTC
Version:            (using KDE 4.3.3)
Compiler:          gcc 4.3.4 AMD64
OS:                Linux
Installed from:    Gentoo Packages

Steps to reproduce:
1. In System Settings, enable the "Session Finished With Non-Zero Status" notification popup for Konsole.
2. Open a BASH session in Konsole.
3. Cleanly close Konsole by issuing 'exit' to BASH.

Expected result:
No notification appears.

Actual result:
A notification popup appears: "program '/bin/bash' exited with status 0"
Comment 1 Jekyll Wu 2011-07-19 14:11:22 UTC
Created attachment 61984 [details]
trigger the notification only when terminal process finishes with non-zero exitcode

    I can reproduce this with 2.7.999 and I'm pretty sure there is bug in the code.

    The attached patch is a quick fix. Its main purpose is to point out the bug.

    Some thoughts about Session::done(int exitStatus)

    1). this slot is connected with signal QProcess::finished(int exitCode, QProcess::ExitStatus exitStatus).
        so the parameter name is misleading. It actually should be named as exitCode.

    2). _wantedClose is the root cause. It is initialized to false and  becomes true only when user close the session from menu . So if the terminal process finishes itself , '!_wantedClose || exitStatus != 0' is always ture, and the notification is trigged.

    3). _wantedClose is not a name clear enough . Is _userWantedClose or better?
Comment 2 Kurt Hindenburg 2011-07-20 14:07:27 UTC
Git commit b8b3f23723690cc67d38add4209a34c15c21b990 by Kurt Hindenburg.
Committed on 20/07/2011 at 15:53.
Pushed by hindenburg into branch 'master'.

Correct non-zero status notification such that it works.

The non-zero notification was being displayed for zero exit codes.

Thanks again to Jekyll Wu (adaptee@gmail.com) for patch and research.
BUG: 221726
FIXED-IN: 2.8

M  +3    -2    src/Session.h
M  +8    -9    src/Session.cpp

http://commits.kde.org/konsole/b8b3f23723690cc67d38add4209a34c15c21b990