[cmake-developers] [CMake 0016051]: Incorrect archive generated with CPACK_ARCHIVE_COMPONENT_INSTALL=ON with non-empty directory behind a symlink

Mantis Bug Tracker mantis at public.kitware.com
Wed Apr 6 09:46:59 EDT 2016


The following issue has been SUBMITTED. 
====================================================================== 
https://public.kitware.com/Bug/view.php?id=16051 
====================================================================== 
Reported By:                benoit.barbier
Assigned To:                
====================================================================== 
Project:                    CMake
Issue ID:                   16051
Category:                   CPack
Reproducibility:            always
Severity:                   major
Priority:                   high
Status:                     new
====================================================================== 
Date Submitted:             2016-04-06 09:46 EDT
Last Modified:              2016-04-06 09:46 EDT
====================================================================== 
Summary:                    Incorrect archive generated with
CPACK_ARCHIVE_COMPONENT_INSTALL=ON with non-empty directory behind a symlink
Description: 
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...
====================================================================== 

Issue History 
Date Modified    Username       Field                    Change               
====================================================================== 
2016-04-06 09:46 benoit.barbier New Issue                                    
======================================================================



More information about the cmake-developers mailing list