Bug 1943727 - Invalid empty <font> element in /usr/share/metainfo/org.fedoraproject.material-icons-fonts.metainfo.xml
Summary: Invalid empty <font> element in /usr/share/metainfo/org.fedoraproject.materia...
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: material-icons-fonts
Version: 33
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jerry James
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2021-03-26 22:56 UTC by Philip Withnall
Modified: 2021-04-07 15:39 UTC (History)
1 user (show)

Fixed In Version: material-icons-fonts-4.0.0-3.fc34 material-icons-fonts-4.0.0-3.fc33
Clone Of:
Environment:
Last Closed: 2021-04-03 01:28:12 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Philip Withnall 2021-03-26 22:56:46 UTC
material-icons-fonts-4.0.0-1.fc33.src.rpm installs the following in /usr/share/metainfo/org.fedoraproject.material-icons-fonts.metainfo.xml:

```
<?xml version="1.0" encoding="UTF-8"?>
<!-- SPDX-License-Identifier: MIT -->
<component type="font">
  <id>org.fedoraproject.material-icons-fonts</id>
  <metadata_license>MIT</metadata_license>
  <project_license>ASL 2.0</project_license>
  <name>Material Icons</name>
  <summary><![CDATA[Google material design system icons]]></summary>
  <description>
    <p><![CDATA[Material design icons is the official icon set from Google.  The icons are designed under the material design guidelines.]]></p>
  </description>
  <updatecontact>fonts.org</updatecontact>
  <url type="homepage">https://google.github.io/material-design-icons/</url>
  <releases>
    <release version="4.0.0-1.fc33" date="2020-12-03"/>
  </releases>
  <provides>
    <font></font>
    <font>Material Icons</font>
  </provides>
</component>
```

The `<font></font>` element is invalid, and was causing a critical warning in gnome-software (fixed here: https://gitlab.gnome.org/GNOME/gnome-software/-/merge_requests/671).

From my brief look at the source for material-icons-fonts, it seems the metainfo file is generated at package build time, rather than stored statically, so this may actually be a bug in the RPM macros to do that. I haven’t investigated that further.

Comment 1 Philip Withnall 2021-03-26 23:00:57 UTC
While `appstream-util validate-relax /usr/share/metainfo/org.fedoraproject.material-icons-fonts.metainfo.xml` (as done at package build time) passes, `appstreamcli validate /usr/share/metainfo/org.fedoraproject.material-icons-fonts.metainfo.xml` fails with:
```
I: org.fedoraproject.material-icons-fonts:4: cid-contains-hyphen org.fedoraproject.material-icons-fonts
W: org.fedoraproject.material-icons-fonts:18: tag-empty font
I: org.fedoraproject.material-icons-fonts:12: unknown-tag updatecontact
W: org.fedoraproject.material-icons-fonts:6: spdx-license-unknown ASL 2.0

Validation failed: warnings: 2, infos: 2
```

appstreamcli is provided by libappstream; appstream-util is provided by appstream-glib. appstreamcli is maintained by the same person who maintains the appstream specification, so may be a bit more up-to-date at this point than appstream-util, which has seen less recent active development.

Comment 2 Philip Withnall 2021-03-26 23:04:12 UTC
Filed a bug against appstream-util to tighten up its validation: https://github.com/hughsie/appstream-glib/issues/393

Comment 3 Philip Withnall 2021-03-26 23:06:24 UTC
Relevant section of the appstream specification, for reference: https://www.freedesktop.org/software/appstream/docs/sect-Metadata-Fonts.html#tag-font-provides

Comment 4 Jerry James 2021-03-29 21:32:47 UTC
Thanks for the report, Philip.  After digging through the font macros to see how the <font></font> tags are generated, it looks like this is the problem:

$ fc-scan MaterialIcons-Regular.ttf -f "    <font>%{fullname[0]}</font>\\n"
    <font>Material Icons</font>
$ fc-scan MaterialIconsOutlined-Regular.otf -f "    <font>%{fullname[0]}</font>\\n"
    <font></font>
$ fc-scan MaterialIconsRound-Regular.otf -f "    <font>%{fullname[0]}</font>\\n"
    <font></font>
$ fc-scan MaterialIconsSharp-Regular.otf -f "    <font>%{fullname[0]}</font>\\n"
    <font></font>
$ fc-scan MaterialIconsTwoTone-Regular.otf -f "    <font>%{fullname[0]}</font>\\n"
    <font></font>

That is, none of the *.otf font files specify a "fullname" property.  The %__fontbuild macro (defined in /usr/lib/rpm/macros.d/macros.fonts-rpm.internal) clearly doesn't expect this.  I'll think about what to do.  I am certainly open to suggestions.

The invalid cid with hyphens is an artifact of the font macros.  I see the same thing in a number of files matching /usr/share/metainfo/org.fedoraproject.*fonts.metainfo.xml.

The name "updatecontact" should be "update_contact"; that is generated on line 73 of /usr/lib/rpm/macros.d/macros.fonts-rpm.internal.

Regarding the bad license name, according to https://docs.fedoraproject.org/en-US/packaging-guidelines/FontsPolicy/, the value of %fontlicense should be "the identifier of the font family license, according to our licensing rules".  Since this text appears on a fedoraproject.org page, the only reasonable meaning to attach to "our licensing rules" is to comply with https://docs.fedoraproject.org/en-US/packaging-guidelines/LicensingGuidelines/, which I have done.  The name "ASL 2.0" is the correct Fedora name for the license.  In fact, the font macros clearly suppose that that is the case, because that name is also placed in the "License" field for the RPM itself; see line 167 of /usr/lib/rpm/lua/fedora/srpm/fonts.lua.  If the SPDX license name should appear in the metainfo file, then the Fedora macros are going to have to be changed to accept two values: the Fedora license name and the SPDX license name.

Comment 5 Jerry James 2021-03-29 22:44:35 UTC
I'm going to fix up the generated metainfo in the short term.  The long term solution requires some work on the font macros, which I am probably not qualified to do.

Comment 6 Fedora Update System 2021-03-29 23:08:56 UTC
FEDORA-2021-1de1902711 has been submitted as an update to Fedora 34. https://bodhi.fedoraproject.org/updates/FEDORA-2021-1de1902711

Comment 7 Fedora Update System 2021-03-30 14:38:55 UTC
FEDORA-2021-1de1902711 has been pushed to the Fedora 34 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-1de1902711`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-1de1902711

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2021-03-30 15:21:34 UTC
FEDORA-2021-df7820b79a has been pushed to the Fedora 33 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --advisory=FEDORA-2021-df7820b79a`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2021-df7820b79a

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Fedora Update System 2021-04-03 01:28:12 UTC
FEDORA-2021-1de1902711 has been pushed to the Fedora 34 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 10 Fedora Update System 2021-04-07 15:39:42 UTC
FEDORA-2021-df7820b79a has been pushed to the Fedora 33 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.