Pier Angelo Vendrame pushed to branch tor-browser-128.5.0esr-14.5-1 at The Tor Project / Applications / Tor Browser
Commits: 6756b736 by Pier Angelo Vendrame at 2024-12-02T18:33:34+01:00 fixup! Bug 40933: Add tor-launcher functionality
Bug 43326: Restrict the changes to LD_LIBRARY_PATH.
We used to set LD_LIBRARY_PATH for the tor daemon before launching the browser, but this does not work well for some distributions, which link to the latest version of OpenSSL, whereas we link to the LTS. To avoid conflicts, we can set a custom LD_LIBRARY_PATH only for the tor daemon.
- - - - -
2 changed files:
- toolkit/components/tor-launcher/TorLauncherUtil.sys.mjs - toolkit/components/tor-launcher/TorProcess.sys.mjs
Changes:
===================================== toolkit/components/tor-launcher/TorLauncherUtil.sys.mjs ===================================== @@ -5,6 +5,8 @@ * Tor Launcher Util JS Module *************************************************************************/
+import { AppConstants } from "resource://gre/modules/AppConstants.sys.mjs"; + const lazy = {};
ChromeUtils.defineESModuleGetters(lazy, { @@ -335,6 +337,13 @@ export const TorLauncherUtil = Object.freeze({ return Services.appinfo.OS === "Android"; },
+ get isLinux() { + // Use AppConstants for Linux rather then appinfo because we are sure it + // will catch also various Unix flavors for which unofficial ports might + // exist (which should work as Linux, as far as we know). + return AppConstants.platform === "linux"; + }, + get isMac() { return Services.appinfo.OS === "Darwin"; },
===================================== toolkit/components/tor-launcher/TorProcess.sys.mjs ===================================== @@ -125,6 +125,16 @@ export class TorProcess { stderr: "stdout", workdir: lazy.TorLauncherUtil.getTorFile("pt-startup-dir", false).path, }; + if (lazy.TorLauncherUtil.isLinux) { + let ldLibPath = Services.env.get("LD_LIBRARY_PATH") ?? ""; + if (ldLibPath) { + ldLibPath = ":" + ldLibPath; + } + options.environment = { + LD_LIBRARY_PATH: this.#exeFile.parent.path + ldLibPath, + }; + options.environmentAppend = true; + } this.#subprocess = await Subprocess.call(options); this.#status = TorProcessStatus.Running; } catch (e) {
View it on GitLab: https://gitlab.torproject.org/tpo/applications/tor-browser/-/commit/6756b736...