{"thread":{"id":"23140","subject":"[REGRESSION] git var GIT_EDITOR fails without tty","startedAt":"2010-03-22T14:59:47Z","lastAt":"2010-03-26T21:45:41Z","messageCount":14,"participants":["Uwe Kleine-König","Michael J Gruber","Jonathan Nieder","Peter Kjellerstedt","Junio C Hamano"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"137556","messageId":"20100322145947.GA1709@pengutronix.de","threadId":"23140","inReplyTo":null,"subject":"[REGRESSION] git var GIT_EDITOR fails without tty","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-03-22T14:59:47Z","receivedAt":"2010-03-22T14:59:47Z","isPatch":false,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello,\n\nsince b4479f074760a788dd4e353b8c86a7d735afc53e git send-email (and\nothers) use git var GIT_EDITOR.  This is OK as such but it breaks the\npost-receive hooks that I use on several repositories.\n\nWhen called they don't have a tty, and this makes git var fail:\n\n\tuser@host:~$ ssh localhost \"git var GIT_EDITOR\"\n\tfatal: Terminal is dumb, but EDITOR unset\n\nIMHO git send-email should only call $(git var GIT_EDITOR) when it\nactually needs it.\n\n(Note I'm using the Debian packaged version of git.  I don't think this\nproblem is Debian specific, I didn't check though.)\n\nBest regards\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"137561","messageId":"eb0d92cf28820eb9783e789a8c4c62c3af4dd0d0.1269274203.git.git@drmicha.warpmail.net","threadId":"23140","inReplyTo":"20100322145947.GA1709@pengutronix.de","subject":"[PATCH] send-email: lazily assign editor variable","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-03-22T16:12:53Z","receivedAt":"2010-03-22T16:12:53Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"b4479f0 (add -i, send-email, svn, p4, etc: use \"git var GIT_EDITOR\",\n2009-10-30) introduced the use of git var GIT_EDITOR which may lead to\nproblems when send-mail is used without a tty.\n\nTherefore, use git var GIT_EDITOR only when we actually edit something.\n\nSigned-off-by: Michael J Gruber <git@drmicha.warpmail.net>\nReported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n---\n git-send-email.perl |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex d612ae8..bb09c0d 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -162,9 +162,12 @@ my $compose_filename;\n \n # Handle interactive edition of files.\n my $multiedit;\n-my $editor = Git::command_oneline('var', 'GIT_EDITOR');\n+my $editor;\n \n sub do_edit {\n+\tif (!defined($editor)) {\n+\t\t$editor = Git::command_oneline('var', 'GIT_EDITOR');\n+\t}\n \tif (defined($multiedit) && !$multiedit) {\n \t\tmap {\n \t\t\tsystem('sh', '-c', $editor.' \"$@\"', $editor, $_);\n-- \n1.7.0.3.435.g097f4\n"},{"id":"137563","messageId":"20100322164152.GA30332@pengutronix.de","threadId":"23140","inReplyTo":"eb0d92cf28820eb9783e789a8c4c62c3af4dd0d0.1269274203.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] send-email: lazily assign editor variable","fromName":"Uwe Kleine-König","fromEmail":"u.kleine-koenig@pengutronix.de","sentAt":"2010-03-22T16:41:52Z","receivedAt":"2010-03-22T16:41:52Z","isPatch":true,"sender":{"key":"u.kleine-koenig@pengutronix.de","avatar":"https://gravatar.com/avatar/354b5e3ceb2806a2f1e1e382ac29ddbdad18288654da62b61eb13583a857eee7?d=mp&s=160"},"body":"Hello Michael,\n\nOn Mon, Mar 22, 2010 at 05:12:53PM +0100, Michael J Gruber wrote:\n> b4479f0 (add -i, send-email, svn, p4, etc: use \"git var GIT_EDITOR\",\n> 2009-10-30) introduced the use of git var GIT_EDITOR which may lead to\n> problems when send-mail is used without a tty.\n> \n> Therefore, use git var GIT_EDITOR only when we actually edit something.\n> \n> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n> ---\n>  git-send-email.perl |    5 ++++-\n>  1 files changed, 4 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index d612ae8..bb09c0d 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -162,9 +162,12 @@ my $compose_filename;\n>  \n>  # Handle interactive edition of files.\n>  my $multiedit;\n> -my $editor = Git::command_oneline('var', 'GIT_EDITOR');\n> +my $editor;\n>  \n>  sub do_edit {\n> +\tif (!defined($editor)) {\n> +\t\t$editor = Git::command_oneline('var', 'GIT_EDITOR');\n> +\t}\n>  \tif (defined($multiedit) && !$multiedit) {\n>  \t\tmap {\n>  \t\t\tsystem('sh', '-c', $editor.' \"$@\"', $editor, $_);\nI havn't tested yet, but (maybe apart from a comment) this looks exactly\nlike the patch I would have done if I knew perl :-)\n\nSo, Acked-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n\nBest regards and thanks for the quick response,\nUwe\n\n-- \nPengutronix e.K.                           | Uwe Kleine-König            |\nIndustrial Linux Solutions                 | http://www.pengutronix.de/  |\n"},{"id":"137595","messageId":"20100322232531.GA2168@progeny.tock","threadId":"23140","inReplyTo":"20100322145947.GA1709@pengutronix.de","subject":"[PATCH] send-email: do not check for editor until needed","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-22T23:25:31Z","receivedAt":"2010-03-22T23:25:31Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Since b4479f074 (add -i, send-email, svn, p4, etc: use \"git var\nGIT_EDITOR\", 2009-10-30), when called with TERM=dumb and without\nGIT_EDITOR set, git send-email has been failing whether it needs\nan editor or not:\n\n $ ssh localhost git send-email --to=me --suppress-cc=all HEAD^..HEAD\n fatal: Terminal is dumb, but EDITOR unset\n var GIT_EDITOR: command returned error: 128\n\nThis breaks use of git send-email in existing hook scripts.\n\nSo do not check for an editor unless it is needed.\n\nReported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nUwe Kleine-König wrote:\n\n> since b4479f074760a788dd4e353b8c86a7d735afc53e git send-email (and\n> others) use git var GIT_EDITOR.  This is OK as such but it breaks the\n> post-receive hooks that I use on several repositories.\n[...]\n> IMHO git send-email should only call $(git var GIT_EDITOR) when it\n> actually needs it.\n\nThanks for reporting.  Does this patch work for you?\n\nNow if I try without a tty, I get a different error:\n\n $ ssh localhost cd $(pwd) '&&' \\\n\tgit send-email --to=me --suppress-cc=all HEAD^..HEAD\n Can't locate object method \"IN\" via package \"FakeTerm\" at\n /home/jrn/tmp-git/libexec/git-core/git-send-email line 645.\n /tmp/olTiwjzrjx/0001-Git-1.7.0.3.patch\n\nI assume I am not using it correctly, since the relevant code has\nbeen around for a while.\n\n git-send-email.perl |    9 ++++++++-\n 1 files changed, 8 insertions(+), 1 deletions(-)\n\ndiff --git a/git-send-email.perl b/git-send-email.perl\nindex e05455f..9406cdd 100755\n--- a/git-send-email.perl\n+++ b/git-send-email.perl\n@@ -162,9 +162,16 @@ my $compose_filename;\n \n # Handle interactive edition of files.\n my $multiedit;\n-my $editor = Git::command_oneline('var', 'GIT_EDITOR');\n \n sub do_edit {\n+\tmy $editor;\n+\n+\tif ($#_ == 0) {\n+\t\treturn;\n+\t}\n+\tgit_cmd_try {\n+\t\t$editor = Git::command_oneline('var', 'GIT_EDITOR');\n+\t} \"no suitable text editor configured\\n\";\n \tif (defined($multiedit) && !$multiedit) {\n \t\tmap {\n \t\t\tsystem('sh', '-c', $editor.' \"$@\"', $editor, $_);\n-- \n1.7.0.2\n"},{"id":"137600","messageId":"20100323005806.GA9335@progeny.tock","threadId":"23140","inReplyTo":"eb0d92cf28820eb9783e789a8c4c62c3af4dd0d0.1269274203.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] send-email: lazily assign editor variable","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-23T00:58:06Z","receivedAt":"2010-03-23T00:58:06Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Michael J Gruber wrote:\n\n> b4479f0 (add -i, send-email, svn, p4, etc: use \"git var GIT_EDITOR\",\n> 2009-10-30) introduced the use of git var GIT_EDITOR which may lead to\n> problems when send-mail is used without a tty.\n> \n> Therefore, use git var GIT_EDITOR only when we actually edit something.\n> \n> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n\nFWIW:\n\n  Acked-by: Jonathan Nieder <jrnieder@gmail.com>\n\nNext time, please CC me.\n\nThanks,\nJonathan\n"},{"id":"137619","messageId":"A612847CFE53224C91B23E3A5B48BAC73EC0B01EE8@xmail3.se.axis.com","threadId":"23140","inReplyTo":"20100322232531.GA2168@progeny.tock","subject":"RE: [PATCH] send-email: do not check for editor until needed","fromName":"Peter Kjellerstedt","fromEmail":"peter.kjellerstedt@axis.com","sentAt":"2010-03-23T09:15:09Z","receivedAt":"2010-03-23T09:15:09Z","isPatch":true,"sender":{"key":"peter.kjellerstedt@axis.com","avatar":"https://gravatar.com/avatar/6d5a0182283c8eccd7b134a54dbfd5f30038f3ad4d38b96f424884b614a61ca2?d=mp&s=160"},"body":"> -----Original Message-----\n> From: git-owner@vger.kernel.org [mailto:git-owner@vger.kernel.org] On\n> Behalf Of Jonathan Nieder\n> Sent: den 23 mars 2010 00:26\n> To: Uwe Kleine-König\n> Cc: git@vger.kernel.org; Junio C Hamano; Marc Kleine-Budde; Jay Soffian\n> Subject: [PATCH] send-email: do not check for editor until needed\n> \n> Since b4479f074 (add -i, send-email, svn, p4, etc: use \"git var\n> GIT_EDITOR\", 2009-10-30), when called with TERM=dumb and without\n> GIT_EDITOR set, git send-email has been failing whether it needs\n> an editor or not:\n> \n>  $ ssh localhost git send-email --to=me --suppress-cc=all HEAD^..HEAD\n>  fatal: Terminal is dumb, but EDITOR unset\n>  var GIT_EDITOR: command returned error: 128\n> \n> This breaks use of git send-email in existing hook scripts.\n> \n> So do not check for an editor unless it is needed.\n> \n> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> Uwe Kleine-König wrote:\n> \n> > since b4479f074760a788dd4e353b8c86a7d735afc53e git send-email (and\n> > others) use git var GIT_EDITOR.  This is OK as such but it breaks the\n> > post-receive hooks that I use on several repositories.\n> [...]\n> > IMHO git send-email should only call $(git var GIT_EDITOR) when it\n> > actually needs it.\n> \n> Thanks for reporting.  Does this patch work for you?\n> \n> Now if I try without a tty, I get a different error:\n> \n>  $ ssh localhost cd $(pwd) '&&' \\\n> \tgit send-email --to=me --suppress-cc=all HEAD^..HEAD\n>  Can't locate object method \"IN\" via package \"FakeTerm\" at\n>  /home/jrn/tmp-git/libexec/git-core/git-send-email line 645.\n>  /tmp/olTiwjzrjx/0001-Git-1.7.0.3.patch\n> \n> I assume I am not using it correctly, since the relevant code has\n> been around for a while.\n> \n>  git-send-email.perl |    9 ++++++++-\n>  1 files changed, 8 insertions(+), 1 deletions(-)\n> \n> diff --git a/git-send-email.perl b/git-send-email.perl\n> index e05455f..9406cdd 100755\n> --- a/git-send-email.perl\n> +++ b/git-send-email.perl\n> @@ -162,9 +162,16 @@ my $compose_filename;\n> \n>  # Handle interactive edition of files.\n>  my $multiedit;\n> -my $editor = Git::command_oneline('var', 'GIT_EDITOR');\n> \n>  sub do_edit {\n> +\tmy $editor;\n> +\n> +\tif ($#_ == 0) {\n> +\t\treturn;\n> +\t}\n\nShouldn't that be:\n\n\tif ($#_ == -1) {\n\t\treturn;\n\t}\n\nor more readable:\n\n\treturn if (!@_);\n\nas I assume you are trying to protect do_edit() from being called \nwithout arguments?\n\n> +\tgit_cmd_try {\n> +\t\t$editor = Git::command_oneline('var', 'GIT_EDITOR');\n> +\t} \"no suitable text editor configured\\n\";\n>  \tif (defined($multiedit) && !$multiedit) {\n>  \t\tmap {\n>  \t\t\tsystem('sh', '-c', $editor.' \"$@\"', $editor, $_);\n> --\n> 1.7.0.2\n> \n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n\n//Peter\n"},{"id":"137624","messageId":"4BA89E53.3000201@drmicha.warpmail.net","threadId":"23140","inReplyTo":"20100323005806.GA9335@progeny.tock","subject":"Re: [PATCH] send-email: lazily assign editor variable","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-03-23T10:56:19Z","receivedAt":"2010-03-23T10:56:19Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Jonathan Nieder venit, vidit, dixit 23.03.2010 01:58:\n> Michael J Gruber wrote:\n> \n>> b4479f0 (add -i, send-email, svn, p4, etc: use \"git var GIT_EDITOR\",\n>> 2009-10-30) introduced the use of git var GIT_EDITOR which may lead to\n>> problems when send-mail is used without a tty.\n>>\n>> Therefore, use git var GIT_EDITOR only when we actually edit something.\n>>\n>> Signed-off-by: Michael J Gruber <git@drmicha.warpmail.net>\n>> Reported-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>\n> \n> FWIW:\n> \n>   Acked-by: Jonathan Nieder <jrnieder@gmail.com>\n> \n> Next time, please CC me.\n\nYep, sorry for the omission.\n\nMichael\n"},{"id":"137663","messageId":"20100323192557.GA1511@progeny.tock","threadId":"23140","inReplyTo":"A612847CFE53224C91B23E3A5B48BAC73EC0B01EE8@xmail3.se.axis.com","subject":"Re: [PATCH] send-email: do not check for editor until needed","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-23T19:25:57Z","receivedAt":"2010-03-23T19:25:57Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Peter Kjellerstedt wrote:\n\n> Shouldn't that be:\n> \n> \tif ($#_ == -1) {\n> \t\treturn;\n> \t}\n> \n> or more readable:\n> \n> \treturn if (!@_);\n\nProbably. :)\n\n> as I assume you are trying to protect do_edit() from being called \n> without arguments?\n\nI tested out Michael J Gruber’s simpler patch and it both makes sense\nand works fine, so I’d suggest going with it instead.\n\nStill, thanks for the comments.  It is good to know what I need to\nlearn.\n\nRegards,\nJonathan\n"},{"id":"137715","messageId":"7vaatxobef.fsf@alter.siamese.dyndns.org","threadId":"23140","inReplyTo":"eb0d92cf28820eb9783e789a8c4c62c3af4dd0d0.1269274203.git.git@drmicha.warpmail.net","subject":"Re: [PATCH] send-email: lazily assign editor variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-24T17:52:08Z","receivedAt":"2010-03-24T17:52:08Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n> b4479f0 (add -i, send-email, svn, p4, etc: use \"git var GIT_EDITOR\",\n> 2009-10-30) introduced the use of git var GIT_EDITOR which may lead to\n> problems when send-mail is used without a tty.\n\nWe would want to describe what kind of problems they are better than \"may\nlead to problems\", though.  Something like this?\n\n    b4479f0 (add -i, send-email, svn, p4, etc: use \"git var GIT_EDITOR\",\n    2009-10-30) introduced the use of \"git var GIT_EDITOR\" to obtain the\n    preferred editor program, instead of reading environment variables\n    themselves.\n\n    However, \"git var GIT_EDITOR\" run without a tty (think \"cron job\") would\n    give a fatal error \"Terminal is dumb, but EDITOR unset\".  This is not a\n    problem for add-i, svn, p4 and callers of git_editor() defined in\n    git-sh-setup, as all of these call it just before launching the editor.\n    At that point, we know the caller wants to edit, and they cannot without a\n    tty.\n\n    But send-email ran this near the beginning of the program, even if it is\n    not going to use any editor (e.g. run without --compose).  Fix this by\n    calling the command only when we edit a file.\n"},{"id":"137778","messageId":"20100325051743.GB5784@progeny.tock","threadId":"23140","inReplyTo":"7vaatxobef.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-email: lazily assign editor variable","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-25T05:17:43Z","receivedAt":"2010-03-25T05:17:43Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> We would want to describe what kind of problems they are better than \"may\n> lead to problems\", though.  Something like this?\n> \n>     b4479f0 (add -i, send-email, svn, p4, etc: use \"git var GIT_EDITOR\",\n>     2009-10-30) introduced the use of \"git var GIT_EDITOR\" to obtain the\n>     preferred editor program, instead of reading environment variables\n>     themselves.\n> \n>     However, \"git var GIT_EDITOR\" run without a tty (think \"cron job\") would\n>     give a fatal error \"Terminal is dumb, but EDITOR unset\".  This is not a\n>     problem for add-i, svn, p4 and callers of git_editor() defined in\n>     git-sh-setup, as all of these call it just before launching the editor.\n>     At that point, we know the caller wants to edit, and they cannot without a\n>     tty.\n> \n>     But send-email ran this near the beginning of the program, even if it is\n>     not going to use any editor (e.g. run without --compose).  Fix this by\n>     calling the command only when we edit a file.\n\nYes, please.  It would be more precise to\n\n  s/without a tty/with TERM=dumb/\n\nin the second paragraph but regardless this is a good description of the\nproblem.\n"},{"id":"137786","messageId":"4BAB18C6.6010202@drmicha.warpmail.net","threadId":"23140","inReplyTo":"7vaatxobef.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-email: lazily assign editor variable","fromName":"Michael J Gruber","fromEmail":"git@drmicha.warpmail.net","sentAt":"2010-03-25T08:03:18Z","receivedAt":"2010-03-25T08:03:18Z","isPatch":true,"sender":{"key":"git@grubix.eu","avatar":"https://avatars.githubusercontent.com/u/233215?v=4"},"body":"Junio C Hamano venit, vidit, dixit 24.03.2010 18:52:\n> Michael J Gruber <git@drmicha.warpmail.net> writes:\n> \n>> b4479f0 (add -i, send-email, svn, p4, etc: use \"git var GIT_EDITOR\",\n>> 2009-10-30) introduced the use of git var GIT_EDITOR which may lead to\n>> problems when send-mail is used without a tty.\n> \n> We would want to describe what kind of problems they are better than \"may\n> lead to problems\", though.  Something like this?\n> \n>     b4479f0 (add -i, send-email, svn, p4, etc: use \"git var GIT_EDITOR\",\n>     2009-10-30) introduced the use of \"git var GIT_EDITOR\" to obtain the\n>     preferred editor program, instead of reading environment variables\n>     themselves.\n> \n>     However, \"git var GIT_EDITOR\" run without a tty (think \"cron job\") would\n\nAlso think \"hook\" ;)\n\n>     give a fatal error \"Terminal is dumb, but EDITOR unset\".  This is not a\n>     problem for add-i, svn, p4 and callers of git_editor() defined in\n>     git-sh-setup, as all of these call it just before launching the editor.\n>     At that point, we know the caller wants to edit, and they cannot without a\n>     tty.\n> \n>     But send-email ran this near the beginning of the program, even if it is\n>     not going to use any editor (e.g. run without --compose).  Fix this by\n>     calling the command only when we edit a file.\n> \n> \n\nYep, I'm fine with this.\n\nCheers,\nMichael\n"},{"id":"137887","messageId":"7v8w9elvz7.fsf@alter.siamese.dyndns.org","threadId":"23140","inReplyTo":"4BAB18C6.6010202@drmicha.warpmail.net","subject":"Re: [PATCH] send-email: lazily assign editor variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-26T19:32:44Z","receivedAt":"2010-03-26T19:32:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Michael J Gruber <git@drmicha.warpmail.net> writes:\n\n>>     However, \"git var GIT_EDITOR\" run without a tty (think \"cron job\") would\n>\n> Also think \"hook\" ;)\n\nYes, remote hooks invoked over ssh transport won't usually have a tty, but\nthe local hooks (e.g. post-commit) usually do, I think.\n\n> Yep, I'm fine with this.\n\nThanks.\n"},{"id":"137889","messageId":"7v39zmlvz1.fsf@alter.siamese.dyndns.org","threadId":"23140","inReplyTo":"20100325051743.GB5784@progeny.tock","subject":"Re: [PATCH] send-email: lazily assign editor variable","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-03-26T19:32:50Z","receivedAt":"2010-03-26T19:32:50Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Jonathan Nieder <jrnieder@gmail.com> writes:\n\n> Yes, please.  It would be more precise to\n>\n>   s/without a tty/with TERM=dumb/\n>\n> in the second paragraph but regardless this is a good description of the\n> problem.\n\nStrictly speaking, with TERM=dumb the true \"vi\" fell back to the ex mode\nand should have been usable.  A purist might say it is a bug that we fatal\nout in this case (I know that it is deliberately done to help newbies from\ncommon confusion by not running any editor with TERM=dumb, but to a purist\nin me it feels somewhat wrong).\n"},{"id":"137903","messageId":"20100326214540.GA17503@progeny.tock","threadId":"23140","inReplyTo":"7v39zmlvz1.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] send-email: lazily assign editor variable","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-03-26T21:45:41Z","receivedAt":"2010-03-26T21:45:41Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n> Jonathan Nieder <jrnieder@gmail.com> writes:\n\n>> Yes, please.  It would be more precise to\n>>\n>>   s/without a tty/with TERM=dumb/\n>>\n>> in the second paragraph but regardless this is a good description of the\n>> problem.\n>\n> Strictly speaking, with TERM=dumb the true \"vi\" fell back to the ex mode\n> and should have been usable.  A purist might say it is a bug that we fatal\n> out in this case (I know that it is deliberately done to help newbies from\n> common confusion by not running any editor with TERM=dumb, but to a purist\n> in me it feels somewhat wrong).\n\nWith DISPLAY set, running “TERM=dumb vi | cat” with an appropriate\nsymlink in $PATH:\n\nvim\n\tPrints “Vim: Warning: Output is not to a terminal” to stderr,\n\twaits about a second, then\n\truns without clearing the screen, using ANSI escapes to move around.\n\nelvis 1.4\n\tPrints “This termcap entry lacks the :up=: capability” to stderr,\n\tfails with status 1.\n\nelvis 2 (more precisely, the elvisnox script from Debian)\n\tPrints “termcap needs up” to stderr,\n\tfails with status 1.\n\nnvi\n\tPrints “ex/vi: Vi's standard input and output must be a terminal” to stderr,\n\tfails with status 1.\n\nWith TERM=dumb but standard output going straight to the terminal, the\nsituation is not very different for vim and elvis, while nvi gets\nutterly confused (it only writes output to the bottom line for some\nreason).\n\nSo I think it still makes sense to work around this bug in the vi clones.\n\nHTH,\nJonathan\n"}]}