Commit 3f58227a authored by Yarny0's avatar Yarny0
Browse files

zoom-us (x86-64): don't touch the core `zoom` binary

Without the commit at hand, zoom-us stops working
and instead simply maxes out RAM when updated
from version 6.2.11.5069 to version 6.3.0.5527 .

https://github.com/NixOS/nixpkgs/issues/371488

Some experimenting yielded these observations
regarding newer (problematic) zoom-us versions on NixOS:
* They still work if started via flatpak
  (which creates a virtual FHS-compatible environment)
* They still work if started with `buildFHSEnv`
  with all libraries provided in `multiPkgs`.
* They still work if the unmodified zoom binary is started
  by manually invoking the `ld-linux` elf interpreter.
  However, this again requires that libraries
  are available via `LD_PRELOAD_PATH`.

It seems very much that the `patchelf --set-interpreter`
call on the `zoom` binary breaks something inside the binary.
The commit at hand removes `zoom` from the
list of binaries that are to be patched.
To ensure that program can still be executed, the `makeWrapper`
call (which is already there to wrap `zoom`) is extended
such that is explicitely uses the elf interpreter.

Unfortunatelly, when zoom tries to find its data
files (e.g. ring tones), it determines its
data directory by looking at `/proc/self/exe`.
If we start zoom by calling the elf interpreter,
`/proc/self/exe` acutally points to that interpreter.
The only solution is to copy the
interpreter into the zoom data directory
(a symlink isn't enough here).
parent 7b30dbdd
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -181,7 +181,7 @@ stdenv.mkDerivation {
      substituteInPlace $out/share/applications/Zoom.desktop \
          --replace-fail "Exec=/usr/bin/zoom" "Exec=$out/bin/zoom"

      for i in aomhost zopen zoom ZoomLauncher ZoomWebviewHost; do
      for i in aomhost zopen ZoomLauncher ZoomWebviewHost; do
        if [ -f $out/opt/zoom/$i ]; then
          patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zoom/$i
        fi
@@ -189,8 +189,14 @@ stdenv.mkDerivation {

      # ZoomLauncher sets LD_LIBRARY_PATH before execing zoom
      # IPC breaks if the executable name does not end in 'zoom'
      # zoom binary does not like being touched by patchelf
      #   => we call it indirectly via the dynamic linker
      # zoom binary inspects /proc/self/exe to find its data files
      #   => we must place a copy (not symlink) of the linker in zoom's data dir
      mv $out/opt/zoom/zoom $out/opt/zoom/.zoom
      makeWrapper $out/opt/zoom/.zoom $out/opt/zoom/zoom \
      cp "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zoom/ld.so
      makeWrapper $out/opt/zoom/ld.so $out/opt/zoom/zoom \
        --add-flags $out/opt/zoom/.zoom \
        --prefix LD_LIBRARY_PATH ":" ${libs}

      rm $out/bin/zoom