{"thread":{"id":"43069","subject":"Re: [PATCH] Allow hand-editing of patches before sending","startedAt":"2006-11-01T09:00:46Z","lastAt":"2006-11-05T19:04:00Z","messageCount":31,"participants":["Catalin Marinas","Andy Whitcroft","Karl Hasselström","Andreas Ericsson","Petr Baudis","Linus Torvalds","Junio C Hamano","Robin Rosenberg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"294354","messageId":"20061101090046.1107.81105.stgit@localhost","threadId":"43069","inReplyTo":null,"subject":"[PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-01T09:00:46Z","receivedAt":"2006-11-01T09:00:46Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"From: Karl Hasselström <kha@treskal.com>\n\nThis adds a new flag to 'stg mail', allowing the user to hand-edit\neach patch e-mail before it is sent, just like it is currently\npossible to edit the cover message.\n\nSigned-off-by: Karl Hasselström <kha@treskal.com>\n---\n\nIntended use is to allow the user to write comments like this, when\nthere is only one patch and a cover mail would be overkill.\n\n stgit/commands/mail.py |   59 ++++++++++++++++++++++++++++--------------------\n 1 files changed, 35 insertions(+), 24 deletions(-)\n\ndiff --git a/stgit/commands/mail.py b/stgit/commands/mail.py\nindex 970ae3e..26c711d 100644\n--- a/stgit/commands/mail.py\n+++ b/stgit/commands/mail.py\n@@ -108,6 +108,9 @@ options = [make_option('-a', '--all',\n            make_option('-e', '--edit',\n                        help = 'edit the cover message before sending',\n                        action = 'store_true'),\n+           make_option('-E', '--edit-patches',\n+                       help = 'edit each patch before sending',\n+                       action = 'store_true'),\n            make_option('-s', '--sleep', type = 'int', metavar = 'SECONDS',\n                        help = 'sleep for SECONDS between e-mails sending'),\n            make_option('--refid',\n@@ -276,6 +279,34 @@ def __build_extra_headers():\n \n     return headers\n \n+def edit_message(msg):\n+    fname = '.stgitmail.txt'\n+\n+    # create the initial file\n+    f = file(fname, 'w')\n+    f.write(msg)\n+    f.close()\n+\n+    # the editor\n+    if config.has_option('stgit', 'editor'):\n+        editor = config.get('stgit', 'editor')\n+    elif 'EDITOR' in os.environ:\n+        editor = os.environ['EDITOR']\n+    else:\n+        editor = 'vi'\n+    editor += ' %s' % fname\n+\n+    print 'Invoking the editor: \"%s\"...' % editor,\n+    sys.stdout.flush()\n+    print 'done (exit code: %d)' % os.system(editor)\n+\n+    # read the message back\n+    f = file(fname)\n+    msg = f.read()\n+    f.close()\n+\n+    return msg\n+\n def __build_cover(tmpl, total_nr, msg_id, options):\n     \"\"\"Build the cover message (series description) to be sent via SMTP\n     \"\"\"\n@@ -326,30 +357,7 @@ def __build_cover(tmpl, total_nr, msg_id\n               'supported in the patch template'\n \n     if options.edit:\n-        fname = '.stgitmail.txt'\n-\n-        # create the initial file\n-        f = file(fname, 'w+')\n-        f.write(msg)\n-        f.close()\n-\n-        # the editor\n-        if config.has_option('stgit', 'editor'):\n-            editor = config.get('stgit', 'editor')\n-        elif 'EDITOR' in os.environ:\n-            editor = os.environ['EDITOR']\n-        else:\n-            editor = 'vi'\n-        editor += ' %s' % fname\n-\n-        print 'Invoking the editor: \"%s\"...' % editor,\n-        sys.stdout.flush()\n-        print 'done (exit code: %d)' % os.system(editor)\n-\n-        # read the message back\n-        f = file(fname)\n-        msg = f.read()\n-        f.close()\n+        msg = edit_message(msg)\n \n     return msg.strip('\\n')\n \n@@ -431,6 +439,9 @@ def __build_message(tmpl, patch, patch_n\n         raise CmdException, 'Only \"%(name)s\" variables are ' \\\n               'supported in the patch template'\n \n+    if options.edit_patches:\n+        msg = edit_message(msg)\n+\n     return msg.strip('\\n')\n \n"},{"id":"297091","messageId":"b0943d9e0611020232x1e343bbco9451c8183c84d68@mail.gmail.com","threadId":"43069","inReplyTo":"20061101090046.1107.81105.stgit@localhost","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-02T10:32:46Z","receivedAt":"2006-11-02T10:32:46Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 01/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> This adds a new flag to 'stg mail', allowing the user to hand-edit\n> each patch e-mail before it is sent, just like it is currently\n> possible to edit the cover message.\n\nApplied it but with some conflicts since you have some other patches\nwhich I haven't merged yet (like QP encoding). I'll try to have a look\nat this QP encoding this week. The main problem is that Gnus shows\nplenty of \"=20\" instead of new lines and 'stg import' cannot cope with\nthem.\n\nThanks.\n\n-- \n"},{"id":"296981","messageId":"20061102113631.GA30507@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"b0943d9e0611020232x1e343bbco9451c8183c84d68@mail.gmail.com","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-02T11:36:31Z","receivedAt":"2006-11-02T11:36:31Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-02 10:32:46 +0000, Catalin Marinas wrote:\n\n> On 01/11/06, Karl Hasselström <kha@treskal.com> wrote:\n>\n> > This adds a new flag to 'stg mail', allowing the user to hand-edit\n> > each patch e-mail before it is sent, just like it is currently\n> > possible to edit the cover message.\n>\n> Applied it but with some conflicts since you have some other patches\n> which I haven't merged yet (like QP encoding). I'll try to have a\n> look at this QP encoding this week. The main problem is that Gnus\n> shows plenty of \"=20\" instead of new lines and 'stg import' cannot\n> cope with them.\n\nThat Gnus shows =20 suggests that I haven't got the QP encoding 100%\nright. I haven't had time to look at that yet, and it looks like you\nmay beat me to it.\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"296937","messageId":"b0943d9e0611030139i7be9569bh4a29596a768e82a3@mail.gmail.com","threadId":"43069","inReplyTo":"20061102113631.GA30507@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-03T09:39:57Z","receivedAt":"2006-11-03T09:39:57Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 02/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> That Gnus shows =20 suggests that I haven't got the QP encoding 100%\n> right. I haven't had time to look at that yet, and it looks like you\n> may beat me to it.\n\nWell, it might be just the way I read the list (via the gmane news\ngateway) but I have to run some tests. However, I'd like the message\nbody to still be 8bit and the QP encoding optional (either command\nline option or [stgit] config variable).\n\n-- \n"},{"id":"296083","messageId":"20061103095859.GC16721@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"b0943d9e0611030139i7be9569bh4a29596a768e82a3@mail.gmail.com","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-03T09:58:59Z","receivedAt":"2006-11-03T09:58:59Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-03 09:39:57 +0000, Catalin Marinas wrote:\n\n> On 02/11/06, Karl Hasselström <kha@treskal.com> wrote:\n>\n> > That Gnus shows =20 suggests that I haven't got the QP encoding\n> > 100% right. I haven't had time to look at that yet, and it looks\n> > like you may beat me to it.\n>\n> Well, it might be just the way I read the list (via the gmane news\n> gateway) but I have to run some tests.\n\nI believe all the mails I send with mutt are QP-encoded, and they\ndon't look funny, do they? (You'd see the separator just above my\nsignature as \"--=20\" if that was the case; it has a trailing\nwhitespace.)\n\n> However, I'd like the message body to still be 8bit and the QP\n> encoding optional (either command line option or [stgit] config\n> variable).\n\nAre you sure? Wouldn't it be better to teach StGIT to eat QP-encoded\nmails, and use 7bit encoding when the patch is all ascii? (And still\nhave an option to force 8bit instead of QP if desired, of course.)\n\nI'm really not comfortable with assuming all mail servers are 8-bit\nclean, when they're evidently not. :-)\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"295203","messageId":"20061103100142.GD16721@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"20061103095859.GC16721@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-03T10:01:42Z","receivedAt":"2006-11-03T10:01:42Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-03 10:58:59 +0100, Karl Hasselström wrote:\n\n> I believe all the mails I send with mutt are QP-encoded,\n\nI just checked, and that one certainly was.\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"296568","messageId":"20061103102119.GO20017@pasky.or.cz","threadId":"43069","inReplyTo":"20061103100142.GD16721@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-11-03T10:21:19Z","receivedAt":"2006-11-03T10:21:19Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, Nov 03, 2006 at 11:01:42AM CET, I got a letter\nwhere Karl Hasselström <kha@treskal.com> said that...\n> On 2006-11-03 10:58:59 +0100, Karl Hasselström wrote:\n> \n> > I believe all the mails I send with mutt are QP-encoded,\n> \n> I just checked, and that one certainly was.\n\nAre you sure? As far as I can see, it's 8bit.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\n"},{"id":"298327","messageId":"200611031131.43490.robin.rosenberg.lists@dewire.com","threadId":"43069","inReplyTo":"20061103102119.GO20017@pasky.or.cz","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Robin Rosenberg","fromEmail":"robin.rosenberg.lists@dewire.com","sentAt":"2006-11-03T10:31:43Z","receivedAt":"2006-11-03T10:31:43Z","isPatch":true,"sender":{"key":"robin.rosenberg@dewire.com","avatar":"https://avatars.githubusercontent.com/u/46357?v=4"},"body":"fredag 03 november 2006 11:21 skrev Petr Baudis:\n> Dear diary, on Fri, Nov 03, 2006 at 11:01:42AM CET, I got a letter\n> where Karl Hasselström <kha@treskal.com> said that...\n>\n> > On 2006-11-03 10:58:59 +0100, Karl Hasselström wrote:\n> > > I believe all the mails I send with mutt are QP-encoded,\n> >\n> > I just checked, and that one certainly was.\n>\n> Are you sure? As far as I can see, it's 8bit.\n\nThe patch mail was QP-encoded, not the other messasges in this thread.\n\n"},{"id":"295339","messageId":"454B1BC3.1070203@op5.se","threadId":"43069","inReplyTo":"20061103102119.GO20017@pasky.or.cz","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Andreas Ericsson","fromEmail":"ae@op5.se","sentAt":"2006-11-03T10:36:51Z","receivedAt":"2006-11-03T10:36:51Z","isPatch":true,"sender":{"key":"ae@op5.se","avatar":"https://gravatar.com/avatar/426e89595c75a8f5252dd0c989e5fabe5bcac616e68557427ad9aef6b0ca342a?d=mp&s=160"},"body":"Petr Baudis wrote:\n> Dear diary, on Fri, Nov 03, 2006 at 11:01:42AM CET, I got a letter\n> where Karl Hasselström <kha@treskal.com> said that...\n>> On 2006-11-03 10:58:59 +0100, Karl Hasselström wrote:\n>>\n>>> I believe all the mails I send with mutt are QP-encoded,\n>> I just checked, and that one certainly was.\n> \n> Are you sure? As far as I can see, it's 8bit.\n> \n\n8bit here too.\n\n-- \nAndreas Ericsson                   andreas.ericsson@op5.se\nOP5 AB                             www.op5.se\n"},{"id":"295756","messageId":"20061103105349.GA18651@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"454B1BC3.1070203@op5.se","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-03T10:53:49Z","receivedAt":"2006-11-03T10:53:49Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-03 11:36:51 +0100, Andreas Ericsson wrote:\n\n> Petr Baudis wrote:\n>\n> > Dear diary, on Fri, Nov 03, 2006 at 11:01:42AM CET, I got a letter\n> > where Karl Hasselström <kha@treskal.com> said that...\n> >\n> > > On 2006-11-03 10:58:59 +0100, Karl Hasselström wrote:\n> > >\n> > > > I believe all the mails I send with mutt are QP-encoded,\n> > >\n> > > I just checked, and that one certainly was.\n> >\n> > Are you sure? As far as I can see, it's 8bit.\n>\n> 8bit here too.\n\nSpooky. When I get copies of my own mails via the git list, they are\nQP-encoded; but when I bcc myself directly, I get them in 8bit. But\nyou all say you get them still 8bit-encoded. I'm not sure I even\n_want_ to know what is happening there.\n\nOne thing is certain, though: When I sent 8bit-encoded patches from\nStGIT to this list, the vger mail server added headers saying that it\ndidn't like 8bit, and had re-encoded the mail (to what, I don't recall\njust now). It warned that in doing so, it had to make assumptions\nabout the charset used. The assumption it had made was that the text\nwas latin1, which is not so good when it is in fact utf8.\n\nThis all just strengthens my belief that StGIT should go to great\nlegths to avoid stepping on mail servers' toes.\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"297997","messageId":"7vslh0bwsm.fsf@assigned-by-dhcp.cox.net","threadId":"43069","inReplyTo":"20061103105349.GA18651@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Junio C Hamano","fromEmail":"junkio@cox.net","sentAt":"2006-11-03T11:21:29Z","receivedAt":"2006-11-03T11:21:29Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Karl Hasselström <kha@treskal.com> writes:\n\n> One thing is certain, though: When I sent 8bit-encoded patches from\n> StGIT to this list, the vger mail server added headers saying that it\n> didn't like 8bit, and had re-encoded the mail (to what, I don't recall\n> just now). It warned that in doing so, it had to make assumptions\n> about the charset used. The assumption it had made was that the text\n> was latin1, which is not so good when it is in fact utf8.\n>\n> This all just strengthens my belief that StGIT should go to great\n> legths to avoid stepping on mail servers' toes.\n\nI wonder if this can be solved by simply reusing the machinery\nformat-patch already has.  If calling it as a standalone script\ndoes more unnecessary things than what StGIT wants, we should\ncertainly be able to separate the only necessary part out to\nsuit StGIT's needs.\n\n"},{"id":"297893","messageId":"20061103113536.GA19382@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"7vslh0bwsm.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-03T11:35:36Z","receivedAt":"2006-11-03T11:35:36Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-03 03:21:29 -0800, Junio C Hamano wrote:\n\n> Karl Hasselström <kha@treskal.com> writes:\n>\n> > This all just strengthens my belief that StGIT should go to great\n> > legths to avoid stepping on mail servers' toes.\n>\n> I wonder if this can be solved by simply reusing the machinery\n> format-patch already has. If calling it as a standalone script does\n> more unnecessary things than what StGIT wants, we should certainly\n> be able to separate the only necessary part out to suit StGIT's\n> needs.\n\nYes, I agree. Mail code tends to not be so beautiful that you want to\nmaintain more copies of it than absolutely necessary.\n\nOf course, the same reasoning applies when importing mails into stgit.\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"294251","messageId":"454B30E4.8000909@shadowen.org","threadId":"43069","inReplyTo":"20061103100142.GD16721@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Andy Whitcroft","fromEmail":"apw@shadowen.org","sentAt":"2006-11-03T12:07:00Z","receivedAt":"2006-11-03T12:07:00Z","isPatch":true,"sender":{"key":"apw@shadowen.org","avatar":"https://gravatar.com/avatar/d3088262854661a913ef35cc40fedcc270142d4461791142bc1ea0b2a4e2e147?d=mp&s=160"},"body":"Karl Hasselström wrote:\n> On 2006-11-03 10:58:59 +0100, Karl Hasselström wrote:\n> \n>> I believe all the mails I send with mutt are QP-encoded,\n> \n> I just checked, and that one certainly was.\n\nMime-Version: 1.0\nContent-Type:\ttext/plain; charset=iso-8859-1\nContent-Disposition: inline\nContent-Transfer-Encoding: QUOTED-PRINTABLE\n\nIt reached me as quoted printable, with =20 on your signature intro.\n\n-apw\n"},{"id":"294828","messageId":"20061103123624.GA20296@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"454B30E4.8000909@shadowen.org","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-03T12:36:24Z","receivedAt":"2006-11-03T12:36:24Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-03 12:07:00 +0000, Andy Whitcroft wrote:\n\n> It reached me as quoted printable, with =20 on your signature intro.\n\nThe copy of your mail cc'ed to me reached me as 8bit, but the copy I\ngot through the list reached me as QP.\n\nAs I said, I don't really want to know why. I just want my patches to\npass through smtp hell unmangled. :-)\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"294423","messageId":"b0943d9e0611030444w13e04586u185413c2562d45bc@mail.gmail.com","threadId":"43069","inReplyTo":"20061103095859.GC16721@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-03T12:44:48Z","receivedAt":"2006-11-03T12:44:48Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 03/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> I believe all the mails I send with mutt are QP-encoded, and they\n> don't look funny, do they? (You'd see the separator just above my\n> signature as \"--=20\" if that was the case; it has a trailing\n> whitespace.)\n\nThis e-mail, in gmail:\n\nContent-Type: text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: 8bit\n\nIn Gnus (via gmane, no \"=20\" displayed though Gnus can handle this\nencoding correctly):\n\nContent-Type: text/plain; charset=iso-8859-1\nContent-Transfer-Encoding: QUOTED-PRINTABLE\n\nIt looks like the mail server re-encodes the message.\n\n> > However, I'd like the message body to still be 8bit and the QP\n> > encoding optional (either command line option or [stgit] config\n> > variable).\n>\n> Are you sure? Wouldn't it be better to teach StGIT to eat QP-encoded\n> mails, and use 7bit encoding when the patch is all ascii? (And still\n> have an option to force 8bit instead of QP if desired, of course.)\n\nWell, I don't have any strong opinion here, as long as QP is more\nwidely available. My impression with Gnus was that it cannot handle\nbut I think there was an encoding problem.\n\nThe initial mail command implementation was inspired from sendpatchset\nbut we should probably now use the email Python package and let it\nhandle the encoding and decoding (for import).\n\n-- \n"},{"id":"293806","messageId":"b0943d9e0611030456w3de91550s3901ae7b187e086e@mail.gmail.com","threadId":"43069","inReplyTo":"7vslh0bwsm.fsf@assigned-by-dhcp.cox.net","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-03T12:56:24Z","receivedAt":"2006-11-03T12:56:24Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 03/11/06, Junio C Hamano <junkio@cox.net> wrote:\n> I wonder if this can be solved by simply reusing the machinery\n> format-patch already has.  If calling it as a standalone script\n> does more unnecessary things than what StGIT wants, we should\n> certainly be able to separate the only necessary part out to\n> suit StGIT's needs.\n\nI would like to keep the e-mail templates feature which is not\navailable via format-patch. The reason is because I also send patches\nto the ARM Linux maintainer via a patch tracking system which expects\nthe messages formatted in a strict certain way\n(http://www.arm.linux.org.uk/developer/patches/info.php). It would\nprobably be easier to fix StGIT than modifying format-patch.\n\n-- \n"},{"id":"296901","messageId":"20061103130259.GA20611@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"b0943d9e0611030444w13e04586u185413c2562d45bc@mail.gmail.com","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-03T13:02:59Z","receivedAt":"2006-11-03T13:02:59Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-03 12:44:48 +0000, Catalin Marinas wrote:\n\n> On 03/11/06, Karl Hasselström <kha@treskal.com> wrote:\n>\n> > Are you sure? Wouldn't it be better to teach StGIT to eat\n> > QP-encoded mails, and use 7bit encoding when the patch is all\n> > ascii? (And still have an option to force 8bit instead of QP if\n> > desired, of course.)\n>\n> Well, I don't have any strong opinion here, as long as QP is more\n> widely available. My impression with Gnus was that it cannot handle\n> but I think there was an encoding problem.\n\nMost probably, yes. Not supporting QP would count as a serious\ndeficiency in an e-mail client.\n\n> The initial mail command implementation was inspired from\n> sendpatchset but we should probably now use the email Python package\n> and let it handle the encoding and decoding (for import).\n\nOr try to use the git plumbing directly, if reasonable. Mail encoding\nand decoding isn't my idea of fun -- I just want it to not break. And\nI don't see much point in StGIT replicating core GIT functionality\nwhen there's no reason to.\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"295840","messageId":"b0943d9e0611030516v43a25b76y4c07f82b33411a6e@mail.gmail.com","threadId":"43069","inReplyTo":"20061103130259.GA20611@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-03T13:16:08Z","receivedAt":"2006-11-03T13:16:08Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 03/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> Or try to use the git plumbing directly, if reasonable. Mail encoding\n> and decoding isn't my idea of fun -- I just want it to not break. And\n> I don't see much point in StGIT replicating core GIT functionality\n> when there's no reason to.\n\nAs I said in my reply to Junio, I really like to keep the e-mail\ntemplates functionality of StGIT. This is not available in\ngit-format-patch.\n\n-- \n"},{"id":"298305","messageId":"b0943d9e0611030525t5da2cce7nf7b41323411e8d2d@mail.gmail.com","threadId":"43069","inReplyTo":"20061103130259.GA20611@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-03T13:25:36Z","receivedAt":"2006-11-03T13:25:36Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 03/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> Mail encoding and decoding isn't my idea of fun -- I just want it to not break.\n\nI understand this and I think we should get this fixed. In the\nmeantime, you can always run git-format-patch/git-send-email on the\nStGIT patches (the id would be \"patches/<branch>/<patch>\"). On my side\nI just run git-am and \"stg uncommit\" or \"assimilate\".\n\n-- \n"},{"id":"297437","messageId":"20061103132546.GA21202@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"b0943d9e0611030516v43a25b76y4c07f82b33411a6e@mail.gmail.com","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-03T13:25:46Z","receivedAt":"2006-11-03T13:25:46Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-03 13:16:08 +0000, Catalin Marinas wrote:\n\n> On 03/11/06, Karl Hasselström <kha@treskal.com> wrote:\n>\n> > Or try to use the git plumbing directly, if reasonable. Mail\n> > encoding and decoding isn't my idea of fun -- I just want it to\n> > not break. And I don't see much point in StGIT replicating core\n> > GIT functionality when there's no reason to.\n>\n> As I said in my reply to Junio, I really like to keep the e-mail\n> templates functionality of StGIT. This is not available in\n> git-format-patch.\n\nFair enough. How about e-mail importing -- is there a good reason to\nnot use the git plumbing there?\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"294403","messageId":"20061103133329.GB21202@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"b0943d9e0611030525t5da2cce7nf7b41323411e8d2d@mail.gmail.com","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-03T13:33:29Z","receivedAt":"2006-11-03T13:33:29Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-03 13:25:36 +0000, Catalin Marinas wrote:\n\n> On 03/11/06, Karl Hasselström <kha@treskal.com> wrote:\n>\n> > Mail encoding and decoding isn't my idea of fun -- I just want it\n> > to not break.\n>\n> I understand this and I think we should get this fixed. In the\n> meantime, you can always run git-format-patch/git-send-email on the\n> StGIT patches (the id would be \"patches/<branch>/<patch>\").\n\nDoes that mean that \"stg mail\" with my QP patch generates output that\neven git-am can't read? I had guessed from what you said earlier that\ngit-am _could_ read them.\n\n> On my side I just run git-am and \"stg uncommit\" or \"assimilate\".\n\nYes, aren't they handy sometimes? :-)\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"297905","messageId":"20061103133933.GP20017@pasky.or.cz","threadId":"43069","inReplyTo":"b0943d9e0611030525t5da2cce7nf7b41323411e8d2d@mail.gmail.com","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Petr Baudis","fromEmail":"pasky@suse.cz","sentAt":"2006-11-03T13:39:33Z","receivedAt":"2006-11-03T13:39:33Z","isPatch":true,"sender":{"key":"pasky@ucw.cz","avatar":"https://avatars.githubusercontent.com/u/18439?v=4"},"body":"Dear diary, on Fri, Nov 03, 2006 at 02:25:36PM CET, I got a letter\nwhere Catalin Marinas <catalin.marinas@gmail.com> said that...\n> I just run git-am and \"stg uncommit\" or \"assimilate\".\n\ngit-am calls git-mailsplit and git-mailinfo, and those two tools will do\nmost of the work (basically everything except the actual committing) for\nyou, I use them in cg-patch -m and it should be fairly trivial to make a\nstg command reusing those too.\n\n-- \n\t\t\t\tPetr \"Pasky\" Baudis\nStuff: http://pasky.or.cz/\n#!/bin/perl -sp0777i<X+d*lMLa^*lN%0]dsXx++lMlN/dsM0<j]dsj\n$/=unpack('H*',$_);$_=`echo 16dio\\U$k\"SK$/SM$n\\EsN0p[lN*1\n"},{"id":"296051","messageId":"20061103134245.GC21202@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"20061103133329.GB21202@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-03T13:42:45Z","receivedAt":"2006-11-03T13:42:45Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-03 14:33:29 +0100, Karl Hasselström wrote:\n\n> Does that mean that \"stg mail\" with my QP patch generates output that\n> even git-am can't read? I had guessed from what you said earlier that\n> git-am _could_ read them.\n\n(Yes, I'm way too lazy. I tested the \"stg mail\" output by mailing\npatches to myself and making sure that they looked good in my mail\nreader. And by looking at the raw output quite a bit.)\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"297294","messageId":"b0943d9e0611030556v4c49868ct5e553240a5f1d63@mail.gmail.com","threadId":"43069","inReplyTo":"20061103133329.GB21202@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-03T13:56:27Z","receivedAt":"2006-11-03T13:56:27Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 03/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> On 2006-11-03 13:25:36 +0000, Catalin Marinas wrote:\n> > I understand this and I think we should get this fixed. In the\n> > meantime, you can always run git-format-patch/git-send-email on the\n> > StGIT patches (the id would be \"patches/<branch>/<patch>\").\n>\n> Does that mean that \"stg mail\" with my QP patch generates output that\n> even git-am can't read? I had guessed from what you said earlier that\n> git-am _could_ read them.\n\nYes, git-am was able to apply them but after using Gnus to write them\nto an mbox file.\n\n-- \n"},{"id":"294144","messageId":"b0943d9e0611030601v7db6d862ve568c95b17dd0da1@mail.gmail.com","threadId":"43069","inReplyTo":"20061103133933.GP20017@pasky.or.cz","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-03T14:01:43Z","receivedAt":"2006-11-03T14:01:43Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 03/11/06, Petr Baudis <pasky@suse.cz> wrote:\n> Dear diary, on Fri, Nov 03, 2006 at 02:25:36PM CET, I got a letter\n> where Catalin Marinas <catalin.marinas@gmail.com> said that...\n> > I just run git-am and \"stg uncommit\" or \"assimilate\".\n>\n> git-am calls git-mailsplit and git-mailinfo, and those two tools will do\n> most of the work (basically everything except the actual committing) for\n> you, I use them in cg-patch -m and it should be fairly trivial to make a\n> stg command reusing those too.\n\nYes, indeed, these are the commands I would use. I wouldn't go further\nin calling git-am or git-applymbox directly as I try not to use too\nmany of the porcelain'ish git scripts.\n\n-- \n"},{"id":"295544","messageId":"454B4C43.2040607@shadowen.org","threadId":"43069","inReplyTo":"454B30E4.8000909@shadowen.org","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Andy Whitcroft","fromEmail":"apw@shadowen.org","sentAt":"2006-11-03T14:03:47Z","receivedAt":"2006-11-03T14:03:47Z","isPatch":true,"sender":{"key":"apw@shadowen.org","avatar":"https://gravatar.com/avatar/d3088262854661a913ef35cc40fedcc270142d4461791142bc1ea0b2a4e2e147?d=mp&s=160"},"body":"Andy Whitcroft wrote:\n> Karl Hasselström wrote:\n>> On 2006-11-03 10:58:59 +0100, Karl Hasselström wrote:\n>>\n>>> I believe all the mails I send with mutt are QP-encoded,\n>> I just checked, and that one certainly was.\n> \n> Mime-Version: 1.0\n> Content-Type:\ttext/plain; charset=iso-8859-1\n> Content-Disposition: inline\n> Content-Transfer-Encoding: QUOTED-PRINTABLE\n> \n> It reached me as quoted printable, with =20 on your signature intro.\n\nHeh, well the copy thunderbird wrote directly to my mailbox is also\n8bit.  And thinking about it I've seen talk of MTA's not supporting 8bit\nxfers between themselves, so thats probabally when it gets switched.\n\n"},{"id":"296574","messageId":"b0943d9e0611030637x6162ede8sc9efb3297474885e@mail.gmail.com","threadId":"43069","inReplyTo":"b0943d9e0611030556v4c49868ct5e553240a5f1d63@mail.gmail.com","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Catalin Marinas","fromEmail":"catalin.marinas@gmail.com","sentAt":"2006-11-03T14:37:29Z","receivedAt":"2006-11-03T14:37:29Z","isPatch":true,"sender":{"key":"catalin.marinas@gmail.com","avatar":null},"body":"On 03/11/06, Catalin Marinas <catalin.marinas@gmail.com> wrote:\n> On 03/11/06, Karl Hasselström <kha@treskal.com> wrote:\n> > On 2006-11-03 13:25:36 +0000, Catalin Marinas wrote:\n> > > I understand this and I think we should get this fixed. In the\n> > > meantime, you can always run git-format-patch/git-send-email on the\n> > > StGIT patches (the id would be \"patches/<branch>/<patch>\").\n> >\n> > Does that mean that \"stg mail\" with my QP patch generates output that\n> > even git-am can't read? I had guessed from what you said earlier that\n> > git-am _could_ read them.\n>\n> Yes, git-am was able to apply them but after using Gnus to write them\n> to an mbox file.\n\nI changed your patch slightly to add \"Content-Disposition: inline\" and\nQUOTED-PRINTABLE instead of quoted-printable. It seems that Gnus can\nshow it properly now (but import still fails, of course).\n\n-- \n"},{"id":"296739","messageId":"Pine.LNX.4.64.0611031034520.25218@g5.osdl.org","threadId":"43069","inReplyTo":"454B4C43.2040607@shadowen.org","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-11-03T18:48:49Z","receivedAt":"2006-11-03T18:48:49Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Fri, 3 Nov 2006, Andy Whitcroft wrote:\n> \n> Heh, well the copy thunderbird wrote directly to my mailbox is also\n> 8bit.  And thinking about it I've seen talk of MTA's not supporting 8bit\n> xfers between themselves, so thats probabally when it gets switched.\n\nIf your ISP mailer doesn't answer with \"8BITMIME\" to your EHLO, your mail \nclient is supposed to downgrade to a 7-bit format (or the same thing can \nhappen anywhere in between on one of the other hops).  Of course, that \nwould be a really old and broken mailer, and if you find one of those at \nthe ISP you use, you should probably switch ISPs.\n\nSome other mailers have other issues, and qmail for example is apparently \ntotally broken (it accepts 8-bit input, but cannot forward it properly to \nsomebody who wants it converted to 7-bit).\n\nAnd some of us use \"fetchmail\" and ask it do do mimedecode for us, so that \neven if it arrived as 7-bit crud, we don't have to see it. So the fact \nthat some people see it as 8-bit can be because the hops to them didn't \ninvolve a broken remailer, but it could also be because something in \nbetween (like fetchmail) tries to fix it up after the fact.\n\nThat said: it tends to be unusual to see true 7-bit mailer setups these \ndays.\n\nSo the most _likely_ cause of unnecessary 7-bit QP crud is not in fact a \n7-bit mailserver, but usually just the mail client that is just lazy and \njust sends out everything as 7-bit because it's too bothersome to even \nlook at whether the mail server supports 8-bit data. Check your \nThunderbird settings - it's quite possible that there's a flag there \nsomewhere to turn on 8-bit mail transfers.\n\n"},{"id":"296968","messageId":"20061105114353.GB19707@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"Pine.LNX.4.64.0611031034520.25218@g5.osdl.org","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-05T11:43:53Z","receivedAt":"2006-11-05T11:43:53Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-03 10:48:49 -0800, Linus Torvalds wrote:\n\n> If your ISP mailer doesn't answer with \"8BITMIME\" to your EHLO, your\n> mail client is supposed to downgrade to a 7-bit format (or the same\n> thing can happen anywhere in between on one of the other hops). Of\n> course, that would be a really old and broken mailer, and if you\n> find one of those at the ISP you use, you should probably switch\n> ISPs.\n>\n> Some other mailers have other issues, and qmail for example is\n> apparently totally broken (it accepts 8-bit input, but cannot\n> forward it properly to somebody who wants it converted to 7-bit).\n>\n> And some of us use \"fetchmail\" and ask it do do mimedecode for us,\n> so that even if it arrived as 7-bit crud, we don't have to see it.\n> So the fact that some people see it as 8-bit can be because the hops\n> to them didn't involve a broken remailer, but it could also be\n> because something in between (like fetchmail) tries to fix it up\n> after the fact.\n>\n> That said: it tends to be unusual to see true 7-bit mailer setups\n> these days.\n>\n> So the most _likely_ cause of unnecessary 7-bit QP crud is not in\n> fact a 7-bit mailserver, but usually just the mail client that is\n> just lazy and just sends out everything as 7-bit because it's too\n> bothersome to even look at whether the mail server supports 8-bit\n> data. Check your Thunderbird settings - it's quite possible that\n> there's a flag there somewhere to turn on 8-bit mail transfers.\n\nSo the right thing to do would be to teach StGIT to generate\n8bit-encoded output, and trust the SMTP transfer path do mangle it\ncorrectly? (Hmm. No, since StGIT talks directly with the first SMTP\nserver in the chain, it needs to be able to QP-encode the mail itself\nif necessary -- but it should seldom be necessary, then.)\n\nIn that case, the problem with the current implementation (without my\npatch applied) is likely to be that it fails to provide the headers\nneeded for the SMTP path to be able to transform it losslessly.\n\n[ ... digs through old mail ... ]\n\nThis is the interesting part of such a mail that was sent from my\ncomputer, passed through the list, and ended up back at my computer\nagain:\n\n  Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n          id S1750700AbWJVMCV (ORCPT <rfc822;kha-list-git@hemma.treskal.com>);\n          Sun, 22 Oct 2006 08:02:21 -0400\n  X-Warning: Original message contained 8-bit characters, however during\n             the SMTP transport session the receiving system did not announce\n             capability of receiving 8-bit SMTP (RFC 1651-1653), and as this\n             message does not have MIME headers (RFC 2045-2049) to enable\n             encoding change, we had very little choice.\n  X-Warning: We ASSUME it is less harmful to add the MIME headers, and\n             convert the text to Quoted-Printable, than not to do so,\n             and to strip the message to 7-bits.. (RFC 1428 Appendix A)\n  X-Warning: We don't know what character set the user used, thus we had to\n             write these MIME-headers with our local system default value.\n  MIME-Version: 1.0\n  Content-Transfer-Encoding: QUOTED-PRINTABLE\n  Content-Type: TEXT/PLAIN; charset=ISO-8859-1\n  Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1751780AbWJVMCV\n          (ORCPT <rfc822;git-outgoing>); Sun, 22 Oct 2006 08:02:21 -0400\n\nThe mail server (vger talking to itself, if the Received: headers were\nadded in order) complained that there were no MIME headers, so it had\nto guess the charset. As it happened, it guessed wrong, so the\nnon-ascii characters of the mail body was garbled.\n\nMy stab at fixing this was to make StGIT QP-encode the mail from the\noutset, but if I've not misunderstood things yet again, the actual\nproblem was that StGIT did not produce the right MIME headers.\n\n-- \nKarl Hasselström, kha@treskal.com\n"},{"id":"297266","messageId":"Pine.LNX.4.64.0611050831250.25218@g5.osdl.org","threadId":"43069","inReplyTo":"20061105114353.GB19707@diana.vm.bytemark.co.uk","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Linus Torvalds","fromEmail":"torvalds@osdl.org","sentAt":"2006-11-05T16:44:13Z","receivedAt":"2006-11-05T16:44:13Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Sun, 5 Nov 2006, Karl Hasselström wrote:\n> \n> So the right thing to do would be to teach StGIT to generate\n> 8bit-encoded output, and trust the SMTP transfer path do mangle it\n> correctly? (Hmm. No, since StGIT talks directly with the first SMTP\n> server in the chain, it needs to be able to QP-encode the mail itself\n> if necessary -- but it should seldom be necessary, then.)\n\nRight. You could even just consider it an error if the mailserver doesn't \nreply to EHLO with 8BITMIME, I really think it's that rare.\n\n> In that case, the problem with the current implementation (without my\n> patch applied) is likely to be that it fails to provide the headers\n> needed for the SMTP path to be able to transform it losslessly.\n\nI _think_ it should be sufficient to just set the Content-Type and \nContent-Transfer-Encoding to say something like \"text/plain; charset=UTF8\" \nand \"8bit\" respectively. But somebody who know the SMTP rules better \nshould check.\n\nHOWEVER:\n\n>   Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n>           id S1750700AbWJVMCV (ORCPT <rfc822;kha-list-git@hemma.treskal.com>);\n>           Sun, 22 Oct 2006 08:02:21 -0400\n>   X-Warning: Original message contained 8-bit characters, however during\n>              the SMTP transport session the receiving system did not announce\n>              capability of receiving 8-bit SMTP (RFC 1651-1653), and as this\n>              message does not have MIME headers (RFC 2045-2049) to enable\n>              encoding change, we had very little choice.\n\nThis does seem to say that somebody didn't even announce 8-bit capability \nin the first place. That's a zmailer error message, and it does imply that \nsomebody was running a bad server.\n\nThat said, _if_ your message had had the proper mime-type specifiers, then \nzmailer would happily have QP-converted the message for you, so everything \nwould have been fine.\n\n> The mail server (vger talking to itself, if the Received: headers were\n> added in order) complained that there were no MIME headers, so it had\n> to guess the charset.\n\nvger itself? Strange.\n\n\t\tLinus"},{"id":"294848","messageId":"20061105190400.GC25259@diana.vm.bytemark.co.uk","threadId":"43069","inReplyTo":"Pine.LNX.4.64.0611050831250.25218@g5.osdl.org","subject":"Re: [PATCH] Allow hand-editing of patches before sending","fromName":"Karl Hasselström","fromEmail":"kha@treskal.com","sentAt":"2006-11-05T19:04:00Z","receivedAt":"2006-11-05T19:04:00Z","isPatch":true,"sender":{"key":"kha@treskal.com","avatar":"https://gravatar.com/avatar/f0120c734b5279b345075a28521e1ac66acb20c9913ffe9bf6ae97e53f7f3f13?d=mp&s=160"},"body":"On 2006-11-05 08:44:13 -0800, Linus Torvalds wrote:\n\n> On Sun, 5 Nov 2006, Karl Hasselström wrote:\n>\n> > So the right thing to do would be to teach StGIT to generate\n> > 8bit-encoded output, and trust the SMTP transfer path do mangle it\n> > correctly? (Hmm. No, since StGIT talks directly with the first\n> > SMTP server in the chain, it needs to be able to QP-encode the\n> > mail itself if necessary -- but it should seldom be necessary,\n> > then.)\n>\n> Right. You could even just consider it an error if the mailserver\n> doesn't reply to EHLO with 8BITMIME, I really think it's that rare.\n\nMakes sense (unless the Python SMTP library can do this for us -- it\nwould be impolite to refuse then).\n\n> > In that case, the problem with the current implementation (without\n> > my patch applied) is likely to be that it fails to provide the\n> > headers needed for the SMTP path to be able to transform it\n> > losslessly.\n>\n> I _think_ it should be sufficient to just set the Content-Type and\n> Content-Transfer-Encoding to say something like \"text/plain;\n> charset=UTF8\" and \"8bit\" respectively. But somebody who know the\n> SMTP rules better should check.\n\nThese are the headers that StGIT uses without my patch -- that is, the\nheaders used to get that error message:\n\n  Content-Type: text/plain; charset=utf-8; format=fixed\n  Content-Transfer-Encoding: 8bit\n\nWhich is obviously not good enough for some picky part of the SMTP\nchain.\n\n> HOWEVER:\n>\n> >   Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n> >           id S1750700AbWJVMCV (ORCPT <rfc822;kha-list-git@hemma.treskal.com>);\n> >           Sun, 22 Oct 2006 08:02:21 -0400\n> >   X-Warning: Original message contained 8-bit characters, however during\n> >              the SMTP transport session the receiving system did not announce\n> >              capability of receiving 8-bit SMTP (RFC 1651-1653), and as this\n> >              message does not have MIME headers (RFC 2045-2049) to enable\n> >              encoding change, we had very little choice.\n>\n> This does seem to say that somebody didn't even announce 8-bit\n> capability in the first place. That's a zmailer error message, and\n> it does imply that somebody was running a bad server.\n>\n> That said, _if_ your message had had the proper mime-type\n> specifiers, then zmailer would happily have QP-converted the message\n> for you, so everything would have been fine.\n\nE-mail seems to be like driving. You can't just follow the rules, you\nalso have to be careful to make allowances for those who don't. :-(\n\nWell, it added these headers:\n\n  MIME-Version: 1.0\n  Content-Transfer-Encoding: QUOTED-PRINTABLE\n  Content-Type: TEXT/PLAIN; charset=ISO-8859-1\n\nMaybe MIME-Version was the only thing missing? I'll have to try.\n\n> > The mail server (vger talking to itself, if the Received: headers\n> > were added in order) complained that there were no MIME headers,\n> > so it had to guess the charset.\n>\n> vger itself? Strange.\n\nIt looks that way, but I don't know enough about mail servers to be\nvery certain. The complete header of the message (in my git list\nmailbox) is this:\n\nFrom git-owner@vger.kernel.org Sun Oct 22 14:02:35 2006\nReceived: from vger.kernel.org ([209.132.176.167])\n\tby diana.vm.bytemark.co.uk with esmtp (Exim 3.36 #1 (Debian))\n\tid 1Gbc2E-0005lw-00\n\tfor <kha-list-git@hemma.treskal.com>; Sun, 22 Oct 2006 13:02:35 +0100\nReceived: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1750700AbWJVMCV (ORCPT <rfc822;kha-list-git@hemma.treskal.com>);\n\tSun, 22 Oct 2006 08:02:21 -0400\nX-Warning: Original message contained 8-bit characters, however during\n\t   the SMTP transport session the receiving system did not announce\n\t   capability of receiving 8-bit SMTP (RFC 1651-1653), and as this\n\t   message does not have MIME headers (RFC 2045-2049) to enable\n\t   encoding change, we had very little choice.\nX-Warning: We ASSUME it is less harmful to add the MIME headers, and\n\t   convert the text to Quoted-Printable, than not to do so,\n\t   and to strip the message to 7-bits.. (RFC 1428 Appendix A)\nX-Warning: We don't know what character set the user used, thus we had to\n\t   write these MIME-headers with our local system default value.\nMIME-Version: 1.0\nContent-Transfer-Encoding: QUOTED-PRINTABLE\nContent-Type: TEXT/PLAIN; charset=ISO-8859-1\nReceived: (majordomo@vger.kernel.org) by vger.kernel.org id S1751780AbWJVMCV\n\t(ORCPT <rfc822;git-outgoing>); Sun, 22 Oct 2006 08:02:21 -0400\nReceived: from mxfep01.bredband.com ([195.54.107.70]:50054 \"EHLO\n\tmxfep01.bredband.com\") by vger.kernel.org with ESMTP\n\tid S1750700AbWJVMCU (ORCPT <rfc822;git@vger.kernel.org>);\n\tSun, 22 Oct 2006 08:02:20 -0400\nReceived: from ironport2.bredband.com ([195.54.107.84] [195.54.107.84])\n          by mxfep01.bredband.com with ESMTP\n          id <20061022120218.PHVT953.mxfep01.bredband.com@ironport2.bredband.com>\n          for <git@vger.kernel.org>; Sun, 22 Oct 2006 14:02:18 +0200\nReceived: from ua-83-227-180-148.cust.bredbandsbolaget.se (HELO yoghurt.hemma.treskal.com) ([83.227.180.148])\n  by ironport2.bredband.com with ESMTP; 22 Oct 2006 14:02:18 +0200\nReceived: from [127.0.0.1] (localhost [127.0.0.1])\n\tby yoghurt.hemma.treskal.com (Postfix) with ESMTP id 1DFDF4C010;\n\tSun, 22 Oct 2006 14:02:18 +0200 (CEST)\nFrom:\tKarl =?utf-8?q?Hasselstr=C3=B6m?= <kha@treskal.com>\nSubject: [PATCH] RFC2047-encode email headers\nDate:\tSun, 22 Oct 2006 14:02:17 +0200\nTo:\tCatalin Marinas <catalin.marinas@gmail.com>\nCc:\tgit@vger.kernel.org\nMessage-Id: <20061022120217.7650.23715.stgit@localhost>\nUser-Agent: StGIT/0.11\nSender:\tgit-owner@vger.kernel.org\nPrecedence: bulk\nX-Mailing-List:\tgit@vger.kernel.org\nX-Envelope-Username: kha-list-git\nX-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=0.94.4\nX-Spam-Checker-Version: SpamAssassin 3.0.3 (2005-04-27) on \n\tdiana.vm.bytemark.co.uk\nX-Spam-Level: \nX-Spam-Status: No, score=-0.3 required=5.0 tests=AWL,FORGED_RCVD_HELO \n\tautolearn=disabled version=3.0.3\nX-Already-Filtered-By: kha@treskal.com, 2006-10-22 13:02:44 +0100\nStatus: RO\nX-Status: A\nContent-Length: 4148\n\n-- \nKarl Hasselström, kha@treskal.com\n"}]}