From d78bdb27832c91c775ad3782c9eb436dcd6a1e7c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bj=C3=B6rk?= Date: Sat, 27 Aug 2011 19:35:08 +0200 Subject: [PATCH 1/2] CMake: Write symlinks to directories as files in archives (#12284) Do not recurse through directory symlinks when adding files. Recursing through directory symlinks will generate broken archives, i.e., they will look something like this: foo -> bar/bar foo/Info <- Shouldn't be in archive. bar/bar bar/bar/Info --- Source/cmArchiveWrite.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Source/cmArchiveWrite.cxx b/Source/cmArchiveWrite.cxx index 25dc8ba487..eab8a592a9 100644 --- a/Source/cmArchiveWrite.cxx +++ b/Source/cmArchiveWrite.cxx @@ -180,7 +180,8 @@ bool cmArchiveWrite::AddPath(const char* path, { return false; } - if(!cmSystemTools::FileIsDirectory(path)) + if(!cmSystemTools::FileIsDirectory(path) || + cmSystemTools::FileIsSymlink(path)) { return true; } From 7b8dcdd17312a7c3ed731743468136b0ea89a6c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Johan=20Bj=C3=B6rk?= Date: Sat, 27 Aug 2011 19:34:37 +0200 Subject: [PATCH 2/2] CPack: Do not recurse through directory symlinks (#12284) ...when building CPack archive-based packages (.tar.gz and similar) Rather, put the symlinks-to-directories into the archive as files, and expect/trust that the things the symlinks point to are also in the archive. --- Source/CPack/cmCPackGenerator.cxx | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/CPack/cmCPackGenerator.cxx b/Source/CPack/cmCPackGenerator.cxx index 0e4acd5561..083279fdda 100644 --- a/Source/CPack/cmCPackGenerator.cxx +++ b/Source/CPack/cmCPackGenerator.cxx @@ -1000,6 +1000,7 @@ int cmCPackGenerator::DoPackage() std::string findExpr = tempDirectory; findExpr += "/*"; gl.RecurseOn(); + gl.SetRecurseThroughSymlinks(false); if ( !gl.FindFiles(findExpr) ) { cmCPackLogger(cmCPackLog::LOG_ERROR,