Closed Bug 328596 Opened 19 years ago Closed 19 years ago

Difficult to "Open using Rosetta" due to self-relaunching


(Toolkit :: Startup and Profile System, defect)

Not set





(Reporter: mark, Assigned: mark)


(Keywords: fixed1.8.0.2, fixed1.8.1, Whiteboard: [tcn-dl])


(2 files)

It is difficult to open a universal binary application with Rosetta translation because of the relaunch.  NSTask is used to handle the relaunch.  Unlike LaunchServices, NSTask does not recognize the "Open using Rosetta" status of a universal binary.

This is a problem, because users who need to use plugins that have not yet been updated for x86 will want to run with Rosetta translation, to continue to use ppc plugins.

A workaround is to force the app to launch translated with the relaunch disabled:

NO_EM_RESTART=1 /usr/libexec/oah/translate /path/to/

This will set up compatibility.ini for PowerPC.  After this point, double-clicking the app will allow it to launch with translation, as long as nothing else triggers a restart during startup (app moved or updated, extension installed, etc.)

One option is to back out bug 326772, to remove the CPU check in compatibility.ini.  I don't like this, because it will cause a different set of even more mysterious problems when people flip the Rosetta switch.  It's also an incomplete solution, because restarts triggered by reasons other than flipping the Rosetta switch will still cause the app to launch without translation, regardless of the switch's state.

Another option is to detect whether the app is running translated when a relaunch is required, and force translation by running via /usr/libexec/oah/translate in that case, maintaining the NSTask interface.  This is ugly, but so is app-restart, and it's probably the only feasible solution until app-restart can die.  This will require a change to toolkit/xre/MacLaunchHelper.m, and is less invasive than switching app-restart to LaunchServices.
I'm asking for blocking1.8.0.2 for this reason, from comment 0:

| This is a problem, because users who need to use plugins that have not yet
| been updated for x86 will want to run with Rosetta translation, to continue to
| use ppc plugins.

Since the plan is now to release products as universal-only, not fixing this effectively locks x86 Mac users that need to continue using ppc plugins out of using
Assignee: nobody → mark
Flags: blocking1.8.0.2?
This detects when the app is running translated with a sysctl, and attempts to force translation during relaunch with a sysctl.

I tested this on Mac OS X 10.4.5/x86, with the "Open using Rosetta" checkbox in the app's Get Info window toggled in both positions.  I also tested on Mac OS X 10.4.5/ppc and Mac OS X 10.2.8/ppc.  On a real ppc, this patch properly decides that the app is running natively.
Attachment #213202 - Flags: first-review?(joshmoz)
Attachment #213202 - Flags: first-review?(joshmoz) → first-review+
Comment on attachment 213202 [details] [diff] [review]
Preserve translation across relaunches

This probably doesn't need second-review, but I want someone from toolkit to sign off on it.
Attachment #213202 - Flags: second-review?(darin)
Attachment #213202 - Flags: approval-branch-1.8.1?(darin)
Flags: blocking1.8.0.2? → blocking1.8.0.2+
Comment on attachment 213202 [details] [diff] [review]
Preserve translation across relaunches

>Index: mozilla/toolkit/xre/MacLaunchHelper.m

>+#include <sys/types.h>
>+#include <sys/sysctl.h>
>+#include <mach/machine.h>

Make these #ifdef __ppc__ as well?

Attachment #213202 - Flags: second-review?(darin)
Attachment #213202 - Flags: second-review+
Attachment #213202 - Flags: approval-branch-1.8.1?(darin)
Attachment #213202 - Flags: approval-branch-1.8.1+
Attached patch Branch versionSplinter Review
Sure thing.  Baking on the trunk and 1.8 branch with the additional #ifdef.
Attachment #213406 - Flags: approval1.8.0.2?
Closed: 19 years ago
Keywords: fixed1.8.1
Resolution: --- → FIXED
Comment on attachment 213406 [details] [diff] [review]
Branch version

approved for 1.8.0 branch, a=dveditz for drivers
Attachment #213406 - Flags: approval1.8.0.2? → approval1.8.0.2+
Fixed on 1_8_0.
Keywords: fixed1.8.0.2
Please provide test guidance for verifying this fix (ponter to a ppc-only extension, steps to flag the app as rosetta-only, etc.)
Whiteboard: [tcn-dl]
Manfred Schubert's PDF Browser Plugin is ppc-only at the moment:

To force the app to run under Rosetta, do File:Get Info on the app in the Finder, and turn on the "Open using Rosetta" checkbox.

When running under Rosetta, Firefox:About Deer Park should show "PPC Mac OS X Mach-O" as part of the user-agent string.  When running natively, it should be "Intel Mac OS X".
Component: XRE Startup → Startup and Profile System
QA Contact: xre.startup → startup
You need to log in before you can comment on or make changes to this bug.