cmake and chmod
David Faure
faure at kde.org
Wed Dec 12 14:44:14 UTC 2012
The initial problem: make install in kde-workspace fails when installing as a user, due to the
chown root in kcheckpass/CMakeLists.txt
This leads to:
-- Up-to-date: /d/kde/inst/kde4.9/lib64/kde4/libexec/kcheckpass
CMake Error at kcheckpass/cmake_install.cmake:44 (FILE):
file INSTALL cannot set permissions on
"/d/kde/inst/kde4.9/lib64/kde4/libexec/kcheckpass"
Call Stack (most recent call first):
cmake_install.cmake:102 (INCLUDE)
So I tried to implement something with the right flags for permissions in cmake, but this relies on cmake not calling
chown when it doesn't need to (because the file has the right permissions already).
So I came up with the patch below, but it shows that cmake is being crazy about permissions :)
For instance, make install in cmake itself leads to tons of this:
/d/kde/src/cmake-git/install_manifest.txt current perm=100644 wanted perm=100664
/d/kde/src/cmake-git/install_manifest.txt current perm=100664 wanted perm=100644
/d/kde/src/cmake-git/install_manifest.txt current perm=100644 wanted perm=100664
/d/kde/src/cmake-git/install_manifest.txt current perm=100664 wanted perm=100644
/d/kde/src/cmake-git/install_manifest.txt current perm=100644 wanted perm=100664
/d/kde/src/cmake-git/install_manifest.txt current perm=100664 wanted perm=100644
/d/kde/src/cmake-git/install_manifest.txt current perm=100644 wanted perm=100664
/d/kde/src/cmake-git/install_manifest.txt current perm=100664 wanted perm=100644
/d/kde/src/cmake-git/install_manifest.txt current perm=100644 wanted perm=100664
/d/kde/src/cmake-git/install_manifest.txt current perm=100664 wanted perm=100644
/d/kde/src/cmake-git/install_manifest.txt current perm=100644 wanted perm=100664
Something is toggling the permissions between two values, constantly...
commit a9c9460e1584d5564e30afbebb99126069cca735
Author: David Faure <faure at kde.org>
Date: Mon Aug 29 16:43:41 2011 +0200
WIP: Don't chmod if not needed
diff --git a/Source/kwsys/SystemTools.cxx b/Source/kwsys/SystemTools.cxx
index 085d988..75f1db9 100644
--- a/Source/kwsys/SystemTools.cxx
+++ b/Source/kwsys/SystemTools.cxx
@@ -4208,6 +4208,18 @@ bool SystemTools::SetPermissions(const char* file, mode_t mode)
{
return false;
}
+ mode_t currentMode = 0;
+ if ( SystemTools::GetPermissions(file, currentMode) )
+ {
+ mode_t wantedMode = mode;
+ if ((wantedMode & S_IFMT) == 0)
+ wantedMode |= (currentMode & S_IFMT); // keep file type flags if not specified in 'mode'
+ if ( currentMode == mode )
+ {
+ return true;
+ }
+ std::cout << file << " current perm=" << std::oct << currentMode << " wanted perm=" << wantedMode << std::endl;
+ }
if ( chmod(file, mode) < 0 )
{
return false;
As you can see I started to look into this more than a year ago, but couldn't find the time to
finish the work (investigating this crazy calling of SetPermissions, then implementing the
support for the permission flag for "chmod +s" if necessary, and submitting the above patch).
--
David Faure, faure at kde.org, http://www.davidfaure.fr
Working on KDE, in particular KDE Frameworks 5
More information about the Kde-buildsystem
mailing list