MantisBT - CMake
View Issue Details
0015996CMakeCMakepublic2016-03-01 10:352016-06-10 14:31
Marcel Metz 
Kitware Robot 
normalminoralways
closedmoved 
CMake 3.4.3 
 
0015996: Unable to zip files with CMake command-line tool `tar` without path prefix in zip file
Hi,

the current implementation does not allow to package the whole content of a directory without listing every entry in the directory.

I would expect that executing a command line like `cmake -E tar cvf ../result.zip --format=zip .` would zip the whole content of the current working directory. While CMake packages all the files it prepends every entry with './', which I don't expect compared to the `zip` tool provided with most linux distributions.

The alternative command line `cmake -E tar cvf ../result.zip $PWD` only creates an empty zip file.
#!/usr/bin/sh
# cmake --version
# cmake version 3.4.1

mkdir zip_root
touch zip_root/file1
touch zip_root/file2
# The whole content of 'zip_root' should be zipped, so change working directory
cd zip_root

cmake -E tar cvf ../cmake-abs.zip --format=zip $PWD
# <no output>: $? = 0

cmake -E tar cvf ../cmake-rel.zip --format=zip .
# .
# ./file1
# ./file2
# $? = 0

zip ../zip-abs.zip $PWD
# adding: $PWD/ (stored 0%)
# $? = 0

zip ../zip-rel.zip .
# zip error: Nothing to do! (../zip-rel.zip)
# $? = 12

zip -r ../zip-abs-rec.zip $PWD
# adding: $PWD/ (stored 0%)
# adding: $PWD/file1 (stored 0%)
# adding: $PWD/file2 (stored 0%)
# $? = 0

zip -r ../zip-rel-rec.zip .
# adding: file1 (stored 0%)
# adding: file2 (stored 0%)
# $? = 0

unzip -t ../cmake-abs.zip
# Archive: ../cmake-abs.zip
# warning [../cmake-abs.zip]: zipfile is empty


unzip -t ../cmake-rel.zip
# Archive: ../cmake-rel.zip
# testing: ./ OK
# testing: ./file1 OK
# testing: ./file2 OK
# No errors detected in compressed data of ../cmake-rel.zip.

unzip -t ../zip-abs.zip
# Archive: ../zip-abs.zip
# testing: $PWD/ OK
# No errors detected in compressed data of ../zip-abs.zip.

unzip -t ../zip-rel.zip
# unzip: cannot find or open ../zip-rel.zip, ../zip-rel.zip.zip or ../zip-rel.zip.ZIP.

unzip -t ../zip-abs-rec.zip
# Archive: ../zip-abs-rec.zip
# testing: $PWD/ OK
# testing: $PWD/file1 OK
# testing: $PWD/file2 OK
# No errors detected in compressed data of ../zip-abs-rec.zip.

unzip -t ../zip-rel-rec.zip
# Archive: ../zip-rel-rec.zip
# testing: file1 OK
# testing: file2 OK
# No errors detected in compressed data of ../zip-rel-rec.zip.
No tags attached.
Issue History
2016-03-01 10:35Marcel MetzNew Issue
2016-06-10 14:29Kitware RobotNote Added: 0042950
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
(0042950)
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.