Bug 99672

Summary: PDF file with non-ASCII filename detected as Pascal source code
Product: Portland Reporter: Elvis Angelaccio <elvis.angelaccio>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED NOTOURBUG QA Contact:
Severity: normal    
Priority: medium CC: faure
Version: unspecified   
Hardware: Other   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Elvis Angelaccio 2017-02-04 10:39:00 UTC
From the downstream bug report: https://bugs.kde.org/show_bug.cgi?id=375956

Steps to reproduce:

# from the shared-mime-info git repo:
cd tests
cp text.pdf AİİA.pdf
xdg-mime query filetype AİİA.pdf

Expected output: application/pdf
Actual output: text/x-pascal

This happens with shared-mime-info 1.7
Comment 1 Bastien Nocera 2017-02-04 14:07:27 UTC
This is an implementation problem, not one in the database. It's probably a bug in xdg-mime or whatever underlying implementation it's using.
Comment 2 Bastien Nocera 2017-02-04 14:07:33 UTC
*** Bug 99673 has been marked as a duplicate of this bug. ***
Comment 3 Bastien Nocera 2017-02-04 14:07:38 UTC
*** Bug 99674 has been marked as a duplicate of this bug. ***
Comment 4 Elvis Angelaccio 2017-02-04 14:34:35 UTC
Should I reassign to the xdgmime product?

I'm also CC'ing David, since the same problem can be reproduced with QMimeDatabase.
Comment 5 Elvis Angelaccio 2017-02-12 10:07:00 UTC
Reassigning to xdgmime.
Comment 6 Bastien Nocera 2017-02-12 14:59:02 UTC
(In reply to Elvis Angelaccio from comment #5)
> Reassigning to xdgmime.

Wrong xdg-mime. The one you're running is a shell script that runs whatever. The one this was assigned to is a reference implementation of the mime spec. It's the shell script that's likely broken.
Comment 7 Rex Dieter 2017-02-12 15:11:25 UTC
Not a xdg-utils bug either,

$ kmimetypefinder5 AİİA.pdf 
text/x-pascal

xdg-mime relies in kmimetypefinder(5), reopening kde bug
Comment 8 Rex Dieter 2017-02-12 15:13:21 UTC
fwiw,  gio seems to get it right,

$ gio info AİİA.pdf | grep content-type
  standard::content-type: application/pdf
Comment 9 Elvis Angelaccio 2017-02-12 15:17:24 UTC
(In reply to Bastien Nocera from comment #6)
> (In reply to Elvis Angelaccio from comment #5)
> > Reassigning to xdgmime.
> 
> Wrong xdg-mime. The one you're running is a shell script that runs whatever.
> The one this was assigned to is a reference implementation of the mime spec.
> It's the shell script that's likely broken.

Turns out xdg-mime from xdg-utils relies on kmimetyefinder5 (thanks Rex), which is just a tiny wrapper over QMimeDatabase [1]. So this really looks like a bug in the Qt implementation.


[1]: https://cgit.kde.org/kde-cli-tools.git/tree/kmimetypefinder/kmimetypefinder.cpp
Comment 10 David Faure 2017-02-21 17:01:00 UTC
For the record: fixed in Qt -- https://bugreports.qt.io/browse/QTBUG-58822

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.