MantisBT - CMake
View Issue Details
0016051CMakeCPackpublic2016-04-06 09:462016-06-10 14:31
benoit.barbier 
Kitware Robot 
highmajoralways
closedmoved 
CMake 3.4 
 
0016051: Incorrect archive generated with CPACK_ARCHIVE_COMPONENT_INSTALL=ON with non-empty directory behind a symlink
cmake_minimum_required(VERSION 3.0.0)

# generate files & folders
make_directory(${CMAKE_CURRENT_BINARY_DIR}/sample)
FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/sample/dummy.txt "")
execute_process(
    COMMAND mkdir folder
    COMMAND ln -s folder alias
    WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sample)

FILE(WRITE ${CMAKE_CURRENT_BINARY_DIR}/sample/folder/file.txt "")

# install 2 different components
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/sample/dummy.txt DESTINATION "." COMPONENT cmp1)

install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sample/alias DESTINATION "." COMPONENT cmp2)
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/sample/folder DESTINATION "." COMPONENT cmp2)

set(CPACK_ARCHIVE_COMPONENT_INSTALL ON)

include(cpack)

=======================

Run cmake, then cpack -G TGZ or ZIP. Open the archive of the second component (cmp2), and you get an error:

 >> unzip Project-0.1.1-Darwin-cmp2.zip
"
Archive: Project-0.1.1-Darwin-cmp2.zip
    linking: alias -> folder
checkdir error: alias exists but is not directory
                 unable to process alias/dummy.txt.
   creating: folder/
  inflating: folder/dummy.txt
finishing deferred symbolic links:
  alias -> folder
"
=======================

This append only if you specify CPACK_ARCHIVE_COMPONENT_INSTALL= ON and there is a file created into the folder (folder/file.txt). If the folder is empty, no error are generated by the unzip.

Seems to be appear when this feature have been introduced in CPack (cmake 3.4 release notes) :
The CPack module learned to package empty directories.

Often append if you package a bundle with frameworks...
No tags attached.
Issue History
2016-04-06 09:46benoit.barbierNew Issue
2016-06-10 14:29Kitware RobotNote Added: 0042977
2016-06-10 14:29Kitware RobotStatusnew => resolved
2016-06-10 14:29Kitware RobotResolutionopen => moved
2016-06-10 14:29Kitware RobotAssigned To => Kitware Robot
2016-06-10 14:31Kitware RobotStatusresolved => closed

Notes
(0042977)
Kitware Robot   
2016-06-10 14:29   
Resolving issue as `moved`.

This issue tracker is no longer used. Further discussion of this issue may take place in the current CMake Issues page linked in the banner at the top of this page.