Skip to content

Commit b9c01f1

Browse files
authored
zoom-us: fix memory usage bug, add test, update (#381281)
2 parents 0158769 + 4357610 commit b9c01f1

File tree

2 files changed

+61
-8
lines changed

2 files changed

+61
-8
lines changed

pkgs/by-name/zo/zoom-us/package.nix

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@
4040
pulseaudioSupport ? true,
4141
libpulseaudio,
4242
pulseaudio,
43+
callPackage,
4344
}:
4445

4546
let
@@ -50,23 +51,23 @@ let
5051
# and often with different versions. We write them on three lines
5152
# like this (rather than using {}) so that the updater script can
5253
# 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";
5657

5758
srcs = {
5859
aarch64-darwin = fetchurl {
5960
url = "https://zoom.us/client/${versions.aarch64-darwin}/zoomusInstallerFull.pkg?archType=arm64";
6061
name = "zoomusInstallerFull.pkg";
61-
hash = "sha256-WPhqYof/XR6TDkuA4NK2a30ksdhN7NBfs4KCQwqKJ0g=";
62+
hash = "sha256-tqDf3Z5RRf4aRvtINWdM3oppZXbDdtihhPBHu4QxzDM=";
6263
};
6364
x86_64-darwin = fetchurl {
6465
url = "https://zoom.us/client/${versions.x86_64-darwin}/zoomusInstallerFull.pkg";
65-
hash = "sha256-BywBvJCcNXARHTkO/UJbOFRjuiXRkmFWmSuZsW9t1pk=";
66+
hash = "sha256-BZkBx5eZ3c3p9JIz+ChyJrGM12HwyNToSuS86f9QnF0=";
6667
};
6768
x86_64-linux = fetchurl {
6869
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=";
7071
};
7172
};
7273

@@ -122,6 +123,7 @@ let
122123
coreutils
123124
glib.dev
124125
pciutils
126+
pipewire
125127
procps
126128
util-linux
127129
]
@@ -179,16 +181,22 @@ stdenv.mkDerivation {
179181
substituteInPlace $out/share/applications/Zoom.desktop \
180182
--replace-fail "Exec=/usr/bin/zoom" "Exec=$out/bin/zoom"
181183
182-
for i in aomhost zopen zoom ZoomLauncher ZoomWebviewHost; do
184+
for i in aomhost zopen ZoomLauncher ZoomWebviewHost; do
183185
if [ -f $out/opt/zoom/$i ]; then
184186
patchelf --set-interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" $out/opt/zoom/$i
185187
fi
186188
done
187189
188190
# ZoomLauncher sets LD_LIBRARY_PATH before execing zoom
189191
# 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
190196
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 \
192200
--prefix LD_LIBRARY_PATH ":" ${libs}
193201
194202
rm $out/bin/zoom
@@ -220,6 +228,7 @@ stdenv.mkDerivation {
220228
dontPatchELF = true;
221229

222230
passthru.updateScript = ./update.sh;
231+
passthru.tests.startwindow = callPackage ./test.nix { };
223232

224233
meta = with lib; {
225234
homepage = "https://zoom.us/";

pkgs/by-name/zo/zoom-us/test.nix

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
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+
''

0 commit comments

Comments
 (0)