diff options
author | Robert Griebl <robert.griebl@qt.io> | 2020-02-03 14:53:43 +0100 |
---|---|---|
committer | Robert Griebl <robert.griebl@qt.io> | 2020-02-03 16:41:54 +0100 |
commit | 3f83d46f75fe84e8793400bf7d373658fbd9d185 (patch) | |
tree | 79efdc3ce934c31fe27e2c285dc64393148ef783 | |
parent | 7e28d06ef62f599a2bbb23f78fd970408348a93d (diff) |
Report files (sym-links) that cannot be packaged
Change-Id: Ibaf57c72bd2d2bd146c86aad1d41210f9d3d6ca2
Fixes: AUTOSUITE-1238
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
-rw-r--r-- | src/tools/packager/packagingjob.cpp | 14 |
1 files 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); |