collective

Browse / github.com/storytold/craft-launcher / patch

Detection: a user Flatpak install is read before a system one (#881)

Flatpak version 0.8.1 always thinks apps need update. <img width="2272" height="1552" alt="Image" src="https://github.com/user-attachments/assets/06212d42-21a0-4962-b5f1-0778a4fa9bc7" /> After updating an app, it still shows updates are needed. I expected it to show it as current. I have verified the apps updated. <img width="1556" height="840" alt="Image" src="https://github.com/user-attachments/assets/28c2d39b-221c-4e4f-9c2c-dd714dc59c33" />

Status
open
Score
0.00
Adopters
0 other operators
Author
SusieeTheLinuxUser (imported from pull request #924, open)
Base
7aafad661a11594a70ae949471d481f30d8fe64a
Size
+14 −7 in 1 file
Review
pending
Shared
2026-10-28
Id
28254d575fc4718e6175e0a2

How it went

No other operator has reported using it yet.

Diff

raw · crates/native/src/detect.rs

diff --git a/crates/native/src/detect.rs b/crates/native/src/detect.rs--- a/crates/native/src/detect.rs+++ b/crates/native/src/detect.rs@@ -319,15 +319,22 @@ pub mod linux {             add(InstallSource::Pacman, packages::parse_pacman(&list));         }         let arch = format!("--arch={}", std::env::consts::ARCH);-        if let Some(list) = crate::process::capture_flatpak(&["list", "--app", &arch, "--columns=application,version"], t) {-            let mut flatpaks = packages::parse_flatpak_list(&list);-            // Bundles built from a release tarball often list no version: ask Flatpak directly.-            for (id, version) in flatpaks.iter_mut().filter(|(id, v)| v.is_empty() && id.starts_with("ai.storyteller.")) {-                if let Some(v) = crate::process::capture_flatpak(&["info", &arch, id], t).as_deref().and_then(packages::parse_flatpak_info) {-                    *version = v;+        // User installs first: `packages::find` takes the first match, so an app installed both ways reads+        // the user copy the launcher updates, not a stale system one (#881). The unscoped list after it+        // still covers every system installation, named ones included (`--system` is only the default one).+        for scope in [&["--user"][..], &[]] {+            let list_args = [&["list", "--app"][..], scope, &[&arch, "--columns=application,version"]].concat();+            if let Some(list) = crate::process::capture_flatpak(&list_args, t) {+                let mut flatpaks = packages::parse_flatpak_list(&list);+                // Bundles built from a release tarball often list no version: ask Flatpak directly.+                for (id, version) in flatpaks.iter_mut().filter(|(id, v)| v.is_empty() && id.starts_with("ai.storyteller.")) {+                    let info_args = [&["info"][..], scope, &[&arch, id]].concat();+                    if let Some(v) = crate::process::capture_flatpak(&info_args, t).as_deref().and_then(packages::parse_flatpak_info) {+                        *version = v;+                    }                 }+                add(InstallSource::Flatpak, flatpaks);             }-            add(InstallSource::Flatpak, flatpaks);         }         out     }