Subject: [media-types] Mime type for patch files?

From: Petter Reinholdtsen <[email-masked]>
Date: Wed, 31 Oct 2018 06:23:03 +0100

Hi,

I am new to this list, and hope I do not misunderstand its purpose.  I
would like to suggest a "new" mime type, and hope for your input on the
topic.

While testing a archive system on a subset of mails from the Debian
archive, I noticed the following unregistered MIME types on the top ten
list of MIME types used in the emails: text/x-patch and text/x-diff.

The fact that emailing patches as attachments is so popular make me
suspect it is time to register a MIME type for it.  But what type should
the suggested?  One of the above, or a new one without the x- prefix?

-- 
Happy hacking
Petter Reinholdtsen

---

From: Eric Prud'hommeaux <[email-masked]>
Date: Wed, 31 Oct 2018 06:26:56 -0400

* Petter Reinholdtsen <[email-masked]> [2018-10-31 06:23+0100]
> the suggested?  One of the above, or a new one without the x- prefix?

I think this negotiation must happen with the tool maintainers which
currently recognize text/x-{patch,diff}. Given that that's probably
impossible, the answer is almost certainly that you are stuck with
"x-". Thanks for picking this up.

I tried to answer your question but ended up puzzled by this text in
[RFC6838]:
[[
   Note that types with names beginning with "x-" are no longer
   considered to be members of this tree (see [RFC6648]).  Also note
   that if a generally useful and widely deployed type incorrectly ends
   up with an "x-" name prefix, it MAY be registered using its current
   name in an alternative tree by following the procedure defined in
   Appendix A.
]]

The only "x-" subtree in [IMT] is "x-www-form-urlencoded", and maybe
it's an exception. The tricky question is whether x-{diff,patch}
deserve the same exception. On one hand, we don't want a slippery
slope of exceptions, on the other hand, the tree's job is to document
current or achievable reality.

[RFC6838] https://tools.ietf.org/html/rfc6838#section-3.4
[IMT] https://www.iana.org/assignments/media-types/media-types.xhtml#application

-- 
-x-ericP

office: +1.617.599.3509
mobile: +33.6.80.80.35.59

([email-masked])
Feel free to forward this message to any list for any purpose other than
email address distribution.

There are subtle nuances encoded in font variation and clever layout
which can only be seen by printing this message on high-clay paper.

---

From: Petter Reinholdtsen <[email-masked]>
Date: Thu, 01 Nov 2018 07:42:36 +0100

[Eric Prud'hommeaux]
> "x-". Thanks for picking this up.

I have no idea how to identify the tool maintainers which currently
recognize text/x-{patch,diff}.  Perhaps at least the maintainers of
http://www.gnu.org/software/diffutils/ and
http://savannah.gnu.org/projects/patch/ are relevant contributors to
such discussion?  They do not really use or recognice MIME types, being
command line tools, but are responsible for the typical producer and
consumer of these files.

On Debian systems, text/x-patch and text/x-diff are set to be aliases
for each other, with text/x-patch being the primary one, according to
the /usr/share/mime/packages/freedesktop.org.xml file provided by the
shared-mime-info package.  I guess this provide one data point for
preferring text/x-patch over text/x-diff as the official MIME type.

Personally I would prefer to move to text/patch for the official MIME
type as diff produces a patch in text format, which I believe text/patch
expresses better than any of the alternatives.

I notice you mention application/*.  Is not text/* a better choice,
given that for example patches in emails could be shown directly in the
email and do not need a "viewer" to be readable to those of us receiving
patches?

-- 
Happy hacking
Petter Reinholdtsen