Bug 491172 - Apps with single non-SPDX license in their <project_license> tag display it with its first letter cut off
Summary: Apps with single non-SPDX license in their <project_license> tag display it w...
Status: RESOLVED FIXED
Alias: None
Product: Discover
Classification: Applications
Component: discover (show other bugs)
Version: 6.1.3
Platform: Other Linux
: NOR normal
Target Milestone: ---
Assignee: Plasma Bugs List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-08-02 15:31 UTC by Nate Graham
Modified: 2024-08-02 23:38 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In: 6.1.4
Sentry Crash Report:


Attachments
license for Drawf Fortress shown as "warf Fortress" instead of "Dwarf Fortress" (43.89 KB, image/png)
2024-08-02 15:31 UTC, Nate Graham
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nate Graham 2024-08-02 15:31:48 UTC
Created attachment 172214 [details]
license for Drawf Fortress shown as "warf Fortress" instead of "Dwarf Fortress"

See attached screenshot.

Basically the problem here is that the first letter of the license text will be cut off for any app whose appstream data has a <project_license> tag contains one item with no commas in it, and its text does not match an SPDX license identifier, and also does not match "LicenseRef-[some random thing]".

I can reproduce the issue with multiple packages from Fedora's nonfree RPMFusion repo (found the metainfo files at /usr/share/swcatalog/xml/rpmfusion-nonfree-40.xml.gz), which is full of games with weird nonstandard proprietary licenses.

Examples:

> Dwarf Fortress
> <project_license>Dwarf Fortress</project_license>
> Shown in the UI as "warf Fortress"

> Road Fighter
> <project_license>Distributable</project_license>
> Shown in the UI as "istributable"

> Snes9x
> <project_license>Other</project_license>
> Shown in the UI as "ther"



Examples that do NOT trigger the bug:

> Ripcord
> <project_license>LicenseRef-proprietary</project_license>
> Shown in the UI as "Proprietary"

> Frogatto & Friends
> <project_license>GPL-3.0 and proprietary</project_license>
> Shown in the UI as "GPL-3.0 Proprietary"
Comment 1 Neal Gompa 2024-08-02 15:33:11 UTC
That last one looks like it has a different bug where it isn't handling the license expression operators properly.
Comment 2 Nate Graham 2024-08-02 15:35:50 UTC
Yes, there should be a comma between GPL-3.0 and Proprietary. That's on my short-term to-do list.
Comment 3 Nate Graham 2024-08-02 16:35:46 UTC
Git commit 8da80c819b79890e439af24835c73765784effda by Nate Graham.
Committed on 02/08/2024 at 16:34.
Pushed by ngraham into branch 'master'.

Separate licenses in header with commas

Otherwise they visually blend together, which may result in a display
of licenses that's misleading.

M  +6    -0    discover/qml/ApplicationPage.qml

https://invent.kde.org/plasma/discover/-/commit/8da80c819b79890e439af24835c73765784effda
Comment 4 Bug Janitor Service 2024-08-02 19:11:14 UTC
A possibly relevant merge request was started @ https://invent.kde.org/plasma/discover/-/merge_requests/891
Comment 5 Nate Graham 2024-08-02 23:18:19 UTC
Git commit 1b9b314aeb4eab49ca6cb93abcc22c79a85dfd6c by Nate Graham.
Committed on 02/08/2024 at 23:14.
Pushed by ngraham into branch 'master'.

Only chop off leading @ from tokenized license text if needed

Apparently at some point in the past, tokenized non-SPDX license labels
got prefixed with "@". As a result, the code unconditionally chopped
off the first character.

At some point, tokenizing stopped always doing that, causing some
license labels to be shown with their first letter missing.

I don't know if the prepending might come back in the future, so to be
safe, let's only conditionally remove the first character if it's "@".
FIXED-IN: 6.1.4

M  +7    -1    libdiscover/appstream/AppStreamUtils.cpp

https://invent.kde.org/plasma/discover/-/commit/1b9b314aeb4eab49ca6cb93abcc22c79a85dfd6c
Comment 6 Nate Graham 2024-08-02 23:38:31 UTC
Git commit 4edc093462d867084bca5ea1de708878bae2e4cf by Nate Graham.
Committed on 02/08/2024 at 23:33.
Pushed by ngraham into branch 'Plasma/6.1'.

Only chop off leading @ from tokenized license text if needed

Apparently at some point in the past, tokenized non-SPDX license labels
got prefixed with "@". As a result, the code unconditionally chopped
off the first character.

At some point, tokenizing stopped always doing that, causing some
license labels to be shown with their first letter missing.

I don't know if the prepending might come back in the future, so to be
safe, let's only conditionally remove the first character if it's "@".
FIXED-IN: 6.1.4


(cherry picked from commit 1b9b314aeb4eab49ca6cb93abcc22c79a85dfd6c)

Co-authored-by: Nate Graham <nate@kde.org>

M  +7    -1    libdiscover/appstream/AppStreamUtils.cpp

https://invent.kde.org/plasma/discover/-/commit/4edc093462d867084bca5ea1de708878bae2e4cf