TDE incorrectly assigns mimetype application/octet-stream to text file #211
Κλειστό
ανοίχτηκε 1 έτος πριν από VinceR
·
11 σχόλια
Φόρτωση…
Αναφορά σε νέο ζήτημα
Δεν υπάρχει ακόμα περιεχόμενο.
Διαγραφή του Κλάδου '%!s(<nil>)'
Η διαγραφή του κλάδου είναι μόνιμη. ΔΕΝ ΜΠΟΡΕΙ να αναιρεθεί. Συνέχεια;
Problem illustration
The problem was detected in system running branch master (commit
6c8b373f34943b76845e0de979d76f9344bf25bb) andfile-5.44.The problem did not manifest on system running branch master (commit
cc4de7a3cc20aab13430bad461a4e1e35cca794dandfile-5.43.Problem is similar to one I reported in 2016 that was fixed in commit
f54496a1f2d99bea12af3db999a53515109f99a3The attached sample file will need to be renamed
sample.ebuild.txt=>sample.ebuildto illustrate the problem - gitea did not allow me to attach it with the original name, which sounds like another example of not correctly identifying a text file :)Thanks @VinceR, I can replicate the issue here.
Do you want to work on a fix yourself of should we take a look instead?
Since this is terra incognita for me, I think it would be best if somebody else started on this. At first glance, I didn't really understand the solution to the 2016 problem.
But since I am a stakeholder (I work with this file type a lot), I would be willing to learn from others as to how tackle such problems in the future.
For instance, I am now curious: for file type identification, when is TDE relying on its legacy
mimelnkfiles, and when does it turnxdg-mime? andlibmagic.so(fromfile)? What is the order of query?It's terra incognita for me too at the moment, but will have a look between here and R14.1.1 release and see if I can come up with a fix. Currently I don't have an answer for your questions above, but once I go through the code I should be able to clear some of those questions.
I would say that it certainly does not depend on the commits in tdelibs, but on the version of
file.Here is one long-term problem that identification instead of mime types defined in the system
/usr/share/mimedepends on the mime types defined in TDE/opt/trinity/share/mimelnk. Iffileidentification (libmime) returns a type that is not defined in TDE, it is displayed as unknown (application/octet-stream). And this is exactly the case of ebuilds.Therefore, there are two possible (gradual) solutions:
See also:
https://bugs.trinitydesktop.org/show_bug.cgi?id=2392#c7
https://bugs.trinitydesktop.org/show_bug.cgi?id=2564
Thanks for the additional info Slavek.
I think we can do a quick fix for ebuild type, but we should look at proper solution for future. This is likely to require API changes, so that would go into R14.2.0, but the quick ebuild fix can go into R14.1.1.
What do you think?
Yes, quick fix we can do quickly and will be applicable to R14.1.x branch. For the future thorough solution we decide on the possibility of backporting into a stable branch, depending on how we implement it.
Issue #213 created to track the long term issue, while this issue will be closed once PR #212 is merged.
Thank you @SlavekB and @MicheleC for your feedback and fix!
In retrospect, it looks like
file-43had identified these files astext/plainbutfile-44identified them asapplication/vnd.gentoo.ebuild. In both cases, the identification was based on input from Gentoo developers tofileas evidenced by the un-compiled magic file/usr/share/misc/magic/gentoo.I am not sure. but I speculate that TDE rejected the latest result of calling
magic_file()because there was no mimelnk file associated with with the returned mime type. If that's the case, maybe changing the code to accept a non-null return result of this call "as is" instead of assumingapplication/octet-stream.When I filed this bug, I had a false memory that TDE was already using XDG Mime for name-based file type identification. I later realized that I was using a Perl script that I created to supplement
$TDEDIR/share/mimelinkgenerated from information in/usr/share/mime. Perhaps something like this script can offer a way to automate the generation of TDE mimelnk files fromupdate-mime-databaseartifacts and un-compiledlibmagicmagic file definitions.Hi @VinceR,
thanks for the extra info. We will see what is the best way to fix mime detection, definetely using system mime types is the way forward. Issue #213 is open to remind that for us and we will definitely fix for R14.2.0 because it is an important part. Perhaps even backport to R14.1.x if the changes are compatible somehow.
Leave the returned result as is is a problem, because according to the known mime type TDE gets information on what actions can be offered for a given type of file. If the type is unknown, it will have the same result as an
application/octet-stream. That is why we need to solve to become a known file type. And that's why it will be useful to load information from XML files in the system instead of converting to desktop files specific to TDE.This was fixed by PR #212. Issue #213 tracks the issue of switching to a better mime detection system.