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

From: Clemens Ladisch <[email-masked]>
Date: Thu, 1 Nov 2018 09:58:05 +0100

Petter Reinholdtsen wrote:
> 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.

Pretty much all version control systems can generate patches.  However,
the default output typcially does not rely on MIME type detection but
uses custom formatting (in a GUI, or in HTML).  As far as I can see,
the only place where the MIME type might matter are e-mail attachments.

> 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?

As it happens, cgit deliberately returns "text/plain" (e.g.,
<http://git.savannah.gnu.org/cgit/patch.git/patch/?id=HEAD>).

Regards,
Clemens

---

From: Julian Reschke <[email-masked]>
Date: Thu, 1 Nov 2018 11:05:21 +0100

On 2018-11-01 09:58, Clemens Ladisch wrote:
> ...

FWIW, it would also be interesting for use as a payload in an HTTP PATCH 
request (see https://greenbytes.de/tech/webdav/rfc5789.html) - as far as 
I recall the big challenge here is not the label but to actually find a 
well-documented and interoperable patch format.

Best regards, Julian

---

From: Petter Reinholdtsen <[email-masked]>
Date: Thu, 01 Nov 2018 12:01:15 +0100

[Clemens Ladisch]
> the only place where the MIME type might matter are e-mail

It also matter for downloading from web sites and selecting files in a
Linux/unix file browsers, where the user can get a patch viewer instead
of a text editor. :)

> <http://git.savannah.gnu.org/cgit/patch.git/patch/?id=HEAD>).

While the Debian source service hand out patches
using 'text/x-diff', as can be seen from
<URL: https://sources.debian.org/data/main/c/conv-tools/20160905-1/debian/patches/autoreconf-buildable.patch >.

There is no doubt that both the mime types are in use, so the question
is really which one to choose as the official one, unless creating a new
one is better.  It will take time for a registered MIME type to gain
tracktion no matter which one we pick, but of course by picking one of
the used ones, we get a head start with existing users. :)

-- 
Happy hacking
Petter Reinholdtsen

---

From: Henrik Andersson <[email-masked]>
Date: Thu, 1 Nov 2018 13:23:04 +0100

Eric Prud'hommeaux skrev:
> 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
>
In short, don't use the "x-" prefix. And don't use the "x." prefix
either. Those explicitly mean "not registered". The mentioned exception
is a sad reality that only came to pass because of the insane costs to
change it. There are no such costs here.

---

From: Petter Reinholdtsen <[email-masked]>
Date: Thu, 01 Nov 2018 16:06:05 +0100

[Henrik Andersson]
> change it. There are no such costs here.

So, if I understand you correctly, your recommendation is to use
text/diff or text/patch as the official registered MIME type?  I am all
for a identifier with out the "x-" prefix. :-)

I notice from my collection that text/x-diff have 27% higher use than
text/x-patch.  If we are moving to a different identifier, I guess it do
not really matter which one of the old ones were most "popular". :)

-- 
Happy hacking
Petter Reinholdtsen

---

From: Julian Reschke <[email-masked]>
Date: Thu, 1 Nov 2018 16:17:15 +0100

> not really matter which one of the old ones were most "popular". :)

Make sure you have a well-defined payload format before discussing 
naming. Note that this also means thinking about character encoding...

---

From: "Eric Prud'hommeaux" <[email-masked]>
Date: Sat, 3 Nov 2018 09:32:53 -0400

> change it. There are no such costs here.

That depends on the levers we have available. I was assuming that we
can't change the
deployed media type to get rid of the "x-". It appears that some of
the tooling makes that not too problematic because it has
infrustructure for aliases. I'm all in favor of getting rid of "x-"
when possible. It's possible the right thing to do is to register all
four (or maybe only one of text/{diff,patch} and gradually migrate the
tooling (a non-trivial task as i've been seeing tools DTRT with
patches for decades). A dual registration reflects both current and
intended reality, which is arguably its purpose.
-- 
-ericP
office: +1.617.258.5741
mobile: +1.617.599.3509

---

From: Petter Reinholdtsen <[email-masked]>
Date: Mon, 05 Nov 2018 23:26:23 +0100

[Eric Prud'hommeaux]
> can't change the deployed media type to get rid of the "x-". It
> appears that some of the tooling makes that not too problematic
> because it has infrustructure for aliases. I'm all in favor of getting
> rid of "x-" when possible. It's possible the right thing to do is to
> register all four (or maybe only one of text/{diff,patch} and
> gradually migrate the tooling (a non-trivial task as i've been seeing
> tools DTRT with patches for decades). A dual registration reflects
> both current and intended reality, which is arguably its purpose.

I do not understand the way forward from here.  Can someone who know the
process bring some clarity?  Who make decisions?  Who are just making
comments on the sideline?  What am I supposed to do now to try to get a
registered mime type for patches?

-- 
Happy hacking
Petter Reinholdtsen