From ada434e417568457df252b6069ec51f6ba8335c8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tor=20Arne=20Vestb=C3=B8?= Date: Mon, 16 Jan 2023 14:24:54 +0100 Subject: [PATCH] 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 Pick-to: 6.5 Change-Id: I9d819b6de405b88bb7d1d75c22b6f5187f26e553 Reviewed-by: Alexandru Croitor --- mkspecs/features/permissions.prf | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/mkspecs/features/permissions.prf b/mkspecs/features/permissions.prf index d80df6d01e5..862f0cb58c6 100644 --- a/mkspecs/features/permissions.prf +++ b/mkspecs/features/permissions.prf @@ -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)