Because of this issue, several classic snaps have been accumulating ad-
hoc fixes:

- emacs arms AppArmor's onexec transition from inside the running Emacs process 
(elisp), deliberately keeping Emacs itself under its snap.emacs.* label because 
the dock/shell groups windows by it, while everything it spawns runs unconfined 
(https://github.com/alexmurray/emacs-snap/blob/master/site-lisp/site-start.el#L94)
- Pi gained a wrapper script that writes exec unconfined before exec'ing node 
https://github.com/canonical/pi-coding-agent-snap/pull/28
- OpenCode has the same wrapper for the CLI. For the desktop app, the Electron 
main/sidecar bundles are patched at build time to arm the transition 
in-process, for the same dock-grouping reason as emacs 
https://github.com/canonical/opencode-snap/pull/90
- Antigravity took inspiration from OpenCode 
https://github.com/canonical/antigravity-snap/pull/27/

And there are some snaps that have a pending fix, like ghostty (comment
#29 above) and uv (https://github.com/lengau/uv-snap/issues/24).

These wrappers get the job done, but each snap reinvents the workaround
(wrapper script vs build-time bundle patching vs in-process arming), and
they carry real trade-offs:

- Unconfining children only moves the problem: strict snaps on the receiving 
side expect inherited fds from peers labeled snap.*, so e.g. strict snaps used 
as stdio MCP servers over socketpairs break 
(https://github.com/canonical/opencode-snap/issues/117)
- Desktop apps must keep the label for window grouping, forcing the more 
invasive in-process variants - and matching can still fail depending on which 
process owns the window (I found this myself when building the Zed snap, which 
needed a StartupWMClass desktop entry key on top of a wrapper)
- In general these approaches are perceived as obscure, which may make 
transferring snaps to upstream projects harder

Having a fix would help these packages, mostly developer tools and AI
agents.

** Bug watch added: github.com/lengau/uv-snap/issues #24
   https://github.com/lengau/uv-snap/issues/24

** Bug watch added: github.com/canonical/opencode-snap/issues #117
   https://github.com/canonical/opencode-snap/issues/117

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/1849753

Title:
  AppArmor profile prohibits classic snap from inheriting file
  descriptors

To manage notifications about this bug go to:
https://bugs.launchpad.net/apparmor/+bug/1849753/+subscriptions


-- 
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to