I have a text file that begins with "TP1" (you can create one with just these three characters). When double-clicking on it in nautilus, it tells me that the filename suggests it's a text file but the file content suggests it's a portable bitmap file. The "file" command recognizes the file as ASCII text.
So, this was indeed a mismatch, I committed a fix to xdgmime CVS, but now it will identify files beginning with P1 as portable bitmap files, I guess you won't consider this bug as fixed in a satisfactory way :)
$ echo "P1" > foo $ file foo foo: Netpbm PBM image text Should we leave this bug opened?
Bugzilla Upgrade Mass Bug Change NEEDSINFO state was removed in Bugzilla 3.x, reopening any bugs previously listed as NEEDSINFO. - benjsc fd.o Wrangler
(In reply to comment #0) > I have a text file that begins with "TP1" (you can create one with just these > three characters). When double-clicking on it in nautilus, it tells me that the > filename suggests it's a text file but the file content suggests it's a portable > bitmap file. Hm. ATM in fast detection its detected as application/octet-stream by gnomevfs-info. If it would be detected as text/plain, then gnomevfs shouldn't detect it as image/x-portable-bitmap. I'm not sure if the problem can be solved in the shared-mime-info database. IMO there are two alternatives: 1) remove the magic from image/x-portable-bitmap (no conflicting global pattern) or b) forward this to the upstream of gnomevfs and kdemime and check, if some better heuristics between text/plain and application/octet-stream can solve this problem.
Hm. After reading some more about the formats, it should also be possible to extend the graphics a bit to be P1\x0a# (offset: 0) so the magic includes the (possible) comment in line 2, although this comment is not required. But it is less generic than just searching for P1..7.
This bug has also been reported in launchpad for PBM images by Tom Womack: https://bugs.edge.launchpad.net/ubuntu/+source/shared-mime-info/+bug/99736 He said: "I have a text file which begins 'P13438 = 2 * 3 * 7 * 1047137401 * 8868717860281682366053088136263931781236052676953 * 37740643638981149828904962487908210028313437770048087043525652181' - it's a list of factorizations of partition numbers. For some reason nautilus thinks this is a PBM image, and won't by default open it with gedit. I think that files which claim to be text files should be opened with the text editor whether or not nautilus thinks they are text files."
(In reply to comment #5) > Hm. After reading some more about the formats, it should also be possible to > extend the graphics a bit to be > > P1\x0a# (offset: 0) > > so the magic includes the (possible) comment in line 2, although this comment > is not required. But it is less generic than just searching for P1..7. Seems like the best option. A magic of 2 characters is just too short... * freedesktop.org.xml.in: Tighten the magic for PBM, PPM and PGM types, so as to avoid false positives (Closes: #2359) * tests/list: * tests/test.pbm: Add a pbm test file
Some image viewers, which rely on gtk+ to show images, are unable to show portable anymaps. gtk+ seems to rely on freedesktop.org.xml for file type detection, which fails for some anymaps. Removing the lines about # solves this, and here "man 5 ppm" does not say a comment is needed (although it can exist).
Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.