Installing executable files

Alexander Neundorf neundorf at kde.org
Sun Oct 17 11:03:00 CEST 2010


On Thursday 14 October 2010, David Faure wrote:
> Recently I made all application .desktop files executable in trunk.
> But at install time, the permissions are not copied over, so the files
> don't end up being executable.
>
> How can this be fixed?

I checked, and at least cmake does what its documentation says:

"INSTALL(FILES files... DESTINATION <dir> 
        [PERMISSIONS permissions...] 
        [CONFIGURATIONS [Debug|Release|...]] 
        [COMPONENT <component>] 
        [RENAME <name>] [OPTIONAL]) 

...
Files installed by this form are by default given permissions OWNER_WRITE, 
OWNER_READ, GROUP_READ, and WORLD_READ if no PERMISSIONS argument is given. "


To make the installed files executable, the PERMISSIONS keyword has to be 
used:

install(FILES abc.desktop
        DESTINATION share
        PERMISSIONS OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE )

I think there are the following options:

* add the PERMISSIONS argument everywhere where required

* add a variable similar to INSTALL_TARGETS_DEFAULT_ARGS, e.g. 
INSTALL_DESKTOP_FILES_DEFAULT_ARGS, which contains these permission settings

* try to convince cmake developers (Brad I think) that if the file has 
executable bits set, the installed file should have them set too

> The CMakeLists.txt says
> install(FILES kwrite.desktop DESTINATION ${XDG_APPS_INSTALL_DIR})
> but I'd rather not have to change all CMakeLists.txt files...
> Can install(FILES) be fixed to copy the executable bit over, or is this a
> bad idea for other reasons?

Maybe the motivation was since making a file executable has security 
implications, it should be stated explicitely in the CMakeLists.txt (just 
guessing).

Alex



More information about the Kde-buildsystem mailing list