Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

appstreamcli not able to explain correctly a wrong icon tag #696

Open
fedelibre opened this issue Jan 31, 2025 · 2 comments
Open

appstreamcli not able to explain correctly a wrong icon tag #696

fedelibre opened this issue Jan 31, 2025 · 2 comments

Comments

@fedelibre
Copy link

As discussed here, appstreamcli validate was not able to explain a problem in a metainfo file. Even worse, it was leading me on a wrong track.

The error printed by appstreamcli is:

$ appstreamcli validate-tree --no-net --explain build/files
org.frescobaldi.Frescobaldi.metainfo.xml
  E: org.frescobaldi.Frescobaldi:~: app-categories-missing
     This component is in no valid categories, even though it should be. Please check its metainfo
     file and desktop-entry file.

? Validation failed: errors: 1, pedantic: 1

The categories are set in the desktop file and I know that appstreamcli should check categories in the desktop file if they are not present in the metainfo. So my guess was that for some reason the desktop file could not be found. A wrong guess.

Eventually I was told that the problem is the presence of this tag in my metainfo file:

<icon type="stock">org.frescobaldi.Frescobaldi</icon>

For the records, appstream-util was able to detect and explain the error correctly, here's the output:

• tag-invalid           : stock icon is not valid [org.frescobaldi.Frescobaldi]

Can you improve this error detection?
Thanks

@ximion
Copy link
Owner

ximion commented Feb 11, 2025

No, appstream-util is broken here, you should not use it.
And appstreamcli is correct with its warning. The problem is this:

  • We only pull data from desktop-entry files if we need to, so, if a metainfo file has a stock icon defined, it is assumed that the metainfo file is complete on its own.
  • If appstremcli knows that no desktop-entry data will be pulled, it validates the metainfo file more strictly, and only then does it raise a warning that you need to add categories.

This issue can be avoided by validating the two files together with validate-tree, and admittedly, the behavior is a bit obscure. But since the "pull data from desktop-entry files" is implicit by design and not explicit, there's sadly no good way for ascli to know which validation rules to apply when, other than using heuristics.

The only reason you "fixed" it with appstream-util is because that tool validates incorrectly, and just happened to flag a tag that you had to remove to make ascli's heuristics assume that there will be a desktop-entry file and switch to its more relaxed validation mode.

@fedelibre
Copy link
Author

Thanks for the explanation. It makes sense.

I used the icon tag, because I found it in the documentation and I could not imagine that it could have broken this "data pulling" from the desktop file.
Maybe adding a warning in the docs might help?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants