{"thread":{"id":"54502","subject":"[PATCH] gitk: macOS: ignore osascript errors","startedAt":"2020-10-25T18:04:57Z","lastAt":"2020-10-27T13:11:19Z","messageCount":3,"participants":["Beat Bolli","Stefan Haller"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"408353","messageId":"20201025175149.11853-1-dev+git@drbeat.li","threadId":"54502","inReplyTo":null,"subject":"[PATCH] gitk: macOS: ignore osascript errors","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2020-10-25T17:51:49Z","receivedAt":"2020-10-25T18:04:57Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"Starting gitk on a macOS 10.14.6 (Mojave) system fails with the error\n\n    Error in startup script: 2020-10-25 17:16:44.568 osascript[36810:18758270]\n    Error loading /Library/QuickTime/EyeTV MPEG Support.component/Contents/MacOS/EyeTV MPEG Support:\n    dlopen(/Library/QuickTime/EyeTV MPEG Support.component/Contents/MacOS/EyeTV MPEG Support, 0x0106):\n    code signature in (/Library/QuickTime/EyeTV MPEG Support.component/Contents/MacOS/EyeTV MPEG Support)\n    not valid for use in process: mapping process is a platform binary, but mapped file is not\n    [[this same message repeated dozens of times]]\n        while executing\n    \"exec osascript -e [format {\n            tell application \"System Events\"\n                set frontmost of processes whose unix id is %d to true\n            end te...\"\n        invoked from within\n    \"if {[tk windowingsystem] eq \"aqua\"} {\n        exec osascript -e [format {\n            tell application \"System Events\"\n                set frontmost of processes ...\"\n        (file \"./gitk\" line 12265)\n\nIgnore errors from the osascript invocation, especially because this macOS\nversion seems to correctly place the gitk window in the foreground.\n\nSigned-off-by: Beat Bolli <dev+git@drbeat.li>\n---\n gitk | 4 ++--\n 1 file changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/gitk b/gitk\nindex 23d9dd1..8551711 100755\n--- a/gitk\n+++ b/gitk\n@@ -12290,11 +12290,11 @@ if {[catch {package require Tk 8.4} err]} {\n \n # on OSX bring the current Wish process window to front\n if {[tk windowingsystem] eq \"aqua\"} {\n-    exec osascript -e [format {\n+    catch { exec osascript -e [format {\n         tell application \"System Events\"\n             set frontmost of processes whose unix id is %d to true\n         end tell\n-    } [pid] ]\n+    } [pid] ] }\n }\n \n # Unset GIT_TRACE var if set\n-- \n2.28.0\n\n"},{"id":"408424","messageId":"c4ca1c3b-0563-c35b-5bc0-5accddd0ad3a@haller-berlin.de","threadId":"54502","inReplyTo":"20201025175149.11853-1-dev+git@drbeat.li","subject":"Re: [PATCH] gitk: macOS: ignore osascript errors","fromName":"Stefan Haller","fromEmail":"lists@haller-berlin.de","sentAt":"2020-10-26T17:21:07Z","receivedAt":"2020-10-26T17:21:13Z","isPatch":true,"sender":{"key":"lists@haller-berlin.de","avatar":null},"body":"On 25.10.20 18:51, Beat Bolli wrote:\n> Starting gitk on a macOS 10.14.6 (Mojave) system fails with the error\n> \n>      Error in startup script: 2020-10-25 17:16:44.568 osascript[36810:18758270]\n>      Error loading /Library/QuickTime/EyeTV MPEG Support.component/Contents/MacOS/EyeTV MPEG Support:\n>      dlopen(/Library/QuickTime/EyeTV MPEG Support.component/Contents/MacOS/EyeTV MPEG Support, 0x0106):\n>      code signature in (/Library/QuickTime/EyeTV MPEG Support.component/Contents/MacOS/EyeTV MPEG Support)\n>      not valid for use in process: mapping process is a platform binary, but mapped file is not\n>      [[this same message repeated dozens of times]]\n\nWhile the code change itself makes sense to me, the justification is a \nbit strange. This error message suggests that something is messed up on \nyour system. Your commit message makes it sound as if all people on \nmacOS 10.14.6 get this error, which is not the case.\n\n> Ignore errors from the osascript invocation, especially because this macOS\n> version seems to correctly place the gitk window in the foreground.\n\nWhether gitk comes to the foreground on start depends on the Tcl/Tk \nversion, not the macOS version. With Tk 8.6 it does, so it might \nactually be nice to add a version check here. (I'm not requesting that \nyou actually do that as part of this patch; just saying.)\n\n> Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n> ---\n>   gitk | 4 ++--\n>   1 file changed, 2 insertions(+), 2 deletions(-)\n> \n> diff --git a/gitk b/gitk\n> index 23d9dd1..8551711 100755\n> --- a/gitk\n> +++ b/gitk\n> @@ -12290,11 +12290,11 @@ if {[catch {package require Tk 8.4} err]} {\n>   \n>   # on OSX bring the current Wish process window to front\n>   if {[tk windowingsystem] eq \"aqua\"} {\n> -    exec osascript -e [format {\n> +    catch { exec osascript -e [format {\n>           tell application \"System Events\"\n>               set frontmost of processes whose unix id is %d to true\n>           end tell\n> -    } [pid] ]\n> +    } [pid] ] }\n>   }\n\nLike I said, the change itself looks good to me, especially since the \ncorresponding code in git gui is also guarded by a catch.\n\nBest,\nStefan\n"},{"id":"408506","messageId":"1bd2f23c-9429-470d-d536-a5c844721715@drbeat.li","threadId":"54502","inReplyTo":"c4ca1c3b-0563-c35b-5bc0-5accddd0ad3a@haller-berlin.de","subject":"Re: [PATCH] gitk: macOS: ignore osascript errors","fromName":"Beat Bolli","fromEmail":"dev+git@drbeat.li","sentAt":"2020-10-27T13:02:40Z","receivedAt":"2020-10-27T13:11:19Z","isPatch":true,"sender":{"key":"dev+git@drbeat.li","avatar":"https://avatars.githubusercontent.com/u/21444?v=4"},"body":"On 26.10.20 18:21, Stefan Haller wrote:\n> On 25.10.20 18:51, Beat Bolli wrote:\n>> Starting gitk on a macOS 10.14.6 (Mojave) system fails with the error\n>>\n>>      Error in startup script: 2020-10-25 17:16:44.568\n>> osascript[36810:18758270]\n>>      Error loading /Library/QuickTime/EyeTV MPEG\n>> Support.component/Contents/MacOS/EyeTV MPEG Support:\n>>      dlopen(/Library/QuickTime/EyeTV MPEG\n>> Support.component/Contents/MacOS/EyeTV MPEG Support, 0x0106):\n>>      code signature in (/Library/QuickTime/EyeTV MPEG\n>> Support.component/Contents/MacOS/EyeTV MPEG Support)\n>>      not valid for use in process: mapping process is a platform\n>> binary, but mapped file is not\n>>      [[this same message repeated dozens of times]]\n> \n> While the code change itself makes sense to me, the justification is a\n> bit strange. This error message suggests that something is messed up on\n> your system. Your commit message makes it sound as if all people on\n> macOS 10.14.6 get this error, which is not the case.\n\nYou're right; renaming the parent directory makes the error go away, but\nI'd still like to keep my system working with all installed software.\n\n>> Ignore errors from the osascript invocation, especially because this\n>> macOS\n>> version seems to correctly place the gitk window in the foreground.\n> \n> Whether gitk comes to the foreground on start depends on the Tcl/Tk\n> version, not the macOS version. With Tk 8.6 it does, so it might\n> actually be nice to add a version check here. (I'm not requesting that\n> you actually do that as part of this patch; just saying.)\n\nwish(1) version 8.5 is bundled with macOS Mojave.\n\n> \n>> Signed-off-by: Beat Bolli <dev+git@drbeat.li>\n>> ---\n>>   gitk | 4 ++--\n>>   1 file changed, 2 insertions(+), 2 deletions(-)\n>>\n>> diff --git a/gitk b/gitk\n>> index 23d9dd1..8551711 100755\n>> --- a/gitk\n>> +++ b/gitk\n>> @@ -12290,11 +12290,11 @@ if {[catch {package require Tk 8.4} err]} {\n>>     # on OSX bring the current Wish process window to front\n>>   if {[tk windowingsystem] eq \"aqua\"} {\n>> -    exec osascript -e [format {\n>> +    catch { exec osascript -e [format {\n>>           tell application \"System Events\"\n>>               set frontmost of processes whose unix id is %d to true\n>>           end tell\n>> -    } [pid] ]\n>> +    } [pid] ] }\n>>   }\n> \n> Like I said, the change itself looks good to me, especially since the\n> corresponding code in git gui is also guarded by a catch.\n> \n> Best,\n> Stefan\n\nCheers, Beat\n"}]}