summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorten Johan Sørvig <morten.sorvig@digia.com>2014-03-21 14:22:12 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2014-03-21 16:28:37 +0100
commit4df67e94fe6a3c74f009dadceeb757807196c27a (patch)
tree6aaabfa63c5683d4cd70eccf6df4b7b5d5d4c837
parentd941ed6737a6953c5b8a4084ccfbbadf2d3ab0c2 (diff)
MacDeployQt:Make sure copied binaries are writablev5.3.0-beta1
The source binaries might be read-only, and the permissions are carried over by the copy. This would cause failures in later steps like running install_name_tool. Check the target permissions after copying and set the writable bit if necessary. Task-number: QTBUG-23454 Change-Id: I6a84a31be2431f386fa64ad94f7bd9be0cd69639 Reviewed-by: Gabriel de Dietrich <gabriel.dedietrich@digia.com>
-rw-r--r--src/macdeployqt/shared/shared.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/macdeployqt/shared/shared.cpp b/src/macdeployqt/shared/shared.cpp
index 3ebd04335..210366be8 100644
--- a/src/macdeployqt/shared/shared.cpp
+++ b/src/macdeployqt/shared/shared.cpp
@@ -103,6 +103,19 @@ bool copyFilePrintStatus(const QString &from, const QString &to)
dest.setPermissions(dest.permissions() | QFile::WriteOwner | QFile::WriteUser);
LogNormal() << " copied:" << from;
LogNormal() << " to" << to;
+
+ // The source file might not have write permissions set. Set the
+ // write permission on the target file to make sure we can use
+ // install_name_tool on it later.
+ QFile toFile(to);
+ if (toFile.permissions() & QFile::WriteOwner)
+ return true;
+
+ if (!toFile.setPermissions(toFile.permissions() | QFile::WriteOwner)) {
+ LogError() << "Failed to set u+w permissions on target file: " << to;
+ return false;
+ }
+
return true;
} else {
LogError() << "file copy failed from" << from;