Bug 367607

Summary: Compiled trojita asserts on startup when trojita has been installed with package manager
Product: [Applications] trojita Reporter: Caspar Schutijser <caspar>
Component: OtherAssignee: Trojita default assignee <trojita-bugs>
Status: RESOLVED FIXED    
Severity: normal    
Priority: NOR    
Version First Reported In: git   
Target Milestone: ---   
Platform: Compiled Sources   
OS: OpenBSD   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Caspar Schutijser 2016-08-20 17:42:22 UTC
I installed trojita 0.7 with the package manager of the Operating System (which installs to /usr/local) but I also compiled trojita from source in /home/caspar/src/trojita.

When I run /usr/local/bin/trojita, it starts fine. However, when I start the compile-from-source trojita from /home/caspar/src/trojita/_build, it asserts on startup because it loads the plugins from both /home/caspar/src/trojita/_build and /usr/local/lib/trojita, which is not allowed. Output (compiled with PLUGIN_DEBUG enabled):

$ ./_build/trojita 
Number of static linked plugins: 2
Searching for plugins in: ("/home/caspar/src/trojita/_build", "/usr/local/lib/trojita")
Opening file "/home/caspar/src/trojita/_build/trojita_plugin_QtKeychainPasswordPlugin.so"
Found password plugin "qtkeychainpassword" : "Secure storage via QtKeychain"
Opening file "/usr/local/lib/trojita/trojita_plugin_QtKeychainPasswordPlugin.so"
ASSERT: "!m_availablePasswordPlugins.contains(name)" in file /home/caspar/src/trojita/src/Plugins/PluginManager.cpp, line 129
Abort trap (core dumped)

Reproducible: Always
Comment 1 Jan Kundrát 2016-08-29 10:28:07 UTC
OK, I wasn't getting this because my package manager installs to /usr. Will fix shortly.
Comment 2 Jan Kundrát 2016-09-01 18:57:14 UTC
Git commit fa23cf7f49abf2b3116cfb0286d744d688752bb8 by Jan Kundrát.
Committed on 30/08/2016 at 09:08.
Pushed by gerrit into branch 'master'.

Plugins: do not assert on plugins duplicated to several directories

As Caspar points out, the code asserts when a same-named plugin is found
both in the systemwide directory and in our current build directory.

This change makes sure that only one "instance" of a same-named file is
attempted for loading. This check happens early in the path and because
appdir-local plugins are actually attempted to load earlier than the
rest, it Should Work™.
Change-Id: Id0bffffb508a03708c1cbe8d43b8685c236a3292

M  +12   -1    src/Plugins/PluginManager.cpp

http://commits.kde.org/trojita/fa23cf7f49abf2b3116cfb0286d744d688752bb8