Bug 413851

Summary: kpmcore tests fail with SegFault
Product: [Applications] partitionmanager Reporter: h.goebel
Component: generalAssignee: Andrius Štikonas <andrius>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version: 4.0.0   
Target Milestone: ---   
Platform: Other   
OS: Linux   
URL: https://cgit.kde.org/kpmcore.git/commit/?id=872715f4e0ac49a15519f462a226cc79085657a4
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description h.goebel 2019-11-05 19:34:10 UTC
SUMMARY
All 6 tests of the kpmcore test suite segfault

Reason: ExternalCommand::stopHelper() is called, even if ExternalCommand::startHelper() was never called. Since the helper is not started, "privatekey" is Null, which leads to the SegFault down the call stack.

This was introduced in 872715f4e0ac49a15519f462a226cc79085657a4, which removed the "iface.isValid()" check.


STEPS TO REPRODUCE
1. Build kpmcore
2. run the tests

OBSERVED RESULT
Test project /tmp/guix-build-kpmcore-4.0.1.drv-0/build
    Start 1: testinit-dummy
1/6 Test #1: testinit-dummy ...................***Exception: SegFault  0.02 sec
    Start 2: testinit-sfdisk
2/6 Test #2: testinit-sfdisk ..................***Exception: SegFault  0.03 sec
    Start 3: testlist
3/6 Test #3: testlist .........................***Exception: SegFault  0.02 sec
    Start 4: testdevicescanner
4/6 Test #4: testdevicescanner ................***Exception: SegFault  0.03 sec
    Start 5: testexternalcommand
5/6 Test #5: testexternalcommand ..............***Exception: SegFault  0.02 sec
    Start 6: testsmart
6/6 Test #6: testsmart ........................***Exception: SegFault  0.03 sec

0% tests passed, 6 tests failed out of 6


EXPECTED RESULT
Tests pass
Comment 1 Andrius Štikonas 2019-11-07 22:17:26 UTC
Git commit c02d59aa6d314678cef9683f96b28e2a1abd82b7 by Andrius Štikonas, on behalf of Hartmut Goebel.
Committed on 07/11/2019 at 22:16.
Pushed by stikonas into branch '4.0'.

Stop helper only if formerly started.

Differential Revision: https://phabricator.kde.org/D25161

M  +3    -0    src/util/externalcommand.cpp

https://invent.kde.org/kde/kpmcore/commit/c02d59aa6d314678cef9683f96b28e2a1abd82b7