{"thread":{"id":"12543","subject":"[PATCH] t9001: set TERM=dumb to prevent ANSI output","startedAt":"2008-03-06T16:53:28Z","lastAt":"2008-03-07T18:49:02Z","messageCount":9,"participants":["Johannes Schindelin","Junio C Hamano","Christian Couder"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"71256","messageId":"alpine.LSU.1.00.0803061752340.3941@racer.site","threadId":"12543","inReplyTo":null,"subject":"[PATCH] t9001: set TERM=dumb to prevent ANSI output","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-03-06T16:53:28Z","receivedAt":"2008-03-06T16:53:28Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nAt least on one of my machines, Term::ReadLine tries to be clever and\nsends \\x1b\\x5b1034h at the end of the script when TERM is set to 'xterm'.\n\nTo prevent that, force TERM=dumb just for the test.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n t/t9001-send-email.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex cbbfa9c..d6fcac3 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -68,7 +68,7 @@ Result: OK\n EOF\n \n test_expect_success 'Show all headers' '\n-\tgit send-email \\\n+\tTERM=dumb git send-email \\\n \t\t--dry-run \\\n \t\t--from=\"Example <from@example.com>\" \\\n \t\t--to=to@example.com \\\n-- \n1.5.4.3.571.g9aec3.dirty\n\n"},{"id":"71291","messageId":"7vmypb8muj.fsf@gitster.siamese.dyndns.org","threadId":"12543","inReplyTo":"alpine.LSU.1.00.0803061752340.3941@racer.site","subject":"Re: [PATCH] t9001: set TERM=dumb to prevent ANSI output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-06T23:16:36Z","receivedAt":"2008-03-06T23:16:36Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> At least on one of my machines, Term::ReadLine tries to be clever and\n> sends \\x1b\\x5b1034h at the end of the script when TERM is set to 'xterm'.\n>\n> To prevent that, force TERM=dumb just for the test.\n\nWe try to set up a pretty vanilla environment for test repeatability in\nt/test-lib.sh, and I suspect we would simply want to do this over there.\n\nWouldn't this make more sense?\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex 87a5ea4..7f6331a 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -7,8 +7,9 @@\n LANG=C\n LC_ALL=C\n PAGER=cat\n+TERM=dumb\n TZ=UTC\n-export LANG LC_ALL PAGER TZ\n+export LANG LC_ALL PAGER TERM TZ\n EDITOR=:\n VISUAL=:\n unset GIT_EDITOR\n\n"},{"id":"71292","messageId":"alpine.LSU.1.00.0803070112050.3941@racer.site","threadId":"12543","inReplyTo":"7vmypb8muj.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] t9001: set TERM=dumb to prevent ANSI output","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-03-07T00:12:23Z","receivedAt":"2008-03-07T00:12:23Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 6 Mar 2008, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > At least on one of my machines, Term::ReadLine tries to be clever and\n> > sends \\x1b\\x5b1034h at the end of the script when TERM is set to 'xterm'.\n> >\n> > To prevent that, force TERM=dumb just for the test.\n> \n> We try to set up a pretty vanilla environment for test repeatability in\n> t/test-lib.sh, and I suspect we would simply want to do this over there.\n> \n> Wouldn't this make more sense?\n\nSure!\n\nCiao,\nDscho\n"},{"id":"71316","messageId":"200803070541.15793.chriscool@tuxfamily.org","threadId":"12543","inReplyTo":"7vmypb8muj.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] t9001: set TERM=dumb to prevent ANSI output","fromName":"Christian Couder","fromEmail":"chriscool@tuxfamily.org","sentAt":"2008-03-07T04:41:15Z","receivedAt":"2008-03-07T04:41:15Z","isPatch":true,"sender":{"key":"christian.couder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/208954?v=4"},"body":"Le vendredi 7 mars 2008, Junio C Hamano a écrit :\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> > At least on one of my machines, Term::ReadLine tries to be clever and\n> > sends \\x1b\\x5b1034h at the end of the script when TERM is set to\n> > 'xterm'.\n> >\n> > To prevent that, force TERM=dumb just for the test.\n>\n> We try to set up a pretty vanilla environment for test repeatability in\n> t/test-lib.sh, and I suspect we would simply want to do this over there.\n>\n> Wouldn't this make more sense?\n>\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index 87a5ea4..7f6331a 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -7,8 +7,9 @@\n>  LANG=C\n>  LC_ALL=C\n>  PAGER=cat\n> +TERM=dumb\n>  TZ=UTC\n> -export LANG LC_ALL PAGER TZ\n> +export LANG LC_ALL PAGER TERM TZ\n>  EDITOR=:\n>  VISUAL=:\n>  unset GIT_EDITOR\n\nThis may not work well with colored output.\nIn test-lib.sh line 62 there is :\n\n[ \"x$TERM\" != \"xdumb\" ] &&\n\t[ -t 1 ] &&\n\ttput bold >/dev/null 2>&1 &&\n\ttput setaf 1 >/dev/null 2>&1 &&\n\ttput sgr0 >/dev/null 2>&1 &&\n\tcolor=t\n\nThanks,\nChristian.\n"},{"id":"71317","messageId":"7v7igf5cpk.fsf@gitster.siamese.dyndns.org","threadId":"12543","inReplyTo":"200803070541.15793.chriscool@tuxfamily.org","subject":"Re: [PATCH] t9001: set TERM=dumb to prevent ANSI output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-07T05:23:51Z","receivedAt":"2008-03-07T05:23:51Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Christian Couder <chriscool@tuxfamily.org> writes:\n\n> Le vendredi 7 mars 2008, Junio C Hamano a écrit :\n>> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n>> > At least on one of my machines, Term::ReadLine tries to be clever and\n>> > sends \\x1b\\x5b1034h at the end of the script when TERM is set to\n>> > 'xterm'.\n>> >\n>> > To prevent that, force TERM=dumb just for the test.\n>>\n>> We try to set up a pretty vanilla environment for test repeatability in\n>> t/test-lib.sh, and I suspect we would simply want to do this over there.\n>>\n>> Wouldn't this make more sense?\n>>\n>> diff --git a/t/test-lib.sh b/t/test-lib.sh\n>> index 87a5ea4..7f6331a 100644\n>> --- a/t/test-lib.sh\n>> +++ b/t/test-lib.sh\n>> @@ -7,8 +7,9 @@\n>>  LANG=C\n>>  LC_ALL=C\n>>  PAGER=cat\n>> +TERM=dumb\n>>  TZ=UTC\n>> -export LANG LC_ALL PAGER TZ\n>> +export LANG LC_ALL PAGER TERM TZ\n>>  EDITOR=:\n>>  VISUAL=:\n>>  unset GIT_EDITOR\n>\n> This may not work well with colored output.\n> In test-lib.sh line 62 there is :\n>\n> [ \"x$TERM\" != \"xdumb\" ] &&\n> \t[ -t 1 ] &&\n> \ttput bold >/dev/null 2>&1 &&\n> \ttput setaf 1 >/dev/null 2>&1 &&\n> \ttput sgr0 >/dev/null 2>&1 &&\n> \tcolor=t\n\nAhh.  Sorry about that.\n\n t/test-lib.sh |   20 ++++++++++++--------\n 1 files changed, 12 insertions(+), 8 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex c0c5e21..8a8b33e 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -3,12 +3,23 @@\n # Copyright (c) 2005 Junio C Hamano\n #\n \n+# Grab if the true terminal is capable of color before resetting\n+# TERM to dumb for repeatability\n+\n+[ \"x$TERM\" != \"xdumb\" ] &&\n+\t[ -t 1 ] &&\n+\ttput bold >/dev/null 2>&1 &&\n+\ttput setaf 1 >/dev/null 2>&1 &&\n+\ttput sgr0 >/dev/null 2>&1 &&\n+\tcolor=t\n+\n # For repeatability, reset the environment to known value.\n LANG=C\n LC_ALL=C\n PAGER=cat\n TZ=UTC\n-export LANG LC_ALL PAGER TZ\n+TERM=dumb\n+export LANG LC_ALL PAGER TERM TZ\n EDITOR=:\n VISUAL=:\n unset GIT_EDITOR\n@@ -59,13 +70,6 @@ esac\n # '\n # . ./test-lib.sh\n \n-[ \"x$TERM\" != \"xdumb\" ] &&\n-\t[ -t 1 ] &&\n-\ttput bold >/dev/null 2>&1 &&\n-\ttput setaf 1 >/dev/null 2>&1 &&\n-\ttput sgr0 >/dev/null 2>&1 &&\n-\tcolor=t\n"},{"id":"71319","messageId":"7vskz33vow.fsf@gitster.siamese.dyndns.org","threadId":"12543","inReplyTo":"7v7igf5cpk.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] t9001: set TERM=dumb to prevent ANSI output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-07T06:16:47Z","receivedAt":"2008-03-07T06:16:47Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n> Christian Couder <chriscool@tuxfamily.org> writes:\n> ...\n>> This may not work well with colored output.\n>> In test-lib.sh line 62 there is :\n>>\n>> [ \"x$TERM\" != \"xdumb\" ] &&\n>> \t[ -t 1 ] &&\n>> \ttput bold >/dev/null 2>&1 &&\n>> \ttput setaf 1 >/dev/null 2>&1 &&\n>> \ttput sgr0 >/dev/null 2>&1 &&\n>> \tcolor=t\n>\n> Ahh.  Sorry about that.\n\nAhem, third time lucky.\n\n-- >8 --\n[PATCH] test-lib: fix TERM to dumb for test repeatability\n\nDscho noticed that Term::ReadLine (used by send-email) colorized its\noutput for his TERM settings, inside t9001 tests.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/test-lib.sh |   24 +++++++++++++++++-------\n 1 files changed, 17 insertions(+), 7 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex c0c5e21..44f5776 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -3,12 +3,16 @@\n # Copyright (c) 2005 Junio C Hamano\n #\n \n+# Keep the original TERM for say_color\n+ORIGINAL_TERM=$TERM\n+\n # For repeatability, reset the environment to known value.\n LANG=C\n LC_ALL=C\n PAGER=cat\n TZ=UTC\n-export LANG LC_ALL PAGER TZ\n+TERM=dumb\n+export LANG LC_ALL PAGER TERM TZ\n EDITOR=:\n VISUAL=:\n unset GIT_EDITOR\n@@ -58,12 +62,14 @@ esac\n # This test checks if command xyzzy does the right thing...\n # '\n # . ./test-lib.sh\n-\n-[ \"x$TERM\" != \"xdumb\" ] &&\n-\t[ -t 1 ] &&\n-\ttput bold >/dev/null 2>&1 &&\n-\ttput setaf 1 >/dev/null 2>&1 &&\n-\ttput sgr0 >/dev/null 2>&1 &&\n+[ \"x$ORIGINAL_TERM\" != \"xdumb\" ] && (\n+\t\tTERM=$ORIGINAL_TERM &&\n+\t\texport TERM &&\n+\t\t[ -t 1 ] &&\n+\t\ttput bold >/dev/null 2>&1 &&\n+\t\ttput setaf 1 >/dev/null 2>&1 &&\n+\t\ttput sgr0 >/dev/null 2>&1\n+\t) &&\n \tcolor=t\n \n while test \"$#\" -ne 0\n@@ -91,6 +97,9 @@ done\n \n if test -n \"$color\"; then\n \tsay_color () {\n+\t\t(\n+\t\tTERM=$ORIGINAL_TERM\n+\t\texport TERM\n \t\tcase \"$1\" in\n \t\t\terror) tput bold; tput setaf 1;; # bold red\n \t\t\tskip)  tput bold; tput setaf 2;; # bold green\n@@ -101,6 +110,7 @@ if test -n \"$color\"; then\n \t\tshift\n \t\techo \"* $*\"\n \t\ttput sgr0\n+\t\t)\n \t}\n else\n \tsay_color() {\n-- \n1.5.4.3.587.g0bdd73\n\n"},{"id":"71333","messageId":"alpine.LSU.1.00.0803071240590.19395@racer.site","threadId":"12543","inReplyTo":"7vskz33vow.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] t9001: set TERM=dumb to prevent ANSI output","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-03-07T11:41:39Z","receivedAt":"2008-03-07T11:41:39Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Thu, 6 Mar 2008, Junio C Hamano wrote:\n\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n> > Christian Couder <chriscool@tuxfamily.org> writes:\n> > ...\n> >> This may not work well with colored output.\n> >> In test-lib.sh line 62 there is :\n> >>\n> >> [ \"x$TERM\" != \"xdumb\" ] &&\n> >> \t[ -t 1 ] &&\n> >> \ttput bold >/dev/null 2>&1 &&\n> >> \ttput setaf 1 >/dev/null 2>&1 &&\n> >> \ttput sgr0 >/dev/null 2>&1 &&\n> >> \tcolor=t\n> >\n> > Ahh.  Sorry about that.\n> \n> Ahem, third time lucky.\n\nWell, with this:\n\n>  t/test-lib.sh |   24 +++++++++++++++++-------\n\nI think it is no longer worth it _not_ to special-case it.  IOW I'd prefer \nmy original patch for simplicity.\n\nCiao,\nDscho\n"},{"id":"71360","messageId":"7vbq5q301l.fsf@gitster.siamese.dyndns.org","threadId":"12543","inReplyTo":"alpine.LSU.1.00.0803071240590.19395@racer.site","subject":"Re: [PATCH] t9001: set TERM=dumb to prevent ANSI output","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-03-07T17:40:22Z","receivedAt":"2008-03-07T17:40:22Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n\n> Hi,\n>\n> On Thu, 6 Mar 2008, Junio C Hamano wrote:\n>\n>> Junio C Hamano <gitster@pobox.com> writes:\n>> \n>> > Christian Couder <chriscool@tuxfamily.org> writes:\n>> > ...\n>> >> This may not work well with colored output.\n>> >> In test-lib.sh line 62 there is :\n>> >>\n>> >> [ \"x$TERM\" != \"xdumb\" ] &&\n>> >> \t[ -t 1 ] &&\n>> >> \ttput bold >/dev/null 2>&1 &&\n>> >> \ttput setaf 1 >/dev/null 2>&1 &&\n>> >> \ttput sgr0 >/dev/null 2>&1 &&\n>> >> \tcolor=t\n>> >\n>> > Ahh.  Sorry about that.\n>> \n>> Ahem, third time lucky.\n>\n> Well, with this:\n>\n>>  t/test-lib.sh |   24 +++++++++++++++++-------\n>\n> I think it is no longer worth it _not_ to special-case it.  IOW I'd prefer \n> my original patch for simplicity.\n\nHmm.  Do you still prefer \"patch individual\" approach, even after\nconsidering longer term maintainability?\n"},{"id":"71371","messageId":"alpine.LSU.1.00.0803071948000.19395@racer.site","threadId":"12543","inReplyTo":"7vbq5q301l.fsf@gitster.siamese.dyndns.org","subject":"Re: [PATCH] t9001: set TERM=dumb to prevent ANSI output","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-03-07T18:49:02Z","receivedAt":"2008-03-07T18:49:02Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Fri, 7 Mar 2008, Junio C Hamano wrote:\n\n> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:\n> \n> > Hi,\n> >\n> > On Thu, 6 Mar 2008, Junio C Hamano wrote:\n> >\n> >> Junio C Hamano <gitster@pobox.com> writes:\n> >> \n> >> > Christian Couder <chriscool@tuxfamily.org> writes:\n> >> > ...\n> >> >> This may not work well with colored output.\n> >> >> In test-lib.sh line 62 there is :\n> >> >>\n> >> >> [ \"x$TERM\" != \"xdumb\" ] &&\n> >> >> \t[ -t 1 ] &&\n> >> >> \ttput bold >/dev/null 2>&1 &&\n> >> >> \ttput setaf 1 >/dev/null 2>&1 &&\n> >> >> \ttput sgr0 >/dev/null 2>&1 &&\n> >> >> \tcolor=t\n> >> >\n> >> > Ahh.  Sorry about that.\n> >> \n> >> Ahem, third time lucky.\n> >\n> > Well, with this:\n> >\n> >>  t/test-lib.sh |   24 +++++++++++++++++-------\n> >\n> > I think it is no longer worth it _not_ to special-case it.  IOW I'd prefer \n> > my original patch for simplicity.\n> \n> Hmm.  Do you still prefer \"patch individual\" approach, even after\n> considering longer term maintainability?\n\nWell, I am not the maintainer, and I don't envy you for that.\n\nYou are a kick-ass maintainer, so I think whatever you feel is the best \nway to proceed now, is good.\n\nCiao,\nDscho\n\n"}]}