Stories
Slash Boxes
Comments

SoylentNews is people

posted by Fnord666 on Sunday November 04 2018, @07:39PM   Printer-friendly
from the application/patch dept.

Petter Reinholdtsen at the Skolelinux project has a very, very short blog post which simply asks if it is time for an official MIME type for patches and points to the mailing list proposed for such a discussion.

As part of my involvement in the Nikita archive API project, I've been importing a fairly large lump of emails into a test instance of the archive to see how well this would go. I picked a subset of my notmuch email database, all public emails sent to me via @lists.debian.org, giving me a set of around 216 000 emails to import. In the process, I had a look at the various attachments included in these emails, to figure out what to do with attachments, and noticed that one of the most common attachment formats do not have an official MIME type registered with IANA/IETF. The output from diff, ie the input for patch, is on the top 10 list of formats included in these emails. At the moment people seem to use either text/x-patch or text/x-diff, but neither is officially registered. It would be better if one official MIME type were registered and used everywhere.

What do Soylentils have to say for or against designating a specific MIME type for software patches? Which details need to be addressed and would there be any pitfalls?


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
(1)
  • (Score: 5, Insightful) by tibman on Sunday November 04 2018, @08:33PM (9 children)

    by tibman (134) Subscriber Badge on Sunday November 04 2018, @08:33PM (#757719)

    IMO, the MIME type could just be text/plain. Because MIME type is primarily used for moving the files via email and web. It has almost zero use outside that. The mime type even exists externally to the file itself. Text/plain moves the file just fine. Does it accurately describe the contents? No. Does that matter? No. Registering an official MIME type won't improve anyone's experience or correct any software issue. Everyone will still continue to use whatever MIME type they like. Text/x-patch and text/x-diff are perfectly fine even if the standards body hates them.

    In theory the MIME type can also notify the email client / web browser into which program should be used to open that file. Right now a mixture of file extension and MIME type is used. I'd personally rather avoid having to speak with a standards body and use text/plain with a .patch or .diff file extension. This lets your email viewer display the file perfectly fine as text and opening it will use the program locally registered for the file extension.

    --
    SN won't survive on lurkers alone. Write comments.
    • (Score: 2, Insightful) by Anonymous Coward on Sunday November 04 2018, @08:58PM (1 child)

      by Anonymous Coward on Sunday November 04 2018, @08:58PM (#757726)

      By that logic I assume you'd like us to get rid of all MIME types? But remember just because you have no obvious use for something doesn't mean it's useless.

      • (Score: 4, Insightful) by tibman on Sunday November 04 2018, @10:07PM

        by tibman (134) Subscriber Badge on Sunday November 04 2018, @10:07PM (#757746)

        If you have a file on your system and you're only using that file on your system then MIME type is 100% useless to you. It only matters when you are transferring the file over the internet via web technologies like email, ftp, http, and so on. That mime type is GUESSED from the file's contents and extension. All that should matter to you is that the file you attached arrives at the destination exactly as you sent it. Forcing each application to register a different encoding scheme is a bit silly. That's why the unregistered text/x-patch was used. x- was a sub-type that let anyone define whatever they wanted. The standards body didn't like that and now all unregistered usage is "discouraged". Guess what everyone did? ignored them and kept using x- mime types.

        I'm not suggesting MIME type is useless. I'm saying it really doesn't matter in this case.*

        *as long as the major encoding type is correct for the file.

        --
        SN won't survive on lurkers alone. Write comments.
    • (Score: 2) by c0lo on Sunday November 04 2018, @09:17PM (2 children)

      by c0lo (156) Subscriber Badge on Sunday November 04 2018, @09:17PM (#757729) Journal

      This lets your email viewer display the file perfectly fine as text and opening it will use the program locally registered for the file extension.

      But.. without the MIME type, how would Outlook know how to automagically apply the patch for you?

      (grin)

      --
      https://www.youtube.com/watch?v=aoFiw2jMy-0 https://soylentnews.org/~MichaelDavidCrawford
      • (Score: 2) by RamiK on Sunday November 04 2018, @09:58PM (1 child)

        by RamiK (1813) on Sunday November 04 2018, @09:58PM (#757739)

        This is one of the best features of patchwork [github.com]: It picks up patches off the mailing list and builds them automatically with a continuous integration service. Then it replies to the patch message with the results.

        Outlook wise, there add-ins hooking up to git apply and git diff that can be automated to do exactly what you described on a build server that I wouldn't be surprised to find some Windows build server is actually using somewhere.

        (stiff upper lip)

        --
        compiling...
        • (Score: 4, Funny) by tibman on Sunday November 04 2018, @10:37PM

          by tibman (134) Subscriber Badge on Sunday November 04 2018, @10:37PM (#757758)

          Looks like they use text/plain : D

          --
          SN won't survive on lurkers alone. Write comments.
    • (Score: 2, Touché) by Anonymous Coward on Sunday November 04 2018, @09:51PM (2 children)

      by Anonymous Coward on Sunday November 04 2018, @09:51PM (#757735)

      I'd personally rather avoid having to speak with a standards body and use text/plain with a .patch or .diff file extension.

      I must have missed the part in TFA where you were assigned the responsibility of shepherding the proposed MIME type through the approval process.

      Everyone will still continue to use whatever MIME type they like. Text/x-patch and text/x-diff are perfectly fine even if the standards body hates them.

      Well, if/when the new MIME type is approved then you can continue to use whatever MIME type you want.

      • (Score: 2) by tibman on Sunday November 04 2018, @10:36PM (1 child)

        by tibman (134) Subscriber Badge on Sunday November 04 2018, @10:36PM (#757756)

        I must have missed the part in TFA where you were assigned the responsibility of shepherding the proposed MIME type through the approval process.

        Sorry if i made it sound like i was a "somebody" in this article. I'm not involved. This is just my opinion. Petter Reinholdtsen could of course pursue adding a registered MIME type for diff. It would be great to get everyone on the same page. I just think that there is really no issue here that someone should spend time correcting.

        Well, if/when the new MIME type is approved then you can continue to use whatever MIME type you want.

        That will be true for every single web browser, FTP client, email client, and "web based" file transfer tool. Not a quick thing! Though most software developers use 3rd-party libraries that perform the file extension lookup for them. Basically a dictionary of extensions and mime types. The fallback is usually application/octet-stream for situations where the extension is unknown or missing. The file will still transfer just fine : )

        --
        SN won't survive on lurkers alone. Write comments.
        • (Score: 0) by Anonymous Coward on Sunday November 04 2018, @11:25PM

          by Anonymous Coward on Sunday November 04 2018, @11:25PM (#757773)

          The file will still transfer just fine : )

          The same is true for all MIME types.

          You don't like the idea. We get it. But the author of the article recommending this new MIME type analyzed 216k emails that he received (email is something you say this is only good for) and this would be in the top 10 of all attachment types. Clearly there is a use case outside of your personal needs and/or experiences.

          Go ahead and ask yourself "are there any other common standards, protocols, document types, processes, tools or software that I don't use that others do?" If the answer is yes, should those never have been established or developed?

          There are plenty of workarounds or compromises that can be made regarding technology. Why bother with making anything new if doing it the old way will be "just fine"?

    • (Score: 3, Funny) by MichaelDavidCrawford on Sunday November 04 2018, @11:28PM

      by MichaelDavidCrawford (2339) Subscriber Badge <mdcrawford@gmail.com> on Sunday November 04 2018, @11:28PM (#757776) Homepage Journal

      "Because they want a MIME Type for patches and diffs. We don't."

      --
      Yes I Have No Bananas. [gofundme.com]
  • (Score: -1, Troll) by Anonymous Coward on Sunday November 04 2018, @10:31PM (2 children)

    by Anonymous Coward on Sunday November 04 2018, @10:31PM (#757754)

    Bad actors will be able to patch your machine just by sending you email? That idea is so laughably insecure that I have to wonder if the Petter Reinholdtsen actually works for Micrisoft.

    • (Score: 0) by Anonymous Coward on Sunday November 04 2018, @11:29PM (1 child)

      by Anonymous Coward on Sunday November 04 2018, @11:29PM (#757777)

      Hmm ... me thinks you don't understand what this is about. Those "bad actors" would have to merge the patch into the existing source on the recipient's system (or maybe even pull the source), compile it and deploy it. If they can do that then I think we all have bigger problems to worry about.

      • (Score: 0) by Anonymous Coward on Monday November 05 2018, @12:28AM

        by Anonymous Coward on Monday November 05 2018, @12:28AM (#757792)

        > merge the patch into the existing source on the recipient's system (or maybe even pull the source), compile it and deploy it
        >> works for Micrisoft

        I think gp understood fine...

  • (Score: 1, Funny) by Anonymous Coward on Sunday November 04 2018, @11:35PM (3 children)

    by Anonymous Coward on Sunday November 04 2018, @11:35PM (#757779)

    what's the mime type for submitting a request for a mime type?

    • (Score: 1, Funny) by Anonymous Coward on Monday November 05 2018, @12:25AM (1 child)

      by Anonymous Coward on Monday November 05 2018, @12:25AM (#757790)

      I think it's mime-mime-mime-sharona

      • (Score: 1, Funny) by Anonymous Coward on Monday November 05 2018, @12:41AM

        by Anonymous Coward on Monday November 05 2018, @12:41AM (#757795)

        LOL mime art will go on

    • (Score: 1, Informative) by Anonymous Coward on Monday November 05 2018, @02:21AM

      by Anonymous Coward on Monday November 05 2018, @02:21AM (#757816)

      Just in case anyone else gets curious, the IANA website uses a form that submits as application/x-www-form-urlencoded which gets changed into a multipart/mixed email containing a text/plain subpart and an application/xml subpart.

  • (Score: 5, Interesting) by FatPhil on Monday November 05 2018, @12:38AM (1 child)

    by FatPhil (863) <reversethis-{if.fdsa} {ta} {tnelyos-cp}> on Monday November 05 2018, @12:38AM (#757794) Homepage
    there's no "diff" or "patch" format, there are several. Do we just standardise on the particular choices git made? Why should ed scripts be left out?
    --
    Great minds discuss ideas; average minds discuss events; small minds discuss people; the smallest discuss themselves
    • (Score: 3, Informative) by darkfeline on Tuesday November 06 2018, @04:15AM

      by darkfeline (1030) on Tuesday November 06 2018, @04:15AM (#758371) Homepage

      ed scripts are abhorrent and a security vulnerability. diff -u a/b is the de facto standard used by everyone. Git didn't make it the standard, Git used it because it was the standard.

      http://rachelbythebay.com/w/2018/04/05/bangpatch/ [rachelbythebay.com]

      --
      Join the SDF Public Access UNIX System today!
  • (Score: 2) by Bot on Monday November 05 2018, @12:43AM

    by Bot (3902) on Monday November 05 2018, @12:43AM (#757797) Journal

    "Petter Reinholdtsen at the Skolelinux"

    Are meatbags even able to read this aloud without knotting up their tongue? I DON'T THINK SO

    --
    Account abandoned.
  • (Score: 1) by Some call me Tim on Monday November 05 2018, @02:38AM

    by Some call me Tim (5819) on Monday November 05 2018, @02:38AM (#757823)

    I'll admit I know very little about the MIMEs you all are talking about but I knew a lady who tried to keep one for a pet. Dumber than a box of floppies I tell ya.

    --
    Questioning science is how you do science!
  • (Score: 3, Insightful) by Anonymous Coward on Monday November 05 2018, @07:12AM

    by Anonymous Coward on Monday November 05 2018, @07:12AM (#757881)

    MIME is an incompatible mess designed by committee. At the time, the situation was:

    1. Apple filesystems had weird type and creator codes that nobody else supported.
    2. Everybody else used file extensions.

    Apple wouldn't sign off on file extensions, so instead we get something new. Trouble is, file extensions wouldn't go away. Apple even caved; it is now normal to use file extensions on MacOS X.

    We have a crazy situation now. It works like this:

    1. There is just a file extension. Only that can be used.
    2. We want to send the file via email or web, which requires a MIME type, so we generate one from the file extension.
    3. The recipient is required to use the MIME type instead of the file extension.
    4. The recipient saves the file into the filesystem, forgetting the MIME type.
    5. There is just a file extension. Only that can be used.

    What ever was the point?

    This causes trouble. Files effectively change type as they are saved. This may cause the software to display them differently.

(1)