[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

[MacPerl] OSACompile() bug in MPW perl tool too?



[Sorry, (inevitably) longish message follows]

Recently I posted a question on the
comp.sys.mac.programer.(help|codewarrior) newsgroups, and when I didn't get
an answer, I sighed to myself: what a pity this problem has nothing to do
with MacPerl, so that I can't ask the highly competent and helpful folk
there.

Then I decided to go back for the moment to using the MacPerl MPW tool to
the job my own program was (temporarily, I hoped) unable to do, and lo and
behold I find that the MacPerl tool fails in exactly the same circumstances
as my program does! So suddenly it's a legitimate MacPerl question!

Now I wonder if any of you can repeat this scenario (if you can, we have a
problem, or maybe just some of us; if you can't, it's only me who has the
problem). Note that all of this applies to the MacPerl MPW tool only -- the
application (bigappl-68k in my case) doesn't have this problem.

Type the following command to MPW (it's one line). Substitute your own path
to Eudora, or indeed to any other app under certain conditions, which I go
into in a moment):

perl -e 'MacPerl::DoAppleScript qq(tell app "elsie:bin:mail" to get message
1 of mailbox "MacPerl");'

Things grind away for a while then all's well. Now enter it again: your
computer should crash with a bus error, it should be impossible to
force-quit your way out, and even if you have MacsBug installed, it should
be impossible to use es or rb : nothing but ctrl-cmd-power should work.

For me this is entirely replicable, when the following conditions are met:
        (1) you do not quit and restart MPW between the calls
            to perl
        (2) you do (ie MPW does) quit and restart the perl
            tool -- it won't work if you have some shell-like
            wrapper and do successive DoAppleScript()s during
            one invocation of perl
        (3) the script actually targets an app (other than
            the Finder)
        (4) the script actually contains some app-specific
            command -- it seems any such command will do
            (but not, eg, 'display dialog')

Note that it doesn't have to be the same app that gets targeted in
successive calls.

Additionally, I have a feeling that just one call gives MPW a bit of
indigestion, and it quite often crashes some time later (particularly when
quitting): but I haven't been able to nail down an exact pattern with this.
(But it's still noticeable, because MPW quite notably _isn't_ prone to
crashing.)

Now substitute 'as' for 'perl' and you have exactly the substance of my
posting to the UseNet.

I can offer some insight of my own into it: it happens during the call to
OSACompile(), and in fact a rather short way into it (noticeable because
OSACompile() takes quite a long time even on short scripts).

I know this because, when I decided to write a version of
MacPerl::DoAppleScript as a separate MPW tool, I (naturally!) helped myself
to Matthias' source code for MP_DoAppleScript() in
MacPerl_Src:perl:ext:MacPerl:OSA:OSA.xs and massaged it very slightly to
operate outside the MacPerl environment. When crashes started happening
somewhere in the call to OSADoScript(), I broke that up into its separate
compiling, executing, and displaying stages, and found that the crash
occurs during OSACompile(). The requirement for an app-specific command
suggests that it occurs during lookup of the app's 'aete' resource.

But it's definitely something to with living inside MPW. Just as the
MacPerl application doesn't crash in these circumstances, neither does a
standalone-application version of 'as' that I made for testing precisely
this.

So there we are. I've tried to nail down the syndrome as precisely as I
can: now I need to know, do other people get the same behaviour? Or am I
altogether missing something?

Apart from whatever value there is in pinpointing things about MacPerl that
might need some attention, I _really_ want to get my <source-applescript
>result-from-applescript filter going, either through
MacPerl::DoAppleScript or through my own tool :-)

My setup: LC575 (68040), OS 7.6, 36MB/2GB, MPW 3.4.2, CW Gold 10,
AppleScript 1.1, MacPerl 5.1.5r4 (tool and app). The problem does not go
away when I give MPW extra (up to 5MB or so) of stack space.

TIA,

Jason Johnston.
<jasonj@mpx.com.au>




***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch