From 2fc271ffdd331e428f5ca4fc883be9ca9e3034f7 Mon Sep 17 00:00:00 2001 From: Wesley Merkel Date: Wed, 14 Apr 2021 10:52:28 -0500 Subject: [PATCH] Add Firefox libs to beginning of LD_LIBRARY_PATH When firefox is executed by programs that also make changes to `LD_LIBRARY_PATH`, the paths can conflict causing firefox to look for shared libraries in the wrong location. This is because the wrapper script around firefox *appends* library paths to `LD_LIBRARY_PATH` instead of prepending them, causing library paths that are already in the environment to take precedence over the library paths that firefox depends on. As an example, Discord and firefox both depend on different versions of libnss. When Discord launches firefox, which happens when clicking on hyperlinks, the path in `LD_LIBRARY_PATH` to libnss set by Discord takes precedence over then one set by the firefox wrapper script causing firefox to load a different version of libnss than the one it was built against. This causes a fatal error in firefox which prevents it from starting. This commit fixes this issue by switching the firefox wrapper script to *prepend* its library paths to `LD_LIBRARY_PATH`. Fixes #118432 --- pkgs/applications/networking/browsers/firefox/wrapper.nix | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pkgs/applications/networking/browsers/firefox/wrapper.nix b/pkgs/applications/networking/browsers/firefox/wrapper.nix index 390b26a1b9ee..cda7eee54de0 100644 --- a/pkgs/applications/networking/browsers/firefox/wrapper.nix +++ b/pkgs/applications/networking/browsers/firefox/wrapper.nix @@ -257,7 +257,7 @@ let makeWrapper "$oldExe" \ "$out${browser.execdir or "/bin"}/${browserName}${nameSuffix}" \ - --suffix LD_LIBRARY_PATH ':' "$libs" \ + --prefix LD_LIBRARY_PATH ':' "$libs" \ --suffix-each GTK_PATH ':' "$gtk_modules" \ --prefix PATH ':' "${xdg-utils}/bin" \ --suffix PATH ':' "$out${browser.execdir or "/bin"}" \