Skip to content

Commit c19b39a

Browse files
chore: append bundle version to mach service name (#191)
We append the CFBundleVersion to the service name to ensure a new service is used for each version. This works around the issue described in #121, presumably caused by the XPC service cache not being invalidated on update. ![image](https://github.com/user-attachments/assets/5b1f2d1d-7aa1-4f58-92b0-ecee712f9131)
1 parent 6082e2d commit c19b39a

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

Coder-Desktop/Coder-Desktop/Info.plist

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,12 @@
2929
<key>NetworkExtension</key>
3030
<dict>
3131
<key>NEMachServiceName</key>
32-
<string>$(TeamIdentifierPrefix)com.coder.Coder-Desktop.VPN</string>
32+
<!-- We append the CFBundleVersion to the service name to ensure a new
33+
service is used for each version. This works around the issue described
34+
in https://github.com/coder/coder-desktop-macos/issues/121, presumably
35+
caused by the XPC service cache not being invalidated on update.
36+
-->
37+
<string>$(TeamIdentifierPrefix)com.coder.Coder-Desktop.VPN.$(CURRENT_PROJECT_VERSION)</string>
3338
</dict>
3439
<key>SUPublicEDKey</key>
3540
<string>Ae2oQLTcx89/a73XrpOt+IVvqdo+fMTjo3UKEm77VdA=</string>

Coder-Desktop/Coder-Desktop/VPN/VPNSystemExtension.swift

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,15 +183,16 @@ class SystemExtensionDelegate<AsyncDelegate: SystemExtensionAsyncRecorder>:
183183
if existing.bundleVersion == `extension`.bundleVersion {
184184
return .replace
185185
}
186+
// TODO: Workaround disabled, as we're trying another workaround
186187
// To work around the bug described in
187188
// https://github.com/coder/coder-desktop-macos/issues/121,
188189
// we're going to manually reinstall after the replacement is done.
189190
// If we returned `.cancel` here the deactivation request will fail as
190191
// it looks for an extension with the *current* version string.
191192
// There's no way to modify the deactivate request to use a different
192193
// version string (i.e. `existing.bundleVersion`).
193-
logger.info("App upgrade detected, replacing and then reinstalling")
194-
action = .replacing
194+
// logger.info("App upgrade detected, replacing and then reinstalling")
195+
// action = .replacing
195196
return .replace
196197
}
197198
}

Coder-Desktop/VPN/Info.plist

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,12 @@
99
<key>NetworkExtension</key>
1010
<dict>
1111
<key>NEMachServiceName</key>
12-
<string>$(TeamIdentifierPrefix)com.coder.Coder-Desktop.VPN</string>
12+
<!-- We append the CFBundleVersion to the service name to ensure a new
13+
service is used for each version. This works around the issue described
14+
in https://github.com/coder/coder-desktop-macos/issues/121, presumably
15+
caused by the XPC service cache not being invalidated on update.
16+
-->
17+
<string>$(TeamIdentifierPrefix)com.coder.Coder-Desktop.VPN.$(CURRENT_PROJECT_VERSION)</string>
1318
<key>NEProviderClasses</key>
1419
<dict>
1520
<key>com.apple.networkextension.packet-tunnel</key>

0 commit comments

Comments
 (0)