[cmake-developers] [CMake 0015996]: Unable to zip files with CMake command-line tool `tar` without path prefix in zip file
Mantis Bug Tracker
mantis at public.kitware.com
Tue Mar 1 10:35:35 EST 2016
The following issue has been SUBMITTED.
======================================================================
https://cmake.org/Bug/view.php?id=15996
======================================================================
Reported By: Marcel Metz
Assigned To:
======================================================================
Project: CMake
Issue ID: 15996
Category: CMake
Reproducibility: always
Severity: minor
Priority: normal
Status: new
======================================================================
Date Submitted: 2016-03-01 16:35 CET
Last Modified: 2016-03-01 16:35 CET
======================================================================
Summary: Unable to zip files with CMake command-line tool
`tar` without path prefix in zip file
Description:
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.
Steps to Reproduce:
#!/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.
======================================================================
Issue History
Date Modified Username Field Change
======================================================================
2016-03-01 16:35 Marcel Metz New Issue
======================================================================
More information about the cmake-developers
mailing list