Bug 363678 - kauth_install_actions does not honour CMAKE_INSTALL_PREFIX
Summary: kauth_install_actions does not honour CMAKE_INSTALL_PREFIX
Status: CONFIRMED
Alias: None
Product: frameworks-kauth
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: 5.22.0
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
: 397517 (view as bug list)
Depends on:
Blocks:
 
Reported: 2016-05-29 20:54 UTC by Elvis Angelaccio
Modified: 2022-07-08 18:13 UTC (History)
6 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Elvis Angelaccio 2016-05-29 20:54:07 UTC
This issue is documented in [1] and there is a workaround (building polkit-qt-1 and then rebuilding kauth), but still, it would be nice to have it fixed.

[1]: https://techbase.kde.org/Getting_Started/Build/Troubleshooting#Issues_building_kdebase

Reproducible: Always

Steps to Reproduce:
1. git clone git://anongit.kde.org/kwalletmanager.git && cd kwalletmanager
2. mkdir build && cd build
3. cmake -DCMAKE_INSTALL_PREFIX=~/foo ..
4. make install

Actual Results:  
CMake Error at src/konfigurator/cmake_install.cmake:92 (file):
  file INSTALL cannot copy file
  "/home/elvis/kwalletmanager/build/src/konfigurator/org.kde.kcontrol.kcmkwallet5.policy"
  to "/usr/share/polkit-1/actions/org.kde.kcontrol.kcmkwallet5.policy".

a.k.a.

kauth_install_actions ignores my CMAKE_INSTALL_PREFIX and tries to install in /usr/share/polkit-1/actions/

Expected Results:  
make install exits without error
a.k.a.
kauth_install_actions (called by kwalletmanager) respects CMAKE_INSTALL_PREFIX.
Comment 1 Christoph Feck 2016-05-30 02:24:33 UTC
Can polkit be instructed to also look into other directories? From what I know, both dbus and polkit only check the system directories, because of security reasons. It might be possible to expand this path of system directories.
Comment 2 Elvis Angelaccio 2016-05-30 10:57:26 UTC
(In reply to Christoph Feck from comment #1)
> Can polkit be instructed to also look into other directories? From what I
> know, both dbus and polkit only check the system directories, because of
> security reasons. It might be possible to expand this path of system
> directories.

The techbase link above does mention a KDE4_AUTH_POLICY_FILES_INSTALL_DIR cmake variable that used to be configurable via command line. Nowadays doesn't seem to work anymore (KAuth has a KAUTH_POLICY_FILES_INSTALL_DIR variable, but I'm not sure it can be overriden).

dbus doesn't seem affected, e.g. kwalletmanager install the following dbus files just fine:

-- Installing: /home/elvis/test/etc/dbus-1/system.d/org.kde.kcontrol.kcmkwallet5.conf
-- Installing: /home/elvis/test/share/dbus-1/system-services/org.kde.kcontrol.kcmkwallet5.service
Comment 3 Christoph Feck 2016-05-30 15:41:36 UTC
> kwalletmanager install the following dbus files just fine

But you also need to add these directories to /etc/dbus-1/*.conf
For details, see https://dbus.freedesktop.org/doc/dbus-daemon.1.html
Comment 4 Max Harmathy 2018-08-17 13:22:14 UTC
Would it be possible to not install the policy file if an install prefix is set?
Comment 5 Max Harmathy 2018-08-17 13:49:23 UTC
I just realised, that this would make packaging impossible.

But I looked into actual packaging and found that setting DESTDIR on installation resolves the issue.
Comment 6 Christoph Feck 2018-09-04 23:18:09 UTC
*** Bug 397517 has been marked as a duplicate of this bug. ***
Comment 7 Thiago Sueto 2022-05-23 09:07:17 UTC
This issue is more broad than just the polkit case and currently hinders building and installing plasma-desktop locally without kdesrc-build, and I assume this should affect any other KDE software that uses KAUTH_HELPER_INSTALL_DIR.

There's a relevant mailing list thread about this: https://mail.kde.org/pipermail/kde-core-devel/2020-October/091002.html

It is not possible to bypass this permission issue in any way. I tried with all of these, none worked:

KAUTH_HELPER_INSTALL_DIR
INSTALL_BROKEN_KAUTH_POLICY_FILES
KAUTH_BACKEND_NAME
KAUTH_POLICY_FILES_INSTALL_DIR
KDE4_AUTH_POLICY_FILES_INSTALL_DIR

And I tried numerous combinations of CMAKE_INSTALL_PREFIX and DESTDIR in my attempts to make this work for months, thinking this was perhaps some user error on my side.

So currently the only ways of testing software that uses this KAuth feature without kdesrc-build are:

* install everything as root, which is liable to break things
And assuming you actually know about this issue, what's happening in the background and what to do with this cryptic error message:
* CMAKE_INSTALL_PREFIX=/local/path then sudo install, thus overriding the package manager's installed files
* comment out the install line in the CMakeLists.txt that uses KAUTH_HELPER_INSTALL_DIR
* compile KAuth together with the application one wants to compile

Use case: I was trying to self compile plasma-desktop just to work on a KCM which isn't related and doesn't use KAUTH_HELPER_INSTALL_DIR anywhere.
Comment 9 Alexander Lohnau 2022-05-25 07:28:25 UTC
>I'm going to leave these references here one shows polkit hardcoding /usr and one shows dbus hardcoding /usr.

By my understanding this shows, that for the use case Thiago described, skipping the installation is the most sensible option.
Comment 10 Alexander Lohnau 2022-07-08 18:13:38 UTC
As Harald pointed out, there is the INSTALL_BROKEN_KAUTH_POLICY_FILES cmake option.
However, this is only used inside of the KAUTH_INSTALL_ACTIONS function. Meaning the KAuth config paths will not respect those settings.

An alternative might be to allow overriding the KAuth backend that is used and then set the KAuth variables accordingly to the CMAKE_INSTALL_PREFIX. Then projects like plasma-desktop can installed, without some files  getting installed to /usr. 
What do you think?