Bug 99421 - [PATCH] Add model/stl-binary and application/x-gcode
Summary: [PATCH] Add model/stl-binary and application/x-gcode
Status: RESOLVED FIXED
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: freedesktop.org.xml (show other bugs)
Version: unspecified
Hardware: Other All
: medium normal
Assignee: Shared Mime Info group
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2017-01-15 17:35 UTC by Miro Hrončok
Modified: 2018-06-16 10:49 UTC (History)
3 users (show)

See Also:
i915 platform:
i915 features:


Attachments
[PATCH 1/3] STL 3D models, ASCII and binary (5.96 KB, patch)
2017-01-15 17:35 UTC, Miro Hrončok
Details | Splinter Review
[PATCH 2/3] Update STL specification (2.12 KB, patch)
2017-01-15 17:36 UTC, Miro Hrončok
Details | Splinter Review
[PATCH 3/3] Add G-code specification (13.29 KB, patch)
2017-01-15 17:36 UTC, Miro Hrončok
Details | Splinter Review
[PATCH 1/2] Add STL 3D models, ASCII and binary (5.94 KB, patch)
2017-01-16 10:34 UTC, Miro Hrončok
Details | Splinter Review
[PATCH 2/2] Add G-code specification (13.17 KB, patch)
2017-01-16 10:34 UTC, Miro Hrončok
Details | Splinter Review
[PATCH] Add STL 3D models, ASCII and binary and GCODEs (18.48 KB, patch)
2017-01-16 22:06 UTC, Miro Hrončok
Details | Splinter Review
Add mime-type for STL 3D models and GCODE (18.58 KB, patch)
2017-01-18 12:01 UTC, Bastien Nocera
Details | Splinter Review
The first 300 bytes of Win10_1709_Chinese(Traditional)_x64.iso (300 bytes, application/octet-stream)
2017-11-12 11:35 UTC, V字龍(Vdragon)
Details

Description Miro Hrončok 2017-01-15 17:35:45 UTC
Created attachment 128968 [details] [review]
[PATCH 1/3] STL 3D models, ASCII and binary

Those are common file formats for 3D printing with RepRap-like desktop FDM 3D printers. Used by multiple applications, so not 1-app specific.

See https://github.com/kliment/Printrun/issues/796 for context.

Authored by me and Rock Storm, split into 3 commits for authorship and stl/gcode separation.

Git repo with those patches can be found at https://github.com/hroncok/shared-mime-info-3dprint
Comment 1 Miro Hrončok 2017-01-15 17:36:08 UTC
Created attachment 128969 [details] [review]
[PATCH 2/3] Update STL specification
Comment 2 Miro Hrončok 2017-01-15 17:36:34 UTC
Created attachment 128970 [details] [review]
[PATCH 3/3] Add G-code specification
Comment 3 Bastien Nocera 2017-01-16 03:25:17 UTC
Comment on attachment 128969 [details] [review]
[PATCH 2/3] Update STL specification

Review of attachment 128969 [details] [review]:
-----------------------------------------------------------------

Please merge into the previous patch.

::: freedesktop.org.xml.in
@@ +6930,4 @@
>    </mime-type>
>  
>    <!-- 3D models and GCODEs -->
> +  <mime-type type="model/stl-binary">

If this mime-type is registered, add a link to the registration in the commit message, otherwise use:
model/vnd.stl-binary

@@ +6934,3 @@
>      <_comment>STL 3D model (binary)</_comment>
> +    <acronym>STL</acronym>
> +    <expanded-acronym>STereoLithography</expanded-acronym>

Not an acronym, you can remove that.

@@ +6938,5 @@
>      <generic-icon name="binary"/>
>      <glob pattern="*.stl"/>
>    </mime-type>
>  
> +  <mime-type type="model/stl-ascii">

Ditto.

::: tests/list
@@ +600,4 @@
>  test-secret-key.skr application/pgp-keys ooo
>  test-secret-key.asc application/pgp-keys xoo
>  
> +<<<<<<< HEAD

That's really not supposed to be here.
Comment 4 Bastien Nocera 2017-01-16 03:25:47 UTC
Comment on attachment 128970 [details] [review]
[PATCH 3/3] Add G-code specification

Review of attachment 128970 [details] [review]:
-----------------------------------------------------------------

::: freedesktop.org.xml.in
@@ +6956,5 @@
> +    <_comment>G-code file</_comment>
> +    <sub-class-of type="text/plain"/>
> +    <generic-icon name="text-x-generic"/>
> +    <magic priority="10">
> +      <match type="string" value=";" offset="0"/>

The magic is far too short, remove it.
Comment 5 Miro Hrončok 2017-01-16 10:34:43 UTC
Created attachment 128977 [details] [review]
[PATCH 1/2] Add STL 3D models, ASCII and binary
Comment 6 Miro Hrončok 2017-01-16 10:34:59 UTC
Created attachment 128978 [details] [review]
[PATCH 2/2] Add G-code specification
Comment 7 Miro Hrončok 2017-01-16 10:36:22 UTC
Thanks for the feedback and the <<<<<<< HEAD catch (sorry about that, must have lost it while rebasing). Attached new set of patches (only 2 this time).
Comment 8 Bastien Nocera 2017-01-16 11:44:39 UTC
Comment on attachment 128977 [details] [review]
[PATCH 1/2] Add STL 3D models, ASCII and binary

Review of attachment 128977 [details] [review]:
-----------------------------------------------------------------

::: freedesktop.org.xml.in
@@ +6932,5 @@
> +  <!-- 3D models and GCODEs -->
> +  <mime-type type="model/vnd.stl-binary">
> +    <_comment>STL 3D model (binary)</_comment>
> +    <sub-class-of type="application/octet-stream"/>
> +    <generic-icon name="binary"/>

This in an invalid value:
./freedesktop.org.xml:39757: element generic-icon: validity error : Value "binary" for attribute name of generic-icon is not among the enumerated set
    <generic-icon name="binary"/>

See how to run the test suite in the HACKING file.
Comment 9 Bastien Nocera 2017-01-16 11:44:56 UTC
More test suite:
binary.stl, 'data' test: expected model/vnd.stl-binary, got text/plain
ascii.stl, 'name' test: expected model/vnd.stl-ascii, got model/vnd.stl-binary
binary.stl, 'name' test: expected model/vnd.stl-ascii, got model/vnd.stl-binary
binary.stl, 'file' test: expected model/vnd.stl-ascii, got model/vnd.stl-binary
ascii.stl, 'file' test: expected model/vnd.stl-binary, got model/vnd.stl-ascii
test.gcode, 'data' test: expected application/x-gcode, got text/plain
0 errors, 1188 comparisons, 203 failed (197 expected)
Comment 10 Miro Hrončok 2017-01-16 22:06:23 UTC
Created attachment 128989 [details] [review]
[PATCH] Add STL 3D models, ASCII and binary and GCODEs

Alright. Now the tests should pass.
Comment 11 Bastien Nocera 2017-01-18 12:01:22 UTC
Created attachment 129022 [details] [review]
Add mime-type for STL 3D models and GCODE

with help from Miro Hrončok <miro@hroncok.cz>
Comment 12 Bastien Nocera 2017-01-18 12:02:27 UTC
Attachment 129022 [details] pushed as 13f6032 - Add mime-type for STL 3D models and GCODE
Comment 13 Bastien Nocera 2017-01-18 12:04:29 UTC
Note that I changed the mime-types, after doing a bit more research into the registration trees. We can only use vnd when there is a registered vendor.
Comment 14 Miro Hrončok 2017-01-18 12:25:29 UTC
Thank You Bastien for your reviews and changes.
Comment 15 V字龍(Vdragon) 2017-11-10 13:09:32 UTC
Hello, one of our members using Archlinux noticed that the Windows 10 installation ISO is wrongly detected as model/stl-binary in KDE DolphinFM(kmimetypefinder5), I wonder if the cause is on the overly ambiguous magic of this mime-type?
Comment 16 Rock Storm 2017-11-10 21:51:49 UTC
(In reply to V字龍(Vdragon) from comment #15)
> Hello, one of our members using Archlinux noticed that the Windows 10
> installation ISO is wrongly detected as model/stl-binary in KDE
> DolphinFM(kmimetypefinder5), I wonder if the cause is on the overly
> ambiguous magic of this mime-type?

Hi, this is really interesting. If it has the file extension '.iso' it should have never been recognized as an STL. Could you share this file? Or at least the first, say 300, bytes? Thanks.
Comment 17 V字龍(Vdragon) 2017-11-12 11:35:56 UTC
Created attachment 135423 [details]
The first 300 bytes of Win10_1709_Chinese(Traditional)_x64.iso
Comment 18 V字龍(Vdragon) 2017-11-12 11:37:15 UTC
(In reply to Rock Storm from comment #16)
> Hi, this is really interesting. If it has the file extension '.iso' it
> should have never been recognized as an STL. Could you share this file? Or
> at least the first, say 300, bytes? Thanks.

The head of the file is all 0x0 until offset 0x8000
Comment 19 V字龍(Vdragon) 2017-11-12 11:39:46 UTC
This file can be downloaded from https://www.microsoft.com/en-US/software-download/windows10ISO by selecting "Chinese Traditional" in the "Select the product language"
Comment 20 Theo 2018-05-12 13:10:30 UTC
(In reply to Rock Storm from comment #16)
> If it has the file extension '.iso' it
> should have never been recognized as an STL. Could you share this file?
This is what I get on a latest openSUSE Tumbleweed for any ISO image:

$ XDG_UTILS_DEBUG_LEVEL=1 xdg-mime query filetype image.iso
Running kmimetypefinder5 "/home/user/image.iso"
model/x.stl-binary

$ kmimetypefinder5 image.iso
model/x.stl-binary

$ kmimetypefinder5 -f image.iso
application/zip

$ kmimetypefinder5 --version
kmimetypefinder 5.12.4
Comment 21 Theo 2018-05-12 13:16:55 UTC
(In reply to Theo from comment #20)
> $ kmimetypefinder5 -f image.iso
> application/zip
That's a copy and paste mistake. It should read

$ kmimetypefinder5 -f image.iso
application/x-cd-image
Comment 22 Theo 2018-06-16 00:55:38 UTC
Reopened because this patch has apparently broken the detection of ISO 9660 image files as reported first in comment #15 seven months ago.
Comment 23 Bastien Nocera 2018-06-16 10:49:45 UTC
(In reply to Theo from comment #22)
> Reopened because this patch has apparently broken the detection of ISO 9660
> image files as reported first in comment #15 seven months ago.

Which was already fixed in the patch from bug 106330.


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.