Skip to content

Fix false Flatpak sandbox warning for /var/mnt paths - #529

Merged
ChrisDKN merged 1 commit into
ChrisDKN:mainfrom
Sarthak-Awasthi:fix-flatpak-var-mnt-main
Sep 13, 2026
Merged

ChrisDKN merged 1 commit into
ChrisDKN:mainfrom
Sarthak-Awasthi:fix-flatpak-var-mnt-main

Conversation

@Sarthak-Awasthi

@Sarthak-Awasthi Sarthak-Awasthi commented Sep 10, 2026 •

Copy link
Copy Markdown
Contributor

What: On Fedora Atomic / Bazzite (and similar immutable distros) /mnt is a symlink to /var/mnt. The Flatpak manifest grants --filesystem=/mnt, which therefore already exposes /var/mnt, and Path.resolve() rewrites any /mnt/... path the user picks to its /var/mnt/... target. But sandbox.flatpak_blocked_path_hint() only listed /mnt in _GRANTED_ROOTS, so a resolved /var/mnt/... staging or game path was flagged as "This path is not visible inside the Flatpak sandbox" and game setup was blocked — even though the folder is fully accessible. Picking /mnt/... hit the same wall because it resolves to /var/mnt/....

Why it's a bug: The path is genuinely reachable (the reporter confirmed the sandbox can mkdir/rmdir there), so the reachability check produces a false positive that stops the user from adding a game. Reported and root-caused in #510.

Fix:

  • Add /var/mnt to _GRANTED_ROOTS in src/Utils/environment/sandbox.py.
  • Grant /var/mnt explicitly in the Flatpak manifest, so it also works where /var/mnt is a real mount independent of the /mnt symlink.

Test: Adds src/Utils/environment/_sandbox_selftest.py, a dependency-free regression test following the repo's _selftest.py convention. It forces in_flatpak on and drives flatpak_blocked_path_hint with non-existent paths so the granted-root logic (not the early "path exists" return) is what decides:

Path Result
/var/mnt/.../staging/SkyrimSE no warning (fixed)
/mnt/..., /run/media/..., /media/... no warning
/opt/..., /data/..., /srv/... (genuinely ungranted) still warns (no regression)

Run:

PYTHONPATH=src python3 -m Utils.environment._sandbox_selftest

Verified: passes with the fix; the granted-root assertions fail if /var/mnt is reverted out of _GRANTED_ROOTS.

Fixes #510


Assisted-by: Claude (claude-opus-4-8)

On Fedora Atomic / Bazzite, /mnt is a symlink to /var/mnt, so the
--filesystem=/mnt grant already exposes /var/mnt, and Path.resolve()
rewrites any /mnt/... path the user picks to its /var/mnt/... target.
The sandbox reachability check only listed /mnt in _GRANTED_ROOTS, so a
resolved /var/mnt/... staging or game path was flagged as "not visible
inside the Flatpak sandbox" even though it is fully accessible, blocking
game setup.

Add /var/mnt to _GRANTED_ROOTS and grant it explicitly in the manifest,
with a dependency-free selftest guarding the hint (granted trees stay
silent; genuinely ungranted trees still warn).

Fixes ChrisDKN#510

Assisted-by: Claude (claude-opus-4-8)
@ChrisDKN
ChrisDKN merged commit 8d3795b into ChrisDKN:main Sep 13, 2026
2 checks passed
@Sarthak-Awasthi
Sarthak-Awasthi deleted the fix-flatpak-var-mnt-main branch September 14, 2026 13:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Flatpack] filesystem access

2 participants