Bug 1665577

Summary: Thunar does not provide org.xfce.FileManager dbus service
Product: [Fedora] Fedora Reporter: Denys Vlasenko <dvlasenk>
Component: ThunarAssignee: Mukundan Ragavan <nonamedotc>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: rawhideCC: dhiru, kevin, nonamedotc
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Thunar-1.8.4-1.fc29 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-07-04 11:48:21 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Attachments:
Description Flags
Tested patch none

Description Denys Vlasenko 2019-01-11 20:16:05 UTC
Thunar-1.8.2-1.fc30 (currently installed on my machine) has two dbus files:

/usr/share/dbus-1/services/org.xfce.Thunar.service
[D-BUS Service]
Name=org.xfce.Thunar
Exec=/usr/bin/Thunar --gapplication-service
SystemdService=thunar.service

/usr/share/dbus-1/services/org.xfce.FileManager.service
[D-BUS Service]
Name=org.xfce.FileManager
Exec=/usr/bin/Thunar --gapplication-service
SystemdService=thunar.service

My reading of the second file is that it is intended to provide org.xfce.FileManager service, either via systemd or dbus.

However, it appears to only work over systemd. If you do not run systemd, it tries to but does not work over dbus, I guess because Thunar does not actually register "org.xfce.FileManager" service, only "org.xfce.Thunar" one.

Here how it fails:

# time dbus-send --print-reply --session --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.StartServiceByName string:org.xfce.FileManager uint32:0
Error org.freedesktop.DBus.Error.NoReply: Did not receive a reply. Possible causes include: the remote application did not send a reply, the message bus security policy blocked the reply, the reply timeout expired, or the network connection was broken.
real	0m25.010s
user	0m0.004s
sys	0m0.002s

Starting "org.xfce.Thunar" service works:

# dbus-send --print-reply --session --dest=org.freedesktop.DBus /org/freedesktop/DBus org.freedesktop.DBus.StartServiceByName string:org.xfce.Thunar uint32:0
method return time=1547237509.405417 sender=org.freedesktop.DBus -> destination=:1.4218 serial=3 reply_serial=2
   uint32 2

The symptom of this problem is that applications such as Ristretto (image viewer) and Thunderbird (mail reader) have a 25 second delay on startup.

Comment 1 Denys Vlasenko 2019-01-14 16:02:04 UTC
I suspect this is caused by this code:

thunar-application.c

/* TODO: [GTK3 Port] Check if there's a cleaner way to register */
/* this extra dbus name (besides org.xfce.Thunar) */
static void
thunar_application_dbus_init (ThunarApplication *application)
{
    /* Do not atempt to register if running as root */
    if (geteuid() == 0)
      return;
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ why?

    application->dbus_owner_id = g_bus_own_name (G_BUS_TYPE_SESSION,
                               "org.xfce.FileManager",
                               G_BUS_NAME_OWNER_FLAGS_NONE,
                               thunar_application_dbus_acquired_cb,
                               thunar_application_name_acquired_cb,
                               thunar_application_dbus_name_lost_cb,
                               application,
                               NULL);
}

Comment 2 Mukundan Ragavan 2019-01-14 22:37:45 UTC
Excellent work! Would you be able to file this upstream? If not, I can file it.

Comment 3 Denys Vlasenko 2019-01-15 20:09:41 UTC
Please file it. Thank you.

Comment 4 Fedora Update System 2019-01-25 02:23:43 UTC
Thunar-1.8.3-1.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-1b1c13464d

Comment 5 Mukundan Ragavan 2019-01-25 02:31:22 UTC
Denys, Can you try this build? I submitted a F29 update. If you can provide feedback on the rawhide build, I can file an upstream bug if necessary. Thanks.

Comment 6 Fedora Update System 2019-01-26 03:29:05 UTC
Thunar-1.8.3-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-1b1c13464d

Comment 7 Fedora Update System 2019-01-27 21:54:13 UTC
Thunar-1.8.4-1.fc29 has been submitted as an update to Fedora 29. https://bodhi.fedoraproject.org/updates/FEDORA-2019-38fd1ced56

Comment 8 Fedora Update System 2019-01-28 02:24:58 UTC
Thunar-1.8.4-1.fc29 has been pushed to the Fedora 29 testing repository. If problems still persist, please make note of it in this bug report.
See https://fedoraproject.org/wiki/QA:Updates_Testing for
instructions on how to install test updates.
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2019-38fd1ced56

Comment 9 Denys Vlasenko 2019-01-30 11:11:55 UTC
(In reply to Mukundan Ragavan from comment #5)
> Denys, Can you try this build? I submitted a F29 update. If you can provide
> feedback on the rawhide build, I can file an upstream bug if necessary.
> Thanks.

Tried... unfortunately delay is still there. I'll try to diagnose and will add a comment about my findings.

Comment 10 Fedora Update System 2019-02-10 02:33:38 UTC
Thunar-1.8.4-1.fc29 has been pushed to the Fedora 29 stable repository. If problems still persist, please make note of it in this bug report.

Comment 11 Denys Vlasenko 2019-02-19 14:33:42 UTC
This is not fixed. Reopening.

I tried removing those lines and it works.
Modify spec as follows:

--- a/Thunar.spec
+++ b/Thunar.spec
@@ -15,6 +15,7 @@ Source1:        thunar-sendto-gnome-bluetooth.desktop
 Source2:        thunar-sendto-audacious-playlist.desktop
 Source3:        thunar-sendto-quodlibet-playlist.desktop
 Source4:        thunar-sendto-blueman.desktop
+Patch0:         Thunar-register-org.xfce.FileManager.patch

 BuildRequires:  gcc-c++
 BuildRequires:  pkgconfig(dbus-glib-1) >= 0.34
@@ -70,7 +71,8 @@ Requires: %{name} = %{version}-%{release}
 Thunarx GTK documentation files for the Thunar file manager.

 %prep
-%autosetup
+%setup -q
+%patch0 -p0

 # fix icon in thunar-sendto-email.desktop
 sed -i 's!internet-mail!mail-message-new!' \


and then add the attached Thunar-register-org.xfce.FileManager.patch

Comment 12 Denys Vlasenko 2019-02-19 14:34:12 UTC
Created attachment 1536355 [details]
Tested patch

Comment 13 Denys Vlasenko 2019-02-19 14:37:43 UTC
Scratch build:

https://koji.fedoraproject.org/koji/taskinfo?taskID=32906690

Comment 14 Kevin Fenzi 2019-02-19 19:19:34 UTC
%autosetup does apply the patches that exist, it looks like this one got lost somewhere?

Did this ever get filed upstream and commented on there?

Comment 15 Mukundan Ragavan 2019-02-19 22:38:27 UTC
Forgot to file this upstream. I have filed this now.

Comment 16 Mukundan Ragavan 2019-02-24 23:49:33 UTC
Upstream think removing the code will break sudo launches.

See comments on the upstream bug.

Comment 17 Denys Vlasenko 2019-02-27 13:22:39 UTC
URL to upstream bz: https://bugzilla.xfce.org/show_bug.cgi?id=15149

Comment 18 Denys Vlasenko 2019-03-28 10:24:03 UTC
How about the following?

Add another option, something like --register-FileManager, which explicitly says to register "org.xfce.FileManager" even if uid==0, and add it to /usr/share/dbus-1/services/org.xfce.FileManager.service:

[D-BUS Service]
Name=org.xfce.FileManager
Exec=/usr/bin/Thunar --gapplication-service --register-FileManager
SystemdService=thunar.service

Comment 19 Kevin Fenzi 2019-03-30 18:26:34 UTC
I see upstream commited a solution... does that meet your needs?

Comment 20 Mukundan Ragavan 2019-03-30 22:24:58 UTC
Denys, you had commented on the upstream bug report which I understood as agreeing with upstream's solution.

If yes, I can add that patch to Fedora and rebuild.

Comment 21 Mukundan Ragavan 2019-07-04 11:48:21 UTC
I suspect this is fixed. Please reopen if not.