[Bug]: Flatpak page shows flathub/stable for an app installed from flathub-beta (PrusaSlicer: 2.9.7 offered, 3.0.0 installed)

オープン 初心者向け
#144 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
72/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
cpp, linux
領域
desktop

調査の方向性

src/flatpakclient.cpp の preferred()(49~56行目)から始めてください。この関数はカタログのエントリを、flathub を優先し、次に stable の順で並べます。toItem() が選ばれたカタログエントリとインストール済みの ref をどのようにマージしているか, そして installedRefs がどこで作られているかを確認してください。提案されている修正はこれに依存します。インストール済みの beta ref が自身の remote と branch を表示し、未インストールのアプリは引き続き flathub/stable を優先すれば完了です。期待される動作(インストール済みの ref に一致させるか、両方を一覧表示するか)は、先にメンテナーに確認してください。

索引モデルが issue の本文から書いたものです。

説明

Summary

The Flatpak page offers the wrong copy of an app when the installed copy comes from a different remote or branch than the one the catalogue dedupe prefers. PrusaSlicer is installed from flathub-beta / branch beta, version 3.0.0, but the page shows flathub / branch stable, version 2.9.7 as the app's version, with "installed from flathub-beta".

Environment

  • CachyOS rolling, KDE Plasma 6.8.3 / KWin Wayland
  • cachyos-packageinstaller 2.0.0-1
  • flatpak 1.18.4
  • Remotes: flathub (system), flathub-beta (system), flathub (user)

Steps to reproduce

  1. flatpak install flathub-beta com.prusa3d.PrusaSlicer (installs branch beta, version 3.0.0)
  2. Open the Package Installer, go to the Flatpak page, search for PrusaSlicer.
  3. The page reports 2.9.7 as the available version and the installed version as 3.0.0.

What the system reports

$ flatpak list --app --columns=application,branch,installation,origin,version
com.prusa3d.PrusaSlicer    beta    system    flathub-beta    3.0.0

$ flatpak remote-ls --system flathub --app --columns=application,branch,version
com.prusa3d.PrusaSlicer    stable    2.9.7

$ flatpak remote-ls --system flathub-beta --app --columns=application,branch,version
com.prusa3d.PrusaSlicer    beta      3.0.0

Cause

src/flatpakclient.cpp, preferred() (lines 49-56):

/// Which of two offers of the same app is shown: Flathub before other remotes, the stable
/// branch before others, then by name so the choice never depends on the order of loading.
bool preferred(const FlatpakApp& a, const FlatpakApp& b) {
    const auto rank = [](const FlatpakApp& app) {
        return std::tuple(app.remote != "flathub"_L1, app.branch != "stable"_L1, app.remote, app.branch);
    };
    return rank(a) < rank(b);
}

The catalogue of every system remote is loaded and deduplicated per app id with preferred(), so the flathub/stable entry always wins — even when the installed ref is on another remote and branch. toItem() then mixes that entry with the installed copy: title and available version come from flathub/stable (2.9.7), while installedVersion, installedFrom and branch come from the installed beta copy.

The same ranking ignores the user installation, which is fine for the catalogue (the README says only system catalogs are read) but means an installed beta ref has no way to win.

Expected

When an app is installed, the offer should be the catalogue entry that matches the installed ref (same remote and branch) — or, if the catalogues disagree, both should be listed. Only uninstalled apps should fall back to "flathub, then stable".

Suggested fix

Rank by whether the ref is installed before the flathub/stable heuristics:

const auto rank = [&](const FlatpakApp& app) {
    const bool isInstalled = std::ranges::any_of(installedRefs, [&](const auto& ref) { return ref == app.ref; });
    return std::tuple(!isInstalled, app.remote != "flathub"_L1, app.branch != "stable"_L1, app.remote, app.branch);
};

Impact

The version shown for such an app is wrong, and the install/update action on that page targets the stable copy instead of the one the user is tracking. Updates themselves come from flatpak remote-ls --updates, so the update list is not affected — only the app offer and its displayed version.

主要言語
C++
スター
43
フォーク
39
平均マージ
1日 6時間
マージ済み PR(30日)
12

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

CachyOS/packageinstaller のほかの issue

CachyOS/packageinstaller の issue をすべて見る

似ている issue

C++ の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。