https://bugs.kde.org/show_bug.cgi?id=465204

            Bug ID: 465204
           Summary: Source/origin for PackageKit apps is non-determinstic
    Classification: Applications
           Product: Discover
           Version: master
          Platform: Other
                OS: Linux
            Status: REPORTED
          Severity: normal
          Priority: NOR
         Component: PackageKit
          Assignee: plasma-b...@kde.org
          Reporter: n...@kde.org
                CC: aleix...@kde.org
  Target Milestone: ---

On the application page, the text displayed in both the "Sources" dropdown and
the "Distributed by" metadata field is non-deterministically. On my Fedora
system, for different apps, it will display any of the following values:
"fedora"
"updates"
"installed"
"installed:"fedora

This happens because PackageKitResource has no override for displayOrigin(),
causing it to fall back to origin(), which gets its data from
availablePackageId(), which has the following code:

QString PackageKitResource::availablePackageId() const
{
    // First we check if it's upgradeable and use this version to display
    const QSet<QString> pkgids = backend()->upgradeablePackageId(this);
    if (!pkgids.isEmpty())
        return *pkgids.constBegin();

    const auto it =
m_packages.constFind(PackageKit::Transaction::InfoAvailable);
    if (it != m_packages.constEnd())
        return it->first();
    return installedPackageId();
}

In two cases, it blindly returns the first result of an unsorted multi-item
container. Thus, the seemingly random text. It *is* random!

We should either fix this logic to return a deterministic result (if it
wouldn't disrupt any non-display code using it), or else override
displayOrigin() to return a nice user-facing string; something like "<distro
name> (<repo name> repository)"

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to