Bug 442481

Summary: Embedded terminal can't retrieve session data due to using wrong qdbus executable name
Product: [Applications] kdevelop Reporter: Eugene Shalygin <eugene.shalygin+bugzilla.kde>
Component: UI: generalAssignee: kdevelop-bugs-null
Status: CONFIRMED ---    
Severity: normal CC: igorkuo
Priority: NOR    
Version First Reported In: 5.6.2   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Eugene Shalygin 2021-09-15 15:47:05 UTC
SUMMARY
It is just qdbus in Gentoo, while KDevelop attempts to call qdbus-qt5

STEPS TO REPRODUCE
1. Open the terminal tab

OBSERVED RESULT
getSessionDir:1: command not found: qdbus-qt5
executeInAppSync:6: command not found: qdbus-qt5
getSessionDir:1: command not found: qdbus-qt5
getSessionDir:1: command not found: qdbus-qt5
executeInAppSync:6: command not found: qdbus-qt5

getSessionName:1: command not found: qdbus-qt5
You are controlling the KDevelop session ''. Type help! for more information.
Comment 1 Igor Kushnir 2021-09-17 10:32:16 UTC
https://invent.kde.org/kdevelop/kdevelop/-/blob/master/kdevplatform/util/kdevplatform_shell_environment.sh falls back to qdbus when qdbus-qt5 is not present in PATH. Just tried to reproduce this issue in Manjaro where /usr/bin/qdbus-qt5 is a symlink to /usr/bin/qdbus: renamed qdbus-qt5 to qdbus-qt5-, started KDevelop, and the embedded Terminal tool view works normally. So there must be another reason why the script doesn't work on your system. You could debug it outside of KDevelop to figure out what's wrong.
Comment 2 Eugene Shalygin 2021-09-17 11:54:20 UTC
Thank you for looking into this!

So, I've got Gentoo and zsh here. The kdevplatform_shell_environment.sh absolutely does not work in this environment.

1. My $ZDOTDIR is empty: it fails to detect zsh. Why not simply check $SHELL? E.g. _shell=$(basename "$SHELL"). I guess those who rename their shell executables know that they are doing.

2. This "$(which $_qdbus 2> /dev/null)" executes result of "which $_qdbus", so when it is negated, $_qdbus value is not changed when there is no qdbus-qt5 executable. A proper test is:

if ! command -v $_qdbus &> /dev/null; then
    _qdbus=qdbus
    if ! command -v $_qdbus &> /dev/null; then
        echo "The utility qdbus (or qdbus-qt5) is not in your path, the shell integration will not work properly."
    fi
fi