|
From: Marc C. <cul...@gm...> - 2025-08-29 03:35:31
|
Hi Kevin,
Thanks for testing! I can't explain why I did not see that crash when I
was running those commands, but I was able to reproduce it and I have
pushed a fix. Would you please pull the fix and try again?
Thanks.
- Marc
On Thu, Aug 28, 2025 at 9:23 PM Kevin Walzer <kw...@co...> wrote:
> Hi Marc,
>
> Trying your tests below I am getting a segfault: Thread 0 Crashed::
> Dispatch queue: com.apple.main-thread
> 0 Tcl 0x101232820 TclpFree + 60
> 1 Tcl 0x10123d344 Tcl_DStringFree +
> 36
> 2 Tk 0x100b9cb20 0x100aa8000 +
> 1002272
> 3 Tcl 0x101145d18 0x101128000 +
> 122136
> 4 Tcl 0x101144448 Tcl_EvalObjEx +
> 112
> 5 Tcl 0x1011dfa98
> Tcl_RecordAndEvalObj + 484
> 6 Tcl 0x1011df878 Tcl_RecordAndEval
> + 76
> 7 Tk 0x100ad1ab0 0x100aa8000 +
> 170672
> 8 Tcl 0x1011f0820 Tcl_NotifyChannel
> + 304
> 9 Tcl 0x101277c10 0x101128000 +
> 1375248
> 10 Tcl 0x1012100f8 Tcl_ServiceEvent
> + 180
> 11 Tcl 0x1012103f8 Tcl_DoOneEvent +
> 316
> 12 Tk 0x100ac2f10 Tk_MainLoop + 48
> 13 Tk 0x100ad1910 Tk_MainEx + 1448
> 14 Wish 0x100a9b988 0x100a98000 +
> 14728
> 15 dyld 0x194e4ab98 start + 6076
>
> Sorry,
>
> Kevin
> On 8/28/25 11:15 AM, Marc Culler wrote:
>
> Thanks Kevin. No rush.
>
> - Marc
>
> On Thu, Aug 28, 2025 at 9:18 AM Kevin Walzer <kw...@co...> wrote:
>
>> Hi Marc- I will review this weekend. Knee-deep in the accessibility work
>> ATM.
>>
>> On Aug 27, 2025, at 2:12 PM, Marc Culler <cul...@gm...> wrote:
>>
>>
>> I have just pushed a new branch, *mac_send*, containing a nearly
>> complete full implementation of the send command for macOS. In particular,
>> it allows sending commands to interpreters in other processes. I think it
>> is now in a state where it can be tested, and I hope people will do that.
>>
>> *Two key points:*
>>
>> 1. (ATTN: Kevin Walzer). The implementation uses AppleEvents. In fact,
>> it uses the current DoScript handler when sending commands to
>> other processes. Essentially, the send command is providing a Tk-based
>> tool for sending AppleEvents (specifically, DoScript events) without
>> depending external tools like Script Editor or osascript. So it is
>> simplifying access to native IPC methods.
>>
>> 2. (ATTN: Peter da Silva and Christian Werner) While commands can be sent
>> to other processes, they can only be sent to processes owned by the same
>> user on the same host.)
>>
>> *A simple test:*
>> * Open three Terminals and start wish9.,1 in each terminal.
>> * In the last Terminal, which has appname Wish #3, run these commands:
>> % tk appname
>> Wish #3
>> % send Wish {wm geometry . +500+100}
>> % send Wish {wm geometryxx . +600+100}
>> % send Wish {send {Wish #2} {wm geometry . +900+100}}
>> % send Wish {puts hello}
>> % send Wish {send {Wish #2} {puts hello}}
>>
>>
>> *What is missing: *Error handling is incomplete. Also, after running
>> the tests above you will not that when sending {puts hello} the word
>> "hello" is printed twice in the basic case and four times when sending the
>> command recursively through two interpreters. This is not a bug in the
>> send implementation. The same happens with osascript.
>>
>>
>> *Implementation details: *Besides the use of AppleEvents, the main
>> difference is that the registry of appnames is stored in a file in the
>> user's /Library/Caches directory while the unix implementation stores the
>> registry in an XProperty. The file simply contains a JSON serialization of
>> an NSMutableDictionary mapping appnames to pids. The unix implementation
>> contains a lot of code for parsing custom serialization formats in the
>> XProperty byte sequence. The mac implementation can use higher level tools
>> provided in the Objective C runtime.
>>
>> - Marc
>>
>>
>> _______________________________________________
>> Tcl-Core mailing list
>> Tcl...@li...
>> https://lists.sourceforge.net/lists/listinfo/tcl-core
>>
>>
|