From 3f83d46f75fe84e8793400bf7d373658fbd9d185 Mon Sep 17 00:00:00 2001 From: Robert Griebl Date: Mon, 3 Feb 2020 14:53:43 +0100 Subject: Report files (sym-links) that cannot be packaged Change-Id: Ibaf57c72bd2d2bd146c86aad1d41210f9d3d6ca2 Fixes: AUTOSUITE-1238 Reviewed-by: Dominik Holland --- src/tools/packager/packagingjob.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/tools/packager/packagingjob.cpp b/src/tools/packager/packagingjob.cpp index 53c35a7f..810f838d 100644 --- a/src/tools/packager/packagingjob.cpp +++ b/src/tools/packager/packagingjob.cpp @@ -196,8 +196,18 @@ void PackagingJob::execute() Q_DECL_NOEXCEPT_EXPR(false) if (canonicalDestination == entryPath) continue; - if (!entryPath.startsWith(canonicalSourcePath)) - throw Exception(Error::Package, "file %1 is not inside the source directory %2").arg(entryPath).arg(canonicalSourcePath); + // prevent the packaging of symlinks + if (entryInfo.isSymLink()) { + fprintf(stderr, "WARNING: sym-links are not supported (found: %s -> %s)\n", + qPrintable(entryInfo.filePath()), qPrintable(entryInfo.symLinkTarget())); + continue; + } + + // we sorted out sym-links, but just to be safe, we check the canonical path + if (!entryPath.startsWith(canonicalSourcePath)) { + throw Exception(Error::Package, "file %1 is not inside the source directory %2") + .arg(entryInfo.filePath()).arg(canonicalSourcePath); + } // QDirIterator::filePath() returns absolute paths, although the naming suggests otherwise entryPath = entryPath.mid(canonicalSourcePath.size() + 1); -- cgit v1.2.3