{"thread":{"id":"23909","subject":"Apology/Bug report: git-send-email sends everything on Ctrl+C","startedAt":"2010-05-26T06:04:00Z","lastAt":"2010-05-26T09:27:15Z","messageCount":8,"participants":["Sam Vilain","Will Palmer","Michael J Gruber","Sverre Rabbelier"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"142335","messageId":"4BFCB9D0.3010400@vilain.net","threadId":"23909","inReplyTo":null,"subject":"Apology/Bug report: git-send-email sends everything on Ctrl+C","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2010-05-26T06:04:00Z","receivedAt":"2010-05-26T06:04:00Z","isPatch":false,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Expect a mail storm shortly, sorry folks.\n\nSam\n"},{"id":"142342","messageId":"4BFCC4B5.6070408@vilain.net","threadId":"23909","inReplyTo":"4BFCB9D0.3010400@vilain.net","subject":"Re: Apology/Bug report: git-send-email sends everything on Ctrl+C","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2010-05-26T06:50:29Z","receivedAt":"2010-05-26T06:50:29Z","isPatch":false,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Sam Vilain wrote:\n> Expect a mail storm shortly, sorry folks.\n>   \n\nI just had a look at patching git-send-email.perl; but it looks like it\nis checking $? correctly at least since beece9da;\n\n            system('sh', '-c', $editor.' \"$@\"', $editor, $_);\n            if (($? & 127) || ($? >> 8)) {\n                die(\"the editor exited uncleanly, aborting everything\");\n            }\n\nI think I must have actually hit Ctrl-Z, not Ctrl-C.  So, it's all my\nfault and I apologize profusely.\n\nSam\n"},{"id":"142350","messageId":"1274861112.2074.2.camel@wpalmer.simply-domain","threadId":"23909","inReplyTo":"4BFCC4B5.6070408@vilain.net","subject":"Re: Apology/Bug report: git-send-email sends everything on Ctrl+C","fromName":"Will Palmer","fromEmail":"wmpalmer@gmail.com","sentAt":"2010-05-26T08:05:12Z","receivedAt":"2010-05-26T08:05:12Z","isPatch":false,"sender":{"key":"wmpalmer@gmail.com","avatar":"https://avatars.githubusercontent.com/u/357044?v=4"},"body":"On Wed, 2010-05-26 at 18:50 +1200, Sam Vilain wrote:\n> Sam Vilain wrote:\n> > Expect a mail storm shortly, sorry folks.\n> >   \n> \n> I just had a look at patching git-send-email.perl; but it looks like it\n> is checking $? correctly at least since beece9da;\n> \n>             system('sh', '-c', $editor.' \"$@\"', $editor, $_);\n>             if (($? & 127) || ($? >> 8)) {\n>                 die(\"the editor exited uncleanly, aborting everything\");\n>             }\n> \n> I think I must have actually hit Ctrl-Z, not Ctrl-C.  So, it's all my\n> fault and I apologize profusely.\n> \n> Sam\n\nI'd consider anything that can make \"accidentally sending 100+ patches\"\npossible to be a bug. How does \"it was Ctrl-Z, not Ctrl-C\" make a\ndifference here?\n"},{"id":"142352","messageId":"4BFCDE68.4090909@drmicha.warpmail.net","threadId":"23909","inReplyTo":"4BFCC4B5.6070408@vilain.net","subject":"Re: Apology/Bug report: git-send-email sends everything on Ctrl+C","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-05-26T08:40:08Z","receivedAt":"2010-05-26T08:40:08Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Sam Vilain venit, vidit, dixit 26.05.2010 08:50:\n> Sam Vilain wrote:\n>> Expect a mail storm shortly, sorry folks.\n>>   \n> \n> I just had a look at patching git-send-email.perl; but it looks like it\n> is checking $? correctly at least since beece9da;\n> \n>             system('sh', '-c', $editor.' \"$@\"', $editor, $_);\n>             if (($? & 127) || ($? >> 8)) {\n>                 die(\"the editor exited uncleanly, aborting everything\");\n>             }\n> \n> I think I must have actually hit Ctrl-Z, not Ctrl-C.  So, it's all my\n> fault and I apologize profusely.\n> \n> Sam\n\nI don't want to make you feel even worse, but could you tell us what\nmistake you made so that we can avoid it? Wrong base rev for\nformat-patch baserev.. and piping directly into send-email?\n\nMichael\n"},{"id":"142355","messageId":"4BFCE12E.4070009@vilain.net","threadId":"23909","inReplyTo":"1274861112.2074.2.camel@wpalmer.simply-domain","subject":"Re: Apology/Bug report: git-send-email sends everything on Ctrl+C","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2010-05-26T08:51:58Z","receivedAt":"2010-05-26T08:51:58Z","isPatch":false,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Will Palmer wrote:\n>> I think I must have actually hit Ctrl-Z, not Ctrl-C.  So, it's all my\n>> fault and I apologize profusely.\n>>     \n> I'd consider anything that can make \"accidentally sending 100+ patches\"\n> possible to be a bug. How does \"it was Ctrl-Z, not Ctrl-C\" make a\n> difference here?\n\nThis was what I did;\n\non git.git next or so; I was thinking \"hmm, how does git send-email\nformat the cover letter for editing by the user?  I know, I'll just check\":\n\n $ git send-email --compose HEAD~5..\n\n(tab around a bit, I think I hit ctrl+z because my history has \"jobs\" in\nit just after that command)\n\n(poke around in the git-send-email source a bit)\n\n(inspect the file it produced, oh look, HEAD~5.. matches an awful lot of\ncommits)\n\n(close edit window without changes)\n\n(notice hundreds of e-mail headers being spewed out)\n\nCtrl+C.  nothing (it's in the background)\n\nCtrl+C again.  argh!  What MTA am I running?\n\n $ sudo /etc/init.d/postfix stop\n $ sudo /etc/init.d/exim4 stop\n $ cat .git/config\n\nOh no, it's going to a mail server I don't have root on.  It was fully\nconfigured so it didn't need to ask any questions, just fire away.  Why\ndid I test that on my git.git checkout?\n\nQuick, find a friendly sysadmin and mailq | grep sam.vilain | cut -d\" \"\n-f1 | sudo xargs -n1 postsuper -d\n\nHard to know what could have possibly stopped this from happening.  PEBKAC.\n\nSam\n"},{"id":"142356","messageId":"AANLkTin51a4RONmN6j3GXGJQ3UtE8bt3e_PF5t75mZTC@mail.gmail.com","threadId":"23909","inReplyTo":"4BFCE12E.4070009@vilain.net","subject":"Re: Apology/Bug report: git-send-email sends everything on Ctrl+C","fromName":"Sverre Rabbelier","fromEmail":"srabbelier@gmail.com","sentAt":"2010-05-26T09:07:02Z","receivedAt":"2010-05-26T09:07:02Z","isPatch":false,"sender":{"key":"srabbelier@gmail.com","avatar":"https://avatars.githubusercontent.com/u/3098?v=4"},"body":"Heya,\n\n[sorry for my earlier reply to your other accidental mail, feel free\nto ignore it as I had not read this thread yet]\n\nOn Wed, May 26, 2010 at 10:51, Sam Vilain <sam@vilain.net> wrote:\n> Hard to know what could have possibly stopped this from happening.  PEBKAC.\n\nPerhaps git can be smart and ask for confirmation for huge (>20 ?) patchsets.\n\n-- \nCheers,\n\nSverre Rabbelier\n"},{"id":"142358","messageId":"4BFCE6DD.4030403@drmicha.warpmail.net","threadId":"23909","inReplyTo":"AANLkTin51a4RONmN6j3GXGJQ3UtE8bt3e_PF5t75mZTC@mail.gmail.com","subject":"Re: Apology/Bug report: git-send-email sends everything on Ctrl+C","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-05-26T09:16:13Z","receivedAt":"2010-05-26T09:16:13Z","isPatch":false,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Sverre Rabbelier venit, vidit, dixit 26.05.2010 11:07:\n> Heya,\n> \n> [sorry for my earlier reply to your other accidental mail, feel free\n> to ignore it as I had not read this thread yet]\n> \n> On Wed, May 26, 2010 at 10:51, Sam Vilain <sam@vilain.net> wrote:\n>> Hard to know what could have possibly stopped this from happening.  PEBKAC.\n> \n> Perhaps git can be smart and ask for confirmation for huge (>20 ?) patchsets.\n> \n\nto be overriden by an option \"--no-villain\"...\n\nSorry, bad joke, but couldn't resist. Feel free to pick on my name ;)\n\nMichael\n"},{"id":"142359","messageId":"4BFCE973.3000304@vilain.net","threadId":"23909","inReplyTo":"4BFCE6DD.4030403@drmicha.warpmail.net","subject":"Re: Apology/Bug report: git-send-email sends everything on Ctrl+C","fromName":"Sam Vilain","fromEmail":"sam@vilain.net","sentAt":"2010-05-26T09:27:15Z","receivedAt":"2010-05-26T09:27:15Z","isPatch":false,"sender":{"key":"sam@vilain.net","avatar":"https://gravatar.com/avatar/8fc840ca854dbf6f7065b4335e3b934951c1dca3b11db688e95e471901f8f4a8?d=mp&s=160"},"body":"Michael J Gruber wrote:\n> > > Hard to know what could have possibly stopped this from happening.\n> > > PEBKAC.\n> > Perhaps git can be smart and ask for confirmation for huge (>20 ?)\n> > patchsets.\n> to be overriden by an option \"--no-villain\"...\n> \n> Sorry, bad joke, but couldn't resist. Feel free to pick on my name ;)\n\nI went with the simpler and pre-existing --confirm=never :-)\n\nSubject: [PATCH] send-email: confirm for really large patch sets\n\nIt is possible to send a lot of e-mails using quite simple user errors\nwith git send-email; if they were not intended this could be quite a\nlot of spam.  Ask a final question if there are a lot of messages\nbefore sending.\n\nSigned-off-by: Sam Vilain <sam@vilain.net>\n---\n untested: after what just happens there is no way I'm testing this :-)\n\n git-send-email.perl |   13 +++++++++++++\n 1 files changed, 13 insertions(+), 0 deletions(-)\n\ndiff --git a/Documentation/git-send-email.txt b/Documentation/git-send-email.txt\nindex 12622fc..093b7f2 100644\n--- a/Documentation/git-send-email.txt\n+++ b/Documentation/git-send-email.txt\n@@ -257,6 +257,11 @@ Administering\n Default is the value of 'sendemail.confirm' configuration value; if that\n is unspecified, default to 'auto' unless any of the suppress options\n have been specified, in which case default to 'compose'.\n++\n+If you are sending a very large patch sequence (more than 20 parts),\n+you will be asked for a second final confirmation before anything is\n+sent.  This can be suppressed by setting this configuration value to\n+'never'.\n \n --dry-run::\n        Do everything except actually send the emails.\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex 111c981..2775506 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -1096,6 +1096,19 @@ $references = $initial_reply_to || '';\n $subject = $initial_subject;\n $message_num = 0;\n \n+if ($needs_confirm ne \"never\" and @files > 20) {\n+\t$_ = ask(\n+\t\t\"That's a big patch set - \".@files.\" parts.  \"\n+\t\t.\"Are you sure you want to do this? ([y]es|[n]o): \",\n+\t\tvalid_re => qr/^(?:yes|y|no|n)/i,\n+\t\tdefault => \"n\",\n+\t       );\n+\tif (/^n/i) {\n+\t\tcleanup_compose_files();\n+\t\texit(0);\n+\t}\n+}\n+\n foreach my $t (@files) {\n \topen(F,\"<\",$t) or die \"can't open file $t\";\n \n-- \n1.7.1.rc2.333.gb2668\n"}]}