summaryrefslogtreecommitdiffstats
path: root/Source/cmArchiveWrite.cxx
diff options
context:
space:
mode:
authorBrad King <brad.king@kitware.com>2011-04-07 12:27:56 (GMT)
committerBrad King <brad.king@kitware.com>2011-04-07 12:27:56 (GMT)
commite8558efa01151a94d0dc16f7327b77560b543ab9 (patch)
tree84e28154ce25f80496dbd89403b84138c6469983 /Source/cmArchiveWrite.cxx
parentc2f8a137152d9dc4cc08b156284f916561e1455c (diff)
downloadCMake-e8558efa01151a94d0dc16f7327b77560b543ab9.zip
CMake-e8558efa01151a94d0dc16f7327b77560b543ab9.tar.gz
CMake-e8558efa01151a94d0dc16f7327b77560b543ab9.tar.bz2
cmArchiveWrite: Clear xattr and acl from entries (#11958)
When reading archive entries from disk strip any xattr and acl entry headers that may have been loaded from the filesystem (e.g. selinux). These fields are only useful for backup tools and not for packaging and distribution of software. Furthermore, the GNU tar 1.15.1 on at least one Linux distribution treats unknown entry headers as an error rather than a warning. Therefore avoiding such fields is necessary for archive portability. Suggested-by: Tim Kientzle <tim@kientzle.com>
Diffstat (limited to 'Source/cmArchiveWrite.cxx')
-rw-r--r--Source/cmArchiveWrite.cxx3
1 files changed, 3 insertions, 0 deletions
diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx
index d9e4742..25dc8ba 100644
--- a/Source/cmArchiveWrite.cxx
+++ b/Source/cmArchiveWrite.cxx
@@ -236,6 +236,9 @@ bool cmArchiveWrite::AddFile(const char* file,
this->Error += archive_error_string(this->Disk);
return false;
}
+ // Clear acl and xattr fields not useful for distribution.
+ archive_entry_acl_clear(e);
+ archive_entry_xattr_clear(e);
if(archive_write_header(this->Archive, e) != ARCHIVE_OK)
{
this->Error = "archive_write_header: ";