Utils: Fix macOS permissions parsing

Change-Id: I5fdde04c197b5db323fc8630c4ee4b2c197d947a
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Marcus Tillmanns
2023-05-30 13:52:11 +02:00
parent 1bc3cccbb4
commit 44e9d56c04
2 changed files with 19 additions and 7 deletions

View File

@@ -629,12 +629,18 @@ FilePathInfo::FileFlags fileInfoFlagsfromStatMode(const QString &hexString, int
FilePathInfo::FileFlags result; FilePathInfo::FileFlags result;
if (mode & IRUSR) if (mode & IRUSR) {
result |= FilePathInfo::ReadOwnerPerm; result |= FilePathInfo::ReadOwnerPerm;
if (mode & IWUSR) result |= FilePathInfo::ReadUserPerm;
}
if (mode & IWUSR) {
result |= FilePathInfo::WriteOwnerPerm; result |= FilePathInfo::WriteOwnerPerm;
if (mode & IXUSR) result |= FilePathInfo::WriteUserPerm;
}
if (mode & IXUSR) {
result |= FilePathInfo::ExeOwnerPerm; result |= FilePathInfo::ExeOwnerPerm;
result |= FilePathInfo::ExeUserPerm;
}
if (mode & IRGRP) if (mode & IRGRP)
result |= FilePathInfo::ReadGroupPerm; result |= FilePathInfo::ReadGroupPerm;
if (mode & IWGRP) if (mode & IWGRP)

View File

@@ -136,6 +136,9 @@ void tst_fileutils::filePathInfoFromTriple_data()
FilePathInfo::ReadOwnerPerm FilePathInfo::ReadOwnerPerm
| FilePathInfo::WriteOwnerPerm | FilePathInfo::WriteOwnerPerm
| FilePathInfo::ExeOwnerPerm | FilePathInfo::ExeOwnerPerm
| FilePathInfo::ReadUserPerm
| FilePathInfo::WriteUserPerm
| FilePathInfo::ExeUserPerm
| FilePathInfo::ReadGroupPerm | FilePathInfo::ReadGroupPerm
| FilePathInfo::ExeGroupPerm | FilePathInfo::ExeGroupPerm
| FilePathInfo::ReadOtherPerm | FilePathInfo::ReadOtherPerm
@@ -149,10 +152,11 @@ void tst_fileutils::filePathInfoFromTriple_data()
<< FilePathInfo{808104, << FilePathInfo{808104,
FilePathInfo::FileFlags( FilePathInfo::FileFlags(
FilePathInfo::ReadOwnerPerm | FilePathInfo::WriteOwnerPerm FilePathInfo::ReadOwnerPerm | FilePathInfo::WriteOwnerPerm
| FilePathInfo::ExeOwnerPerm | FilePathInfo::ReadGroupPerm | FilePathInfo::ExeOwnerPerm | FilePathInfo::ReadUserPerm
| FilePathInfo::ExeGroupPerm | FilePathInfo::ReadOtherPerm | FilePathInfo::WriteUserPerm | FilePathInfo::ExeUserPerm
| FilePathInfo::ExeOtherPerm | FilePathInfo::FileType | FilePathInfo::ReadGroupPerm | FilePathInfo::ExeGroupPerm
| FilePathInfo::ExistsFlag), | FilePathInfo::ReadOtherPerm | FilePathInfo::ExeOtherPerm
| FilePathInfo::FileType | FilePathInfo::ExistsFlag),
QDateTime::fromSecsSinceEpoch(1668852790)}; QDateTime::fromSecsSinceEpoch(1668852790)};
QTest::newRow("linux-disk") << QString("61b0 1651167746 0") QTest::newRow("linux-disk") << QString("61b0 1651167746 0")
@@ -160,6 +164,8 @@ void tst_fileutils::filePathInfoFromTriple_data()
FilePathInfo::FileFlags( FilePathInfo::FileFlags(
FilePathInfo::ReadOwnerPerm FilePathInfo::ReadOwnerPerm
| FilePathInfo::WriteOwnerPerm | FilePathInfo::WriteOwnerPerm
| FilePathInfo::ReadUserPerm
| FilePathInfo::WriteUserPerm
| FilePathInfo::ReadGroupPerm | FilePathInfo::ReadGroupPerm
| FilePathInfo::WriteGroupPerm | FilePathInfo::WriteGroupPerm
| FilePathInfo::LocalDiskFlag | FilePathInfo::LocalDiskFlag