You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@openoffice.apache.org by "Rony G. Flatscher (Apache)" <ro...@apache.org> on 2019/01/04 13:00:44 UTC

Re: Ad Apple''s setup for the (Java) scripting framework

While also testing on LO (and getting the ooRexx macro support there up and running again with the
help of - kudos! - Stephan Bergmann) the problem should be restated (issues
<https://bz.apache.org/ooo/show_bug.cgi?id=127965>, <https://bz.apache.org/ooo/show_bug.cgi?id=127966>):

  * if launching AOO from a Terminal (the command
    "/Application/OpenOffice.org/Contents/MacOS/soffice") the environment got already set by the
    login script, such that soffice works in that environment and therefore has access to all
    programs in the directory "/usr/local/bin" (which has become of paramount inmportance on MacOSX
    because Apple since a few releases forces third parties to install their binaries and commands 
    there),

  * when launching AOO (and LO for that matter) from the Finder ("Application") no user login
    scripts get executed and the environment therefore is - unfortunately - not set up the same as
    in a Terminal! This is the reason why the environment variable PATH is not set correctly (the
    Apple launch service does not honor "/etc/paths", it seems, but rather has the PATH hardcoded)
    and other environment variables may not be defined for the application that gets launched by it).

    On MacOS there is a file named "/etc/paths" which lists the system paths line by line and
    includes the directory "/usr/local/bin", however the Finder launched application (AOO, LO) does
    not include that mandatory directory in the PATH environment variable! Although there is a key
    LSEnvironment which would allow to set the environment and therefore would allow to define PATH
    to contain also the directory "/usr/local/bin" (e.g. by honoring "/etc/paths" on MacOS), I have
    not been able to define it in the Info.plist that it gets honored for swriter, scalc, etc.!

    (In my case, allowing the scripting language ooRexx to be used and deployed as an AOO/LO macro,
    I could eventually solve the problem with a - stable, nevertheless - MacOS hack by analyzing
    PATH prior to invoke the Rexx interpreter and if "/usr/local/bin" is missing it gets prepended
    to the environment, which is possible via the JNI bridge to BSF4ooRexx. To make a long story
    short: this allows ooRexx to search "/usr/local/bin" for ooRexx packages like BSF.CLS, UNO.CLS
    and the like. It would be *much* better, of course, if AOO would be able to add the
    "/usr/local/bin" directory to the PATH environment variable if it is missing from there, as then
    other third party programs on MacOS could be invoked, used via AOO/LO components and/or macros.)

The issue with Java programs on MacOS that interact with the GUI that all of a sudden cause crashes
on MacOS (<https://bz.apache.org/ooo/show_bug.cgi?id=127967>) is still present on AOO (LO does not
have that problem).

What may be interesting to locate the cause is the information, that AOO/LO macros including ooRexx
get dispatched via Java and they work. (MacOS seems to have a quite "special" setup for processing
GUI events compared to other platforms, causing this crash.)

Will add these remarks/findings to the respective issues.

---rony


On 31.12.2018 14:25, Rony G. Flatscher wrote:
> On 26.12.2018 15:37, Jim Jagielski wrote:
>> I am looking into the 1st 2 and cannot find, at present, where these vars are being set... will continue to look.
>>
>>> On Dec 20, 2018, at 10:17 AM, Rony G. Flatscher <Ro...@wu.ac.at> wrote:
>>>
>>> Peter,
>>>
>>> as these are different problems to issue 117961 I opened three separate new issues for them to allow
>>> to evaluate and trace them individually:
>>>
>>>  * MacOS: PATH wrongly set for scripts: <https://bz.apache.org/ooo/show_bug.cgi?id=127965>
>>>  * MacOS: Current directory wrongly set to root directory "/" for scripts:
>>>    <https://bz.apache.org/ooo/show_bug.cgi?id=127966>
>>>  * MacOS: Running via Java causes exception on MacOSX Mojave:
>>>    <https://bz.apache.org/ooo/show_bug.cgi?id=127967>
>>>
>>> Once the critical PATH issue (127965 above) gets resolved, I will become able to test issue 117961
>>> again and in case it still is a problem then, I would re-open it.
>>>
>>> ---rony
> ... cut ...
>
> On further testing both, PATH (issue 127965) and current home directory (issue 127966), may have the
> same cause.
>
> When starting AOO from the Apple terminal (command line), the environment is untouched and therefore
> everything can work.
>
> However, if starting the AOO instance from the Apple menu (Application folder and clicking on
> OpenOffice.org to start it), then the environment gets crippled unfortunately, causing
> incomplete/wrong/wiped out environment values.
>
> So speculating that the installation setups scripts that cripple the environment AOO gets started in.
>
> Will update the above two issues to point to each other and supply a Beanshell macro that reads the
> environment settings and writes them into its swriter document. Supplying also the two AOO swriter
> documents, one being off the "command line AOO", one being off the "menu AOO".
>
> ---rony
>
> P.S.: On Windows (this is still with AOO 4.1.5) the environment remains intact when starting AOO
> from the Windows menu. This should be also the case for the Unix based AOO installations.