permissions: Take PlistBuddy exit code into account when reading Info.plist

Otherwise we might conclude that we found a usage description when
PlistBuddy outputs "Error Reading File: /tmp/Info.plist" to stdout.

For CMake this is not an issue as we pipe stderr to a separate variable,
that contains "Cannot parse a NULL or zero-length data" in this case.

Fixes: QTBUG-109967
Change-Id: I9d819b6de405b88bb7d1d75c22b6f5187f26e553
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit ada434e417568457df252b6069ec51f6ba8335c8)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tor Arne Vestbø 2023-01-16 14:24:54 +01:00 committed by Qt Cherry-pick Bot
parent 359a7d1b79
commit eb5a495fa5

View File

@ -6,14 +6,23 @@ for(plugin, QT_PLUGINS) {
next()
usage_descriptions = $$eval(QT_PLUGIN.$${plugin}.usage_descriptions)
found_usage_description = false
for(usage_description_key, usage_descriptions) {
usage_description = $$system("/usr/libexec/PlistBuddy" \
"-c 'print $$usage_description_key' $$QMAKE_INFO_PLIST 2>/dev/null")
!isEmpty(usage_description): \
"-c 'print $$usage_description_key' $$QMAKE_INFO_PLIST 2>/dev/null", \
singleLine, exit_code)
!equals(exit_code, 0): \
next()
!isEmpty(usage_description) {
found_usage_description = true
break()
}
}
isEmpty(usage_description): \
!$$found_usage_description: \
next()
request_flag = $$eval(QT_PLUGIN.$${plugin}.request_flag)