Bug 360614

Summary: After a successful "make" from git sources, the "make install" creates a bogus "share" directory
Product: [Applications] kig Reporter: Maurizio Paolini <maurizio.paolini>
Component: generalAssignee: David E. Narvaez <david.narvaez>
Status: RESOLVED DUPLICATE    
Severity: normal CC: cfeck
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Compiled Sources   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

Description Maurizio Paolini 2016-03-16 16:23:08 UTC
I usually perform "make" as normal user, and then "make install" is performed as "root".
The latter apparently works fine, but creates a bogus "share" directory inside the kig
source tree owned by "root" (and a few other directories inside "share").  The normal user
is then unable to remove these directories.

Also note that in some settings (e.g. NFS-mounted home directory) the root user *cannot* create files in the user directory, because on the nfs server root is mapped as nfsnobody.
This could lead to a fatal error when running "make install".

Reproducible: Always
Comment 1 Christoph Feck 2016-03-16 21:27:33 UTC
Cannot confirm. The "share" folder is created in the install dir, not in the source dir. Are you using "cmake -DCMAKE_INSTALL_PREFIX=/installdir" ?
Comment 2 Maurizio Paolini 2016-03-16 22:45:32 UTC
This is the "cmake" that I use (right after a git clone)

cmake . -DCMAKE_INSTALL_PREFIX=/usr -DCMAKE_BUILD_TYPE=debugfull \\
  -DPLUGIN_INSTALL_DIR:PATH=/usr/lib/qt5/plugins

The strange thing is that what is created is just an empty small directory structure
"share" gets created in my local copy of the git kig repository; it contains:
  icons
    hicolor
    kig
      icons
      hicolor

with nothing inside!  Apart from that it seems that everything is correctly installed in the
correct place (/usr/share/icons and /usr/share/kig/).

Let me know if I can help
Comment 3 Maurizio Paolini 2016-03-19 12:12:29 UTC
I narrowed the problem a bit:

after creating a bogus empty "share" file in the sources directory I did a "make VERBOSE=1 install"
as root, to get the error:

[...]
-----------------------------------------------------------------------------------------
CMake Error at icons/cmake_install.cmake:1127 (file):
  file failed to open for writing (Not a directory):

    /home/paolini/Git/kig/share/kig/icons/hicolor/temp.txt
Call Stack (most recent call first):
  cmake_install.cmake:66 (include)
----------------------------------------------------------------------------------------

and in the indicated file I find:

-----------------------------------------------------------------------------
if(NOT CMAKE_INSTALL_COMPONENT OR "${CMAKE_INSTALL_COMPONENT}" STREQUAL "kig")

    set(DESTDIR_VALUE "$ENV{DESTDIR}")
    if (NOT DESTDIR_VALUE)
        file(WRITE "share/kig/icons/hicolor/temp.txt" "update")
        file(REMOVE "share/kig/icons/hicolor/temp.txt")
        set(HAVE_GTK_UPDATE_ICON_CACHE_EXEC /usr/bin/gtk-update-icon-cache)
        if (HAVE_GTK_UPDATE_ICON_CACHE_EXEC)
            execute_process(COMMAND /usr/bin/gtk-update-icon-cache -q -t -i . WORKING_DIRECTORY "/usr/share/kig/icons/hicolor")
        endif ()
    endif (NOT DESTDIR_VALUE)

endif()
--------------------------------------------------------------
and clearly the two lines starting with "file(..." are wrong.  I don't know where they come
from.
Comment 4 Maurizio Paolini 2016-03-19 14:07:58 UTC

*** This bug has been marked as a duplicate of bug 360734 ***