← Back to team overview

registry team mailing list archive

[Bug 99736] Re: Over-optimistic detection of file type

 

Launchpad has imported 9 comments from the remote bug at
http://bugs.freedesktop.org/show_bug.cgi?id=2359.

If you reply to an imported comment from within Launchpad, your comment
will be sent to the remote bug automatically. Read more about
Launchpad's inter-bugtracker facilities at
https://help.launchpad.net/InterBugTracking.

------------------------------------------------------------------------
On 2005-01-23T09:03:26+00:00 Vincent Untz wrote:

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.

Reply at: https://bugs.launchpad.net/shared-mime/+bug/99736/comments/0

------------------------------------------------------------------------
On 2005-04-16T13:07:29+00:00 Christophe Fergeau wrote:

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 :)

Reply at: https://bugs.launchpad.net/shared-mime/+bug/99736/comments/1

------------------------------------------------------------------------
On 2006-07-09T03:43:45+00:00 Bastien Nocera wrote:

$ echo "P1" > foo
$ file foo
foo: Netpbm PBM image text

Should we leave this bug opened?

Reply at: https://bugs.launchpad.net/shared-mime/+bug/99736/comments/2

------------------------------------------------------------------------
On 2008-01-11T02:36:55+00:00 Benjamin-close wrote:

Bugzilla Upgrade Mass Bug Change

NEEDSINFO state was removed in Bugzilla 3.x, reopening any bugs
previously listed as NEEDSINFO.

  - benjsc
    fd.o Wrangler

Reply at: https://bugs.launchpad.net/shared-mime/+bug/99736/comments/5

------------------------------------------------------------------------
On 2008-02-05T14:10:57+00:00 Daniel Leidert wrote:

(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.

Reply at: https://bugs.launchpad.net/shared-mime/+bug/99736/comments/6

------------------------------------------------------------------------
On 2008-02-05T14:29:27+00:00 Daniel Leidert wrote:

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.

Reply at: https://bugs.launchpad.net/shared-mime/+bug/99736/comments/7

------------------------------------------------------------------------
On 2008-02-28T09:15:17+00:00 Sense Hofstede wrote:

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."

Reply at: https://bugs.launchpad.net/shared-mime/+bug/99736/comments/8

------------------------------------------------------------------------
On 2008-06-11T10:25:43+00:00 Bastien Nocera wrote:

(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

Reply at: https://bugs.launchpad.net/shared-mime/+bug/99736/comments/10

------------------------------------------------------------------------
On 2010-06-26T08:25:12+00:00 Nunojsilva wrote:

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).

Reply at: https://bugs.launchpad.net/shared-mime/+bug/99736/comments/13


** Changed in: shared-mime
   Importance: Unknown => Medium

-- 
Over-optimistic detection of file type
https://bugs.launchpad.net/bugs/99736
You received this bug notification because you are a member of Registry
Administrators, which is the registrant for shared-mime.