-
-
Notifications
You must be signed in to change notification settings - Fork 566
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
Submit AppImage MIME Type to xdg/shared-mime-info #144
Comments
Good point. Actually I have tried but never was successful; do you know why the following is not working?
|
@probonopd
I was able to get the expected mimetype after fixing the above issues! |
Strange. Changed it to
I get no more syntax complaints but it doesn't seem to work either. Ubuntu 16.04. |
No idea, works for me (even your updated version). I'm on archlinux with shared-mime-info 1.6 Anyway, when you submit a new mime to upstream shared-mime-info, they require you to provide a test file as well, and that is what matters. If the test passes, the mime is gonna be accepted :) |
Anyone, we need to iron this out and then submit together with a link to an example AppImage such as https://bintray.com/probono/AppImages/download_file?file_path=Leafpad-0.8.17-x86_64.AppImage according to https://cgit.freedesktop.org/xdg/shared-mime-info/tree/HACKING. I'm a bit lost here. |
I can do it if you want, I recently submitted a mimetype so I have fresh memory of the burocracy :p |
That would be great. Before you do please check that it works with and without the suffixes. |
...and that the AppImage can still be executed by double-clicking when chmod a+x is set. Worst case would be that it is no longer recognized as an ELF executable in GNOME Nautilus and the likes. |
Would making it a subclass of ISO automatically allow tools like Ark or file-roller to process it? |
Not necessarily. I can only speak for Ark, which unfortunately hardcodes the list of supported mimetypes |
For whatever reason I had to log out and log in again and now it is working. AppImages still run when they have the executable bit set; however when the executable bit is not set they are tried to be opened with file-roller (which says it cannot handle the file). Is there a way around that? |
Yeah, same here with Dolphin+Ark. I guess they are indeed detected as ISO by the file-managers. What should be the expected behavior instead? Just nothing happening? |
Another thing, the 2nd and 3rd magic offset are too big and I think the shared-mime-info maintainers will complain about this. Isn't enough to just match the |
When we don't subclass it to I am actually not sure which behavior is better. Just found out that when we subclass it to |
No, because then we would match every ELF. I guess every ISO is also matched this way? |
Ah, now I remember. ISO files don't have any magic (because of too long offset required):
There is also this other bug which breaks ISO files detection: https://bugs.freedesktop.org/show_bug.cgi?id=80877 I can try to submit the mime as is, and then let's see what the maintainers think... |
Do you know what is the largest acceptable offset? |
Nope, but I guess something around 2K bytes (the largest offset in the current database seems to be 2112). |
Draft of the patch here: https://gist.github.com/aelog/0db7e74520fe5dbfcb7d7e765e2ef986 |
Quick experimentation suggests that ELF binaries have "GNU" at offset 608 but they continue to work if I change that to "AppImage". However I am entirely uncertain at this time whether this violates some standard... I guess I need to read up on the ELF format to find a way to sneak in a magic string or number into the ELF header reliably. |
Allright, no hurry from my side. Just ping me here when you think the mime is ready for submission :) |
Opened https://bugzilla.gnome.org/show_bug.cgi?id=766644 on file-roller: Process ISO files regardless of the filename extension |
@aelog I was thinking about doing this at some point but you beat me to it!
<magic priority="50">
<match value="ELF" type="string" offset="1" >
<match value="CD001" type="string" offset="32769">
<match value="AppImage" type="string" offset="32809" />
<match value="APPIMAGE" type="string" offset="32809" />
</match>
</match>
</magic> The nested
|
Ah, I see that the problem is with the ISO offsets being too large. It should be enough to just do the glob for ".AppImage" in the filename and match for "ELF" in the binary, providing the "ELF" magic is set to an appropriate priority. Looking at the shared-mime-info database I can see that "ELF" is already matched with priority 40 and 50, so I think the appropriate value is either 30 or 60. Somewhat counter-intuitively, I think it needs to be a higher priority to prevent matching against random ELF files, but you'd need to test it for yourself. @probonopd it won't help detection of existing AppImages, but here are some options for embedding data in an ELF file to create your own magic bits. |
@shoogle I don't mind if you want to submit the mime. I was just waiting to hear from @probonopd about how he plans to solve this magic thing. |
Unfortunately it is not solved yet. We need to find a way to sneak in a magic further at the top of the ELF. Is there a way to get a certain magic into the ELF header and still be fully compliant? |
Maybe on the .data or .text sections of the ELF. Now I'm traveling, later El mié., 15 jun. 2016 10:54, probonopd [email protected] escribió:
|
Apparently bytes 8-15 of the header are unused, which gives just enough room to write "AppImage"! printf 'AppImage' | dd bs=1 seek=8 count=8 conv=notrunc of=Program.AppImage Which makes for some pretty neat Elf magic! 😄 <magic priority="50">
<match value="ELF" type="string" offset="1" >
<match value="AppImage" type="string" offset="8" />
</match>
</magic> |
OK, good to hear @elvisangelaccio. I will continue to investigate. I also have the optional |
Ah wait, I don't think I have |
Possibly. It sets the |
On a related note, do you think you could help getting the magic for the type 2 (ELF+squashfs) AppImage format magic in? |
Oh yes, I can give it a try when I have time, shouldn't be harder than the other one :) |
@probonopd I need a type 2 test file (e.g. leafpad, like we did for type 1) Also, do you like |
@probonopd Since both mimetypes have the same glob pattern (*.appimage or *.AppImage), one of them necessarily will fail the "lookup by filename", and applications will need to check the magic value to resolve the ambiguity. Which one of the two appimage formats would you rather be the "default"? (i.e. the output mimetype when looking up an appimage only by filename). |
@elvisangelaccio good catch. Magic bytes should always override the filename extension, and the filename extension should point to type 1 (ISO9660) AppImage, since we expect all type 2 (squashfs) AppImages to have the correct magic bytes set. Still, as the magic bytes should always override the filename extension, a type 2 (squashfs) AppImage with the AppImage filename extension would correctly be identified as type 2. |
@elvisangelaccio any news on this? Should we also submit it for the |
We should also submit our magic numbers here: https://en.wikipedia.org/wiki/List_of_file_signatures |
@probonopd Not yet, I just pinged the freedesktop guy on the bugzilla ticket... |
@probonopd Oh, that was quick. Please let me know what do you think about https://bugs.freedesktop.org/show_bug.cgi?id=100608#c4 |
Looks like you're suggesting vnd.appimage as the MIME type for v2. That doesn't sound like a great idea, since there are going to be future versions of the AppImage specification You should rather introduce some versioned type, e.g. appimage.type2. The benefit of being able to distinguish between different types of AppImages for end user applications is so they can perform integrations like displaying the icon etc. which is a significantly different operation for different types of AppImages. |
Type 1 uses ISO9660 whereas type 2 is an entirely different format. They are described in the AppImageSpec. |
What about future versions of the spec (as pointed out by @TheAssassin)? Are we going to need a new mimetype every time? |
Yes, but we are not foreseeing changes to the spec that would require a type 3 for a very long time, since the type 2 spec is quite generic. |
Thank you @elvisangelaccio. |
Thanks @elvisangelaccio. I think I can close it safely now. |
What does "vnd" mean? Can we explain what is going on here? |
@probonopd |
ZOMG. AppImages are not "containerized", are they? |
Did you even bother looking this up on the Internet using a search engine? https://www.startpage.com/do/dsearch?query=mime+vnd&cat=web&pl=opensearch https://stackoverflow.com/questions/5351093/what-is-the-meaning-of-vnd-in-mime-types
|
Heh, so we are a "corporate body" now. Well, we are not an "Internet consortium" I guess. |
Hi,
do you have any plan about getting an "official" mimetype for .appimage files? Currently they are detected as executable files by the shared-mime-info database, which is fine. However there are use cases where a dedicated mimetype would be handy. For example, users of archiving tools like KDE's Ark or Gnome's file-roller may be interested in browsing the content of an appimage: https://bugs.kde.org/show_bug.cgi?id=363209
This new mimetype could inherit the
application/x-executable
mimetype, to express that appdata files are still executable files but they are also something more - e.g. they can be browsed with archiving tools.The text was updated successfully, but these errors were encountered: