Bug 389785

Summary: 'Open in Filemanager' dolphin not working
Product: [Applications] digikam Reporter: tuxflo <flo.hennig>
Component: Bundle-AppImageAssignee: Digikam Developers <digikam-bugs-null>
Status: RESOLVED FIXED    
Severity: normal CC: carlos, caulier.gilles, metzpinguin, nate
Priority: NOR    
Version: 5.8.0   
Target Milestone: ---   
Platform: Appimage   
OS: Linux   
Latest Commit: Version Fixed In: 6.0.0
Sentry Crash Report:

Description tuxflo 2018-02-02 04:39:20 UTC
The 'Open in Filemanager' context menu (right click on an album) fails with the following error: 

Unable to create io-slave. Can not find 'kioslave' executable at '/usr/bin, /usr/bin/libexec, ././/lib64/libexec/kf5'

An dolphin window pops up, with the error message on top and stays empty.

Steps to reproduce:
1. Right click on Album, select 'Open in Filemanager'
2. When digikam asks which command should be used enter 'dolphin'
3. Click 'OK'

Current result:
dolphin opens with the error as described above.

Expected result:
dolphin opens without error and in the Album directory

My system:
I'm running the latest version of KDE Neon 64bit(based on Ubuntu 16.04), KDE Plasma as Desktop environment, digikam is running as appimage (latest version: 5.8.0 Build date: Jan 10 2018 (target: RelWithDebInfo)
Rev.: e69409e9d69054d68183248f52909e60629a21ab)
Comment 1 Maik Qualmann 2018-02-02 07:08:31 UTC
Open file manager or browser has the same cause under Ubuntu. This Ubuntu version is a mix of KDE4 with a plasma desktop. I think we will not be able to solve this problem. I did not get the kioslave5 to start under this Ubuntu version, because in principle the kioslave of KDE4 is set up.

Maik

*** This bug has been marked as a duplicate of bug 387201 ***
Comment 2 tuxflo 2018-02-02 18:38:03 UTC
Hmmm that sound strange, since KDE Neon is the "official" KDE distribution and comes directly from the KDE community, so I think this should work. Also I'm pretty sure, that there is not much KDE4 related stuff included in the system.

The other thing is, that I thought that the big advantage of technologies as appimage (or snap, flatpak...) is that every dependency is included. So why not add the needed kioslave executable to the package (if thats possible)?
Is there another way to get the recent version of digikam in this LTS version of ubuntu (or KDE Neon)?
Comment 3 Maik Qualmann 2018-02-02 19:01:12 UTC
Let's see, maybe we can add another search path to the AppImage. Here it works on openSUSE and the KF5 kioslave binary is located in /usr/lib64/libexec/kf5/. Where is this file in KDE Neon?

Maik
Comment 4 tuxflo 2018-02-02 19:05:23 UTC
Thanks for the quick reply!
Here is what 'find' is telling me:

tuxflo@Yoga-260 ~ % find /usr -name "kioslave*"
/usr/lib/x86_64-linux-gnu/libexec/kf5/kioslave

Flo
Comment 5 Maik Qualmann 2018-02-02 19:23:03 UTC
Can you create for testing a symbolic link from:

/usr/lib64/libexec/kf5/kioslave

to:

/usr/lib/x86_64-linux-gnu/libexec/kf5/kioslave

Maik
Comment 6 Maik Qualmann 2018-02-02 19:25:04 UTC
Ok, actually the other way round ((:-))

Maik
Comment 7 tuxflo 2018-02-02 19:45:29 UTC
Ok here is what I did so far:

tuxflo@Yoga-260 ~ % sudo ln -s /usr/lib/x86_64-linux-gnu/libexec/kf5/kioslave /usr/lib64/libexec/kf5/kioslave

which seems ok:
tuxflo@Yoga-260 ~ % ll /usr/lib64/libexec/kf5 
total 0
lrwxrwxrwx 1 root root 46 Feb  2 12:38 kioslave -> /usr/lib/x86_64-linux-gnu/libexec/kf5/kioslave

but I still get the same error when trying to open the filemanager from digikam. Do I have to grant special permissions? Is there a way to "manually" call kioslave with the parameters digikam uses?
Comment 8 Maik Qualmann 2018-02-02 19:59:00 UTC
KIO is a big puzzle. Presumably QDesktopService has to be compiled together with KF5 KIO, I do not know yet. Another question: If KDE Neon is an "official" KDE distribution, are there no native digiKam-5.8.0 packages yet?

Maik
Comment 9 tuxflo 2018-02-02 20:46:07 UTC
I solved it! Instead of linking to /usr/lib64/libexec/kf5/kioslave I just had to link to /usr/bin (I think that to other paths in the appimage are relative paths as .././libexec/kf5...). So it works for me now.
To answer your question: I KDE Neon has the latest version (5.8.0 Build date: Jan 14 2018 (target: Debian)) in the packages but I'd like to try the new technologies as appimage since it is easier to switch between versions. And this core functionality should work regardless of the used version.

To make this long story short: if anybody else has this issue, just link kioslave to /usr/bin and everything is fine.
Comment 10 Carlos Echenique 2018-07-18 06:21:40 UTC
Could you post the exact command you used to fix this? It is a little vague at the end there. You said link to /usr/bin/ but link what exactly and where?
Comment 11 Carlos Echenique 2018-07-18 06:54:00 UTC
I created a symbolic link between /usr/lib/x86_64-linux-gnu/libexec/kf5/kioslave and /usr/bin and when I try to export I get a desktop notification with the URL and dialog box asking me what app to run. I enter /usr/bin/firefox and nothing happens.
Comment 12 Carlos Echenique 2018-07-18 07:07:00 UTC
For the record, this is only a problem in Kubuntu. In Xubuntu, it works as expected.
Comment 13 caulier.gilles 2018-07-18 07:16:14 UTC
because in Qt5 framework, there is a mechanism to detect the current desktop and choose the most appropriate rule to load a web browser. Xubuntu do not use KDE, so no KIO in fact... and it work.

Gilles Caulier
Comment 14 caulier.gilles 2018-08-15 09:27:44 UTC
Git commit 2eb13d7ceab223675a86bbdac0a1065b206c2954 by Gilles Caulier.
Committed on 14/08/2018 at 21:48.
Pushed by cgilles into branch 'master'.

use system() call instead QProcess

M  +6    -13   project/bundles/3rdparty/ext_qt/qt-appimage-support.patch

https://commits.kde.org/digikam/2eb13d7ceab223675a86bbdac0a1065b206c2954

diff --git a/project/bundles/3rdparty/ext_qt/qt-appimage-support.patch b/project/bundles/3rdparty/ext_qt/qt-appimage-support.patch
index 781ed92ca8..dd6d99b250 100644
--- a/project/bundles/3rdparty/ext_qt/qt-appimage-support.patch
+++ b/project/bundles/3rdparty/ext_qt/qt-appimage-support.patch
@@ -2,7 +2,7 @@ diff --git a/qtbase/src/platformsupport/services/genericunix/qgenericunixservice
 index cdb5d33859..5a2bd5f724 100644
 --- a/qtbase/src/platformsupport/services/genericunix/qgenericunixservices.cpp
 +++ b/qtbase/src/platformsupport/services/genericunix/qgenericunixservices.cpp
-@@ -146,7 +146,30 @@ static inline bool launch(const QString &launcher, const QUrl &url)
+@@ -146,7 +146,23 @@ static inline bool launch(const QString &launcher, const QUrl &url)
  #if !QT_CONFIG(process)
      const bool ok = ::system(qPrintable(command + QLatin1String(" &")));
  #else
@@ -17,20 +17,13 @@ index cdb5d33859..5a2bd5f724 100644
 +    {
 +        qDebug() << "Adjusting environment variables for AppImage bundle";
 +
-+        env.insert(QLatin1String("LD_LIBRARY_PATH"),
-+                   env.value(QLatin1String("APPIMAGE_ORIGINAL_LD_LIBRARY_PATH")));
-+        env.insert(QLatin1String("QT_PLUGIN_PATH"),
-+                   env.value(QLatin1String("APPIMAGE_ORIGINAL_QT_PLUGIN_PATH")));
-+        env.insert(QLatin1String("XDG_DATA_DIRS"),
-+                   env.value(QLatin1String("APPIMAGE_ORIGINAL_XDG_DATA_DIRS")));
-+        env.insert(QLatin1String("PATH"),
-+                   env.value(QLatin1String("APPIMAGE_ORIGINAL_PATH")));
++        setenv("LD_LIBRARY_PATH", env.value(QLatin1String("APPIMAGE_ORIGINAL_LD_LIBRARY_PATH")).toLatin1().data(), 1);
++        setenv("QT_PLUGIN_PATH",  env.value(QLatin1String("APPIMAGE_ORIGINAL_QT_PLUGIN_PATH")).toLatin1().data(),  1);
++        setenv("XDG_DATA_DIRS",   env.value(QLatin1String("APPIMAGE_ORIGINAL_XDG_DATA_DIRS")).toLatin1().data(),   1);
++        setenv("PATH",            env.value(QLatin1String("APPIMAGE_ORIGINAL_PATH")).toLatin1().data(),            1);
 +    }
 +
-+    QProcess process;
-+    process.setProcessEnvironment(env);
-+    process.setProgram(command);
-+    const bool ok = process.startDetached();
++    const bool ok = ::system(qPrintable(command + QLatin1String(" &")));
  #endif
      if (!ok)
          qWarning("Launch failed (%s)", qPrintable(command));