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

Issue #1 - Rename mime files and icons #567

Merged
merged 1 commit into from
Nov 19, 2023
Merged

Conversation

hfiguiere
Copy link
Contributor

@hfiguiere hfiguiere commented Oct 22, 2023

This currently sits on top of #566

Close #1

@hfiguiere
Copy link
Contributor Author

My concern is how to handle the compatibility.

Currently you get these warnings:

** (flatpak-builder:1488560): WARNING **: 22:02:40.385: Unknown property rename-mime-file for type BuilderManifest

** (flatpak-builder:1488560): WARNING **: 22:02:40.385: Unknown property rename-mime-icons for type BuilderManifest

But that mean that the rename won't be done. Lots of packages do this manually.

@hfiguiere
Copy link
Contributor Author

Apparently the XML writing code in flaptak-builder is buggy.

@hfiguiere
Copy link
Contributor Author

Something like

            <match type="string" value="&lt;?xml" offset="0">

is rewritten as

            <match type="string" value="<?xml" offset="0">

@hfiguiere
Copy link
Contributor Author

something like that.

This was from real-life testing.

@hfiguiere hfiguiere force-pushed the rename-mime branch 2 times, most recently from 1a2f111 to b535eb5 Compare October 22, 2023 22:38
@TingPing
Copy link
Member

My concern is how to handle the compatibility.

I don't think there is anything we can really do about that, other than have Flathub update quickly.

@TingPing
Copy link
Member

Hmm. I can't reproduce with what you've pushed here, though I can certainly understand attribute_values being incorrect at some point.

It looks like node->attribute_values are always unescaped markup, and they get escaped at write by g_markup_printf_escaped().

@hfiguiere
Copy link
Contributor Author

Hmm. I can't reproduce with what you've pushed here

That's because I already pushed the fix. I even added it in the test case.

@TingPing
Copy link
Member

TingPing commented Oct 23, 2023

Oh excellent :)

The XML parsing does incorrectly handle values though:

<match type="string" value="<?xml" offset="0"> gets let through when it should error.

@TingPing
Copy link
Member

Err, nevermind. It does get escaped, but it is technically invalid input.

@TingPing
Copy link
Member

TingPing commented Oct 23, 2023

@hfiguiere What do you think of this: 0d2e76a

@hfiguiere
Copy link
Contributor Author

@hfiguiere What do you think of this: 0d2e76a

Looks ok to me. But my testing was done with files that validated, and the error was detectd by the mime-update, which the input supposedly passed.

It's not a dependency for this.

@TingPing
Copy link
Member

TingPing commented Oct 23, 2023

The validation change actually needs to happen in GMarkupParser I think, since it unescapes before it gets to this function. Anyway being overly relaxed on input probably isn't a big deal.

@TingPing
Copy link
Member

FWIW: #568

If I find time I might look into some day.

@hfiguiere
Copy link
Contributor Author

The validation change actually needs to happen in GMarkupParser I think, since it unescapes before it gets to this function. Anyway being overly relaxed on input probably isn't a big deal.

Usually it's relaxed on input and strict on output.

As discussed, in the longer term it might be wise to use libxml2 to handle XML, but that's not something blocking right now.

There error was triggered by update-mime-database that flatpak runs after installing.

@JakobDev
Copy link
Contributor

My concern is how to handle the compatibility.

That's no problem. We already have flatpak-builder packaged as Flatpak, so everyone can use the latest version

- Added rename-mime-file and rename-mime-icons.

flatpak#1
@TingPing TingPing merged commit 7a710f6 into flatpak:main Nov 19, 2023
5 checks passed
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

Successfully merging this pull request may close these issues.

Provide way to rename mime .xml files
3 participants