Bug 98823 - [Request] Please consider adding an ObjC++ type (as well as x-objchdr)
Summary: [Request] Please consider adding an ObjC++ type (as well as x-objchdr)
Status: RESOLVED MOVED
Alias: None
Product: shared-mime-info
Classification: Unclassified
Component: freedesktop.org.xml (show other bugs)
Version: unspecified
Hardware: All All
: medium enhancement
Assignee: Shared Mime Info group
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-11-22 20:32 UTC by René J.V. Bertin
Modified: 2018-10-13 10:39 UTC (History)
0 users

See Also:
i915 platform:
i915 features:


Attachments
patch that adds text/x-objc++src (3.73 KB, patch)
2016-11-22 20:32 UTC, René J.V. Bertin
Details | Splinter Review
a sample ObjC++ file, from the Qt 5.6.2 Cocoa platform plugin (78.88 KB, text/x-objc++src)
2016-11-23 07:53 UTC, René J.V. Bertin
Details
patch (4.23 KB, text/plain)
2016-11-23 12:44 UTC, René J.V. Bertin
Details

Description René J.V. Bertin 2016-11-22 20:32:33 UTC
Created attachment 128150 [details] [review]
patch that adds text/x-objc++src

There is currently no mime entry for ObjC++, a flavour of Objective C that is seeing increasing use in the context of using Qt and KDE applications on OS X (and iOS).

I'm attaching a patch which adds what I think is the minimum required information (though for some reason I seem to need to provide it in a separate file in the packages directory too).
Comment 1 Bastien Nocera 2016-11-23 00:24:06 UTC
Comment on attachment 128150 [details] [review]
patch that adds text/x-objc++src

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

This needs to be a git-formatted patch, with a test case. See the HACKING file for details.
Comment 2 René J.V. Bertin 2016-11-23 07:49:50 UTC
There is some kind of misunderstanding here.

This was supposed to be a wish-list/request ticket. I'll provide an ObjC++ file, but I do not currently have the time to go through a nitpicky review process for something that ought to be a simple copy/past with minor changes job that you can do in-house. The patch was only intended as a reference and a courtesy; if it puts people on the wrong foot I can remove it.

ObjC++ relates to C++ exactly in the way ObjC relates to C.
Comment 3 René J.V. Bertin 2016-11-23 07:53:48 UTC
Created attachment 128157 [details]
a sample ObjC++ file, from the Qt 5.6.2 Cocoa platform plugin
Comment 4 Bastien Nocera 2016-11-23 10:16:16 UTC
(In reply to René J.V. Bertin from comment #2)
> There is some kind of misunderstanding here.
> 
> This was supposed to be a wish-list/request ticket. I'll provide an ObjC++
> file, but I do not currently have the time to go through a nitpicky review
> process for something that ought to be a simple copy/past with minor changes
> job that you can do in-house. The patch was only intended as a reference and
> a courtesy; if it puts people on the wrong foot I can remove it.

The courtesy is me maintaining this software, I don't have time to spend 20 minutes on each person's patches, because 20 minutes times ...

Please provide the git formatted patch, or I'll close this bug.
Comment 5 René J.V. Bertin 2016-11-23 12:44:59 UTC
Created attachment 128161 [details]
patch

As requested.

I'll have learned my lesson.
Comment 6 Bastien Nocera 2016-11-23 12:56:52 UTC
Comment on attachment 128161 [details]
patch

That's nice of you to provide a git-formatted patch, but you didn't read the HACKING file:
- there's no need to add translations, those are merged from the .po files
- there's no test file, and tests/list isn't modified to include that file

Also make sure that "make check" passes.

Thanks.
Comment 7 René J.V. Bertin 2018-09-23 15:56:07 UTC
Almost 2 years later there's still no ObjC++ entry, so please consider adding one, plus an x-objchdr type for completeness.

I've removed my patch as far as that's possible because it was only ever intended as an example of something that seems to work when I add it (manually) to the packages directory.
Comment 8 René J.V. Bertin 2018-09-25 09:41:21 UTC
For the record:

I have tried to add the request test-case (to the current git/master/head), by

1) copying `simple-obj-c.m` to `simple-objc++.mm`
2) adding a line to `tests/list`:
```
simple-objc++.mm text/x-objc++src
```
3) adding the following to freedesktop.org.xml.in, after the entry for `x-objcsrc`
```
  <mime-type type="text/x-objc++src">
    <_comment>Objective-C++ source code</_comment>
    <sub-class-of type="text/x-c++src"/>
    <sub-class-of type="text/x-objcsrc"/>
    <magic priority="30">
      <match type="string" value="#import" offset="0"/>
    </magic>
    <glob pattern="*.mm"/>
  </mime-type>
```
4) installing xdgmime in the same parent.dir as the s-m-i source tree


Running `make check` gives the error that `simple-obj-c.m` is misinterpreted as `x-objc++src`. When I put the block from step 3) *before* the entry for `x-objcsrc` makes no difference. I get the opposite error when I also remove the magic code from the `x-objc++src` entry:
```
simple-objc++.mm, 'data' test: expected text/x-objc++src, got text/x-objcsrc
```

Suspicious I tried adding an equivalent test case for C++ by creating a file `simple-c++.cpp` containing a minimal valid C++ program. That gives exactly the same result:

```
simple-c++.cpp, 'data' test: expected text/x-c++src, got text/x-csrc
```

-----------------------
Two observations/conclusions:

- the existing test for ObjC is flawed and only succeeds because there is no confusion possible. The alternative conclusion might be that there is something seriously wrong with extension detection.
- C++ has no unittest, so why would I have to add one for ObjC++?
Comment 9 Bastien Nocera 2018-09-25 10:53:24 UTC
(In reply to René J.V. Bertin from comment #7)
> Almost 2 years later there's still no ObjC++ entry, so please consider
> adding one, plus an x-objchdr type for completeness.

See comment 6, I've been waiting for an updated patch.
Comment 10 GitLab Migration User 2018-10-13 10:39:06 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/xdg/shared-mime-info/issues/52.


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.