Closed Bug 328596 Opened 17 years ago Closed 17 years ago
Difficult to "Open using Rosetta" due to self-relaunching
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/Firefox.app/Contents/MacOS/firefox-bin 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 blocking18.104.22.168 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 22.214.171.124 products as universal-only, not fixing this effectively locks x86 Mac users that need to continue using ppc plugins out of using 126.96.36.199.
Assignee: nobody → mark
Possibly preferable to use sysctl.proc_exec_affinity: http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_exec_a/chapter_7_section_5.html
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)
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.
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? r+a=darin
Sure thing. Baking on the trunk and 1.8 branch with the additional #ifdef.
Attachment #213406 - Flags: approval188.8.131.52?
Status: NEW → RESOLVED
Closed: 17 years ago
Resolution: --- → FIXED
Comment on attachment 213406 [details] [diff] [review] Branch version approved for 1.8.0 branch, a=dveditz for drivers
Attachment #213406 - Flags: approval184.108.40.206? → approval220.127.116.11+
Fixed on 1_8_0.
Please provide test guidance for verifying this fix (ponter to a ppc-only extension, steps to flag the app as rosetta-only, etc.)
Manfred Schubert's PDF Browser Plugin is ppc-only at the moment: http://www.schubert-it.com/pluginpdf/ 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.