Skip to content

Devtools symlinks broken when BAR is installed via Flatpak #47

Description

@NortySpock

Issue:

When BAR is installed via Flatpak (info.beyondallreason.bar), the Spring engine runs sandboxed. Symlinks created by just link::create bar point into $DEVTOOLS_DIR/Beyond-All-Reason (typically somewhere under the user's home directory), but the Flatpak sandbox denies the engine access to follow the symlink outside its permitted filesystem.

Steps to reproduce:

  1. Install BAR via Flatpak.
  2. Clone BAR-Devtools and clone/link the BAR repo:
    cd /home/you/BAR-Devtools
    just repos::clone bar
    just link::create bar
    
  3. Launch BAR (via Flatpak desktop entry or flatpak run).
  4. Check logs — the engine prints:
    Warning: [FSA::GetFileModificationTime] error 'No such file or directory' getting last modification time of file '/home/you/.var/app/info.beyondallreason.bar/data/games/Beyond-All-Reason.sdd'
    Warning: [IsPathOnSpinningDisk] Error 'No such file or directory' getting stat() for file '/home/you/.var/app/info.beyondallreason.bar/data/games/Beyond-All-Reason.sdd'
    

Root cause:

The symlink itself is valid:

~/.var/app/info.beyondallreason.bar/data/games/Beyond-All-Reason.sdd
  → /home/you/BAR-Devtools/Beyond-All-Reason

But the Flatpak runtime's filesystem sandbox blocks the engine from reading paths outside /home/you/.var/app/info.beyondallreason.bar/ (and a handful of other permitted locations). The kernel returns ENOENT to the engine when it tries to stat() the symlink target, even though the path exists outside the sandbox.

Workaround:

Manually grant the BAR Flatpak access to the devtools directory:

flatpak override --user info.beyondallreason.bar --filesystem=/home/you/BAR-Devtools

Replace the path with wherever your DEVTOOLS_DIR lives.

Proposed fix:

detect_game_dir() in scripts/setup.sh currently checks ~/.local/state/Beyond All Reason and WSL-specific paths, but does not detect the Flatpak data directory at ~/.var/app/info.beyondallreason.bar/data. A fix could either:

  1. Teach detect_game_dir() to recognize the Flatpak path (and emit a warning if flatpak override hasn't granted access to the devtools source).
  2. Add a just doctor check that detects Flatpak installations and advises the user to run flatpak override if their devtools source is outside the Flatpak sandbox.
  3. Future: have just link::create detect the Flatpak runtime and suggest the flatpak override command automatically, or alternatively copy/sync the repo into the Flatpak-visible games directory instead of symlinking.

Additional context:

  • detect_game_dir() source: scripts/setup.sh lines 1661-1695 — no Flatpak path handling.
  • The intended dev workflow is just bar::launch (native), which avoids this entirely. The issue only affects users who launch BAR via the Flatpak entrypoint while using Devtools symlinks for development.
  • dev.Containerfile doesn't reference Flatpak; this is purely a host-side sandbox constraint.

LLM Disclosure

Diagnosed and researched by DeepSeek v4 Flash. Reviewed prior to submission by NortySpock.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions