zoom-us: fix memory usage bug, add test, update (#381281)

authored by philiptaron.tngl.sh and committed by GitHub b9c01f18 0158769b

+61 -8
+17 -8
pkgs/by-name/zo/zoom-us/package.nix
··· 40 40 pulseaudioSupport ? true, 41 41 libpulseaudio, 42 42 pulseaudio, 43 + callPackage, 43 44 }: 44 45 45 46 let ··· 50 51 # and often with different versions. We write them on three lines 51 52 # like this (rather than using {}) so that the updater script can 52 53 # find where to edit them. 53 - versions.aarch64-darwin = "6.3.1.45300"; 54 - versions.x86_64-darwin = "6.3.1.45300"; 55 - versions.x86_64-linux = "6.2.11.5069"; 54 + versions.aarch64-darwin = "6.3.6.47101"; 55 + versions.x86_64-darwin = "6.3.6.47101"; 56 + versions.x86_64-linux = "6.3.6.6315"; 56 57 57 58 srcs = { 58 59 aarch64-darwin = fetchurl { 59 60 url = "https://zoom.us/client/${versions.aarch64-darwin}/zoomusInstallerFull.pkg?archType=arm64"; 60 61 name = "zoomusInstallerFull.pkg"; 61 - hash = "sha256-WPhqYof/XR6TDkuA4NK2a30ksdhN7NBfs4KCQwqKJ0g="; 62 + hash = "sha256-tqDf3Z5RRf4aRvtINWdM3oppZXbDdtihhPBHu4QxzDM="; 62 63 }; 63 64 x86_64-darwin = fetchurl { 64 65 url = "https://zoom.us/client/${versions.x86_64-darwin}/zoomusInstallerFull.pkg"; 65 - hash = "sha256-BywBvJCcNXARHTkO/UJbOFRjuiXRkmFWmSuZsW9t1pk="; 66 + hash = "sha256-BZkBx5eZ3c3p9JIz+ChyJrGM12HwyNToSuS86f9QnF0="; 66 67 }; 67 68 x86_64-linux = fetchurl { 68 69 url = "https://zoom.us/client/${versions.x86_64-linux}/zoom_x86_64.pkg.tar.xz"; 69 - hash = "sha256-k8T/lmfgAFxW1nwEyh61lagrlHP5geT2tA7e5j61+qw="; 70 + hash = "sha256-QJR8SsMtyYBvd5G+mEjEEISkJJukCYeHErKrgs1uDQc="; 70 71 }; 71 72 }; 72 73 ··· 122 123 coreutils 123 124 glib.dev 124 125 pciutils 126 + pipewire 125 127 procps 126 128 util-linux 127 129 ] ··· 179 181 substituteInPlace $out/share/applications/Zoom.desktop \ 180 182 --replace-fail "Exec=/usr/bin/zoom" "Exec=$out/bin/zoom" 181 183 182 - for i in aomhost zopen zoom ZoomLauncher ZoomWebviewHost; do 184 + for i in aomhost zopen ZoomLauncher ZoomWebviewHost; do 183 185 if [ -f $out/opt/zoom/$i ]; then 184 186 patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zoom/$i 185 187 fi ··· 187 189 188 190 # ZoomLauncher sets LD_LIBRARY_PATH before execing zoom 189 191 # IPC breaks if the executable name does not end in 'zoom' 192 + # zoom binary does not like being touched by patchelf 193 + # => we call it indirectly via the dynamic linker 194 + # zoom binary inspects /proc/self/exe to find its data files 195 + # => we must place a copy (not symlink) of the linker in zoom's data dir 190 196 mv $out/opt/zoom/zoom $out/opt/zoom/.zoom 191 - makeWrapper $out/opt/zoom/.zoom $out/opt/zoom/zoom \ 197 + cp "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zoom/ld.so 198 + makeWrapper $out/opt/zoom/ld.so $out/opt/zoom/zoom \ 199 + --add-flags $out/opt/zoom/.zoom \ 192 200 --prefix LD_LIBRARY_PATH ":" ${libs} 193 201 194 202 rm $out/bin/zoom ··· 220 228 dontPatchELF = true; 221 229 222 230 passthru.updateScript = ./update.sh; 231 + passthru.tests.startwindow = callPackage ./test.nix { }; 223 232 224 233 meta = with lib; { 225 234 homepage = "https://zoom.us/";
+44
pkgs/by-name/zo/zoom-us/test.nix
··· 1 + { 2 + lib, 3 + xvfb-run, 4 + zoom-us, 5 + runCommand, 6 + writeShellApplication, 7 + xorg, 8 + }: 9 + 10 + let 11 + testScript = writeShellApplication { 12 + name = "zoom-us-test-script"; 13 + runtimeInputs = [ 14 + xorg.xwininfo 15 + zoom-us 16 + ]; 17 + text = '' 18 + function is_zoom_window_present { 19 + echo 20 + xwininfo -root -tree \ 21 + | sed 's/.*0x[0-9a-f]* \"\([^\"]*\)\".*/\1/; t; d' \ 22 + | tee window-names 23 + grep -q "Zoom Workplace" window-names 24 + } 25 + # don't let zoom eat all RAM, like it did 26 + # https://github.com/NixOS/nixpkgs/issues/371488 27 + prlimit --{as,data}=$((4*2**30)):$((4*2**30)) zoom-us & 28 + for _ in {0..900} ; do 29 + if is_zoom_window_present ; then 30 + break 31 + fi 32 + sleep 1 33 + done 34 + # if libraries are missing, the window still appears, 35 + # but disappears again immediatelly; check for that too: 36 + sleep 20 37 + is_zoom_window_present 38 + ''; 39 + }; 40 + in 41 + runCommand "zoom-us-test" { buildInputs = [ xvfb-run ]; } '' 42 + HOME=$PWD xvfb-run ${lib.getExe testScript} 43 + touch ${placeholder "out"} 44 + ''