Skip to content

Commit e4c5de0

Browse files
fix(desktop): connect to abstract-socket session buses without usocket
The workspace override drops usocket from dbus-next because we never pass Unix descriptors, but upstream only falls back to net for unix:path= addresses. Sessions whose bus lives on an abstract socket, which is what dbus-launch produces outside systemd, threw on require. Patch the abstract branch to use net with the NUL prefix Node supports. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
1 parent bfb2e42 commit e4c5de0

3 files changed

Lines changed: 25 additions & 4 deletions

File tree

docs/internals/linux-snap-shot.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@ helpers (session detection, Niri binding text, portal key mapping, PNG reading)
1313
can answer "which desktop is this" without loading a D-Bus client on macOS or Windows.
1414

1515
The pnpm override removes `usocket` from `dbus-next` because we never pass Unix descriptors.
16-
`dbus-next` falls back to `net` for `unix:path=` addresses but has no fallback for
17-
`unix:abstract=`, so sessions whose bus uses an abstract socket (non-systemd `dbus-launch` setups)
18-
fail to connect. If that matters, patch `lib/connection.js` to use `net.createConnection` with a
19-
leading NUL byte rather than restoring `usocket`.
16+
Upstream only falls back to `net` for `unix:path=` addresses, so `patches/dbus-next@0.10.2.patch`
17+
adds the same fallback for `unix:abstract=` (non-systemd `dbus-launch` sessions). Keep the patch
18+
when bumping `dbus-next`.
2019

2120
## Accessibility identity
2221

patches/dbus-next@0.10.2.patch

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
diff --git a/CHANGELOG.md b/CHANGELOG.md
2+
deleted file mode 100644
3+
index a89691bec87b69ae600f4feb67b88b900ab799de..0000000000000000000000000000000000000000
4+
diff --git a/lib/connection.js b/lib/connection.js
5+
index 780dc041c58e83ebfcd84434e500ec471020813a..7f7f8b4c41e9c347c799e193c6878e3ecfabe982 100644
6+
--- a/lib/connection.js
7+
+++ b/lib/connection.js
8+
@@ -45,10 +45,9 @@ function createStream (opts) {
9+
return net.createConnection(params.socket);
10+
}
11+
if (params.abstract) {
12+
- const usocket = require('usocket');
13+
- const sock = new usocket.USocket({ path: '\u0000' + params.abstract });
14+
- sock.supportsUnixFd = negotiateUnixFd;
15+
- return sock;
16+
+ // T3 Code never passes Unix descriptors, so usocket is removed from the
17+
+ // install. Node connects to abstract sockets natively with a NUL prefix.
18+
+ return net.createConnection('\u0000' + params.abstract);
19+
}
20+
if (params.path) {
21+
try {

pnpm-workspace.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,7 @@ patchedDependencies:
172172
"@react-native-ai/apple@0.12.0": patches/@react-native-ai__apple@0.12.0.patch
173173
"@react-native-menu/menu@2.0.0": patches/@react-native-menu__menu@2.0.0.patch
174174
"@react-navigation/native-stack@7.17.6": patches/@react-navigation%2Fnative-stack@7.17.6.patch
175+
dbus-next@0.10.2: patches/dbus-next@0.10.2.patch
175176
effect@4.0.0-beta.103: patches/effect@4.0.0-beta.103.patch
176177
expo-audio@57.0.4: patches/expo-audio@57.0.4.patch
177178
expo-sharing@57.0.17: patches/expo-sharing@57.0.17.patch

0 commit comments

Comments
 (0)