Bug 99297

Summary: Add x-systemd-unit MIME type
Product: shared-mime-info Reporter: Philip Withnall <bugzilla>
Component: freedesktop.org.xmlAssignee: Shared Mime Info group <shared_mime_info>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: bugzilla, bugzilla, lennart, swilmet
Version: unspecified   
Hardware: All   
OS: All   
Whiteboard:
i915 platform: i915 features:
Attachments: Add x-systemd-unit MIME type
Add x-systemd-unit and x-dbus-service MIME types

Description Philip Withnall 2017-01-06 10:23:46 UTC
Patch attached, including tests.

See https://bugzilla.gnome.org/show_bug.cgi?id=776319 for the rationale.
Comment 1 Philip Withnall 2017-01-06 10:23:54 UTC
Created attachment 128791 [details] [review]
Add x-systemd-unit MIME type

This covers all types of systemd unit file, matching by filename and
magic string.
Comment 2 Lennart Poettering 2017-01-06 10:32:38 UTC
Looks good to me. But this could be tightened a bit I think. The section name must be followed by a newline, and must be following either a newline or the beginning of the file. Can the mime spec language express something like that?
Comment 3 Bastien Nocera 2017-01-06 10:39:35 UTC
Test doesn't pass:
0 errors, 1164 comparisons, 189 failed (189 expected), 1 unexpected successes

You should also add a D-Bus .service mime-type and test, as mentioned in https://bugzilla.gnome.org/show_bug.cgi?id=776319#c4
Comment 4 Philip Withnall 2017-01-09 09:13:35 UTC
Created attachment 128822 [details] [review]
Add x-systemd-unit and x-dbus-service MIME types

These cover all types of systemd unit file, and D-Bus services, matching
by filename and magic string.

They are added together as both use the .service extension, and hence
can be confused if only matched by name. Matching by content sniffing
disambiguates them, as they use different group headers.
Comment 5 Bastien Nocera 2017-01-09 11:15:04 UTC
Attachment 128822 [details] pushed as 46adfc5 - Add x-systemd-unit and x-dbus-service MIME types

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.