{"thread":{"id":"35620","subject":"[PATCH] pager: set LV=-c alongside LESS=FRSX","startedAt":"2014-01-07T02:14:05Z","lastAt":"2014-01-31T17:07:44Z","messageCount":7,"participants":["Jonathan Nieder","Olaf Meeuwissen","Junio C Hamano","Andreas Schwab","Anders Kaseorg"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"232794","messageId":"20140107021404.GK3881@google.com","threadId":"35620","inReplyTo":"874n5ghenr.fsf@helix.nebula.avasys.jp","subject":"[PATCH] pager: set LV=-c alongside LESS=FRSX","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-01-07T02:14:05Z","receivedAt":"2014-01-07T02:14:05Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"On systems with lv configured as the preferred pager (i.e.,\nDEFAULT_PAGER=lv at build time, or PAGER=lv exported in the\nenvironment) git commands that use color show control codes instead of\ncolor in the pager:\n\n\t$ git diff\n\t^[[1mdiff --git a/.mailfilter b/.mailfilter^[[m\n\t^[[1mindex aa4f0b2..17e113e 100644^[[m\n\t^[[1m--- a/.mailfilter^[[m\n\t^[[1m+++ b/.mailfilter^[[m\n\t^[[36m@@ -1,11 +1,58 @@^[[m\n\n\"less\" avoids this problem because git uses the LESS environment\nvariable to pass the -R option ('output ANSI color escapes in raw\nform') by default.  Use the LV environment variable to pass 'lv' the\n-c option ('allow ANSI escape sequences for text decoration / color')\nto fix it for lv, too.\n\nNoticed when the default value for color.ui flipped to 'auto' in\nv1.8.4-rc0~36^2~1 (2013-06-10).\n\nReported-by: Olaf Meeuwissen <olaf.meeuwissen@avasys.jp>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nOlaf Meeuwissen wrote[1]:\n\n> Yes, it's called LV and documented in the lv(1) manual page.  Simply\n> search for 'env' ;-)\n\nAh, thanks.  How about this patch?\n\n[1] http://bugs.debian.org/730527\n\n Documentation/config.txt |  4 ++++\n git-sh-setup.sh          |  3 ++-\n pager.c                  | 11 +++++++++--\n perl/Git/SVN/Log.pm      |  1 +\n t/t7006-pager.sh         | 12 ++++++++++++\n 5 files changed, 28 insertions(+), 3 deletions(-)\n\ndiff --git a/Documentation/config.txt b/Documentation/config.txt\nindex a405806..ed59853 100644\n--- a/Documentation/config.txt\n+++ b/Documentation/config.txt\n@@ -567,6 +567,10 @@ be passed to the shell by Git, which will translate the final\n command to `LESS=FRSX less -+S`. The environment tells the command\n to set the `S` option to chop long lines but the command line\n resets it to the default to fold long lines.\n++\n+Likewise, when the `LV` environment variable is unset, Git sets it\n+to `-c`.  You can override this setting by exporting `LV` with\n+another value or setting `core.pager` to `lv +c`.\n \n core.whitespace::\n \tA comma separated list of common whitespace problems to\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 190a539..fffa3c7 100644\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -159,7 +159,8 @@ git_pager() {\n \t\tGIT_PAGER=cat\n \tfi\n \t: ${LESS=-FRSX}\n-\texport LESS\n+\t: ${LV=-c}\n+\texport LESS LV\n \n \teval \"$GIT_PAGER\" '\"$@\"'\n }\ndiff --git a/pager.c b/pager.c\nindex 345b0bc..0cc75a8 100644\n--- a/pager.c\n+++ b/pager.c\n@@ -80,8 +80,15 @@ void setup_pager(void)\n \tpager_process.use_shell = 1;\n \tpager_process.argv = pager_argv;\n \tpager_process.in = -1;\n-\tif (!getenv(\"LESS\")) {\n-\t\tstatic const char *env[] = { \"LESS=FRSX\", NULL };\n+\tif (!getenv(\"LESS\") || !getenv(\"LV\")) {\n+\t\tstatic const char *env[3];\n+\t\tint i = 0;\n+\n+\t\tif (!getenv(\"LESS\"))\n+\t\t\tenv[i++] = \"LESS=FRSX\";\n+\t\tif (!getenv(\"LV\"))\n+\t\t\tenv[i++] = \"LV=-c\";\n+\t\tenv[i] = NULL;\n \t\tpager_process.env = env;\n \t}\n \tif (start_command(&pager_process))\ndiff --git a/perl/Git/SVN/Log.pm b/perl/Git/SVN/Log.pm\nindex 3f8350a..34f2869 100644\n--- a/perl/Git/SVN/Log.pm\n+++ b/perl/Git/SVN/Log.pm\n@@ -117,6 +117,7 @@ sub run_pager {\n \t}\n \topen STDIN, '<&', $rfd or fatal \"Can't redirect stdin: $!\";\n \t$ENV{LESS} ||= 'FRSX';\n+\t$ENV{LV} ||= '-c';\n \texec $pager or fatal \"Can't run pager: $! ($pager)\";\n }\n \ndiff --git a/t/t7006-pager.sh b/t/t7006-pager.sh\nindex ff25908..7fe3367 100755\n--- a/t/t7006-pager.sh\n+++ b/t/t7006-pager.sh\n@@ -37,6 +37,18 @@ test_expect_failure TTY 'pager runs from subdir' '\n \ttest_cmp expected actual\n '\n \n+test_expect_success TTY 'LESS and LV envvars are set for pagination' '\n+\t(\n+\t\tsane_unset LESS LV &&\n+\t\tPAGER=\"env >pager-env.out\" &&\n+\t\texport PAGER &&\n+\n+\t\ttest_terminal git log\n+\t) &&\n+\tgrep ^LESS= pager-env.out &&\n+\tgrep ^LV= pager-env.out\n+'\n+\n test_expect_success TTY 'some commands do not use a pager' '\n \trm -f paginated.out &&\n \ttest_terminal git rev-list HEAD &&\n-- \n1.8.5.1\n"},{"id":"232799","messageId":"87zjn8o2le.fsf@helix.nebula.avasys.jp","threadId":"35620","inReplyTo":"20140107021404.GK3881@google.com","subject":"Re: [PATCH] pager: set LV=-c alongside LESS=FRSX","fromName":"Olaf Meeuwissen","fromEmail":"olaf.meeuwissen@avasys.jp","sentAt":"2014-01-07T04:09:01Z","receivedAt":"2014-01-07T04:09:01Z","isPatch":true,"sender":{"key":"olaf.meeuwissen@avasys.jp","avatar":null},"body":"Jonathan Nieder writes:\n\n> On systems with lv configured as the preferred pager (i.e.,\n> DEFAULT_PAGER=lv at build time, or PAGER=lv exported in the\n> environment) git commands that use color show control codes instead of\n> color in the pager:\n>\n> \t$ git diff\n> \t^[[1mdiff --git a/.mailfilter b/.mailfilter^[[m\n> \t^[[1mindex aa4f0b2..17e113e 100644^[[m\n> \t^[[1m--- a/.mailfilter^[[m\n> \t^[[1m+++ b/.mailfilter^[[m\n> \t^[[36m@@ -1,11 +1,58 @@^[[m\n>\n> \"less\" avoids this problem because git uses the LESS environment\n> variable to pass the -R option ('output ANSI color escapes in raw\n> form') by default.  Use the LV environment variable to pass 'lv' the\n> -c option ('allow ANSI escape sequences for text decoration / color')\n> to fix it for lv, too.\n>\n> Noticed when the default value for color.ui flipped to 'auto' in\n> v1.8.4-rc0~36^2~1 (2013-06-10).\n>\n> Reported-by: Olaf Meeuwissen <olaf.meeuwissen@avasys.jp>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> Olaf Meeuwissen wrote[1]:\n>\n>> Yes, it's called LV and documented in the lv(1) manual page.  Simply\n>> search for 'env' ;-)\n>\n> Ah, thanks.  How about this patch?\n\nI'm not qualified to judge the appropriateness of your patch, but if it\nachieves activating the -c option of lv when that is the pager in effect\nthen that should work for the bulk of the use cases, I'd think.\n\n> [1] http://bugs.debian.org/730527\n>\n>  Documentation/config.txt |  4 ++++\n>  git-sh-setup.sh          |  3 ++-\n>  pager.c                  | 11 +++++++++--\n>  perl/Git/SVN/Log.pm      |  1 +\n>  t/t7006-pager.sh         | 12 ++++++++++++\n>  5 files changed, 28 insertions(+), 3 deletions(-)\n>\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index a405806..ed59853 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -567,6 +567,10 @@ be passed to the shell by Git, which will translate the final\n>  command to `LESS=FRSX less -+S`. The environment tells the command\n>  to set the `S` option to chop long lines but the command line\n>  resets it to the default to fold long lines.\n> ++\n> +Likewise, when the `LV` environment variable is unset, Git sets it\n> +to `-c`.  You can override this setting by exporting `LV` with\n> +another value or setting `core.pager` to `lv +c`.\n>  \n>  core.whitespace::\n>  \tA comma separated list of common whitespace problems to\n> diff --git a/git-sh-setup.sh b/git-sh-setup.sh\n> index 190a539..fffa3c7 100644\n> --- a/git-sh-setup.sh\n> +++ b/git-sh-setup.sh\n> @@ -159,7 +159,8 @@ git_pager() {\n>  \t\tGIT_PAGER=cat\n>  \tfi\n>  \t: ${LESS=-FRSX}\n> -\texport LESS\n> +\t: ${LV=-c}\n> +\texport LESS LV\n>  \n>  \teval \"$GIT_PAGER\" '\"$@\"'\n>  }\n> diff --git a/pager.c b/pager.c\n> index 345b0bc..0cc75a8 100644\n> --- a/pager.c\n> +++ b/pager.c\n> @@ -80,8 +80,15 @@ void setup_pager(void)\n>  \tpager_process.use_shell = 1;\n>  \tpager_process.argv = pager_argv;\n>  \tpager_process.in = -1;\n> -\tif (!getenv(\"LESS\")) {\n> -\t\tstatic const char *env[] = { \"LESS=FRSX\", NULL };\n> +\tif (!getenv(\"LESS\") || !getenv(\"LV\")) {\n> +\t\tstatic const char *env[3];\n> +\t\tint i = 0;\n> +\n> +\t\tif (!getenv(\"LESS\"))\n> +\t\t\tenv[i++] = \"LESS=FRSX\";\n> +\t\tif (!getenv(\"LV\"))\n> +\t\t\tenv[i++] = \"LV=-c\";\n> +\t\tenv[i] = NULL;\n>  \t\tpager_process.env = env;\n>  \t}\n>  \tif (start_command(&pager_process))\n> diff --git a/perl/Git/SVN/Log.pm b/perl/Git/SVN/Log.pm\n> index 3f8350a..34f2869 100644\n> --- a/perl/Git/SVN/Log.pm\n> +++ b/perl/Git/SVN/Log.pm\n> @@ -117,6 +117,7 @@ sub run_pager {\n>  \t}\n>  \topen STDIN, '<&', $rfd or fatal \"Can't redirect stdin: $!\";\n>  \t$ENV{LESS} ||= 'FRSX';\n> +\t$ENV{LV} ||= '-c';\n>  \texec $pager or fatal \"Can't run pager: $! ($pager)\";\n>  }\n>  \n> diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh\n> index ff25908..7fe3367 100755\n> --- a/t/t7006-pager.sh\n> +++ b/t/t7006-pager.sh\n> @@ -37,6 +37,18 @@ test_expect_failure TTY 'pager runs from subdir' '\n>  \ttest_cmp expected actual\n>  '\n>  \n> +test_expect_success TTY 'LESS and LV envvars are set for pagination' '\n> +\t(\n> +\t\tsane_unset LESS LV &&\n> +\t\tPAGER=\"env >pager-env.out\" &&\n> +\t\texport PAGER &&\n> +\n> +\t\ttest_terminal git log\n> +\t) &&\n> +\tgrep ^LESS= pager-env.out &&\n> +\tgrep ^LV= pager-env.out\n> +'\n> +\n>  test_expect_success TTY 'some commands do not use a pager' '\n>  \trm -f paginated.out &&\n>  \ttest_terminal git rev-list HEAD &&\n\nHope this helps,\n-- \nOlaf Meeuwissen, LPIC-2           FLOSS Engineer -- AVASYS CORPORATION\nFSF Associate Member #1962               Help support software freedom\n                 http://www.fsf.org/jf?referrer=1962\n"},{"id":"232810","messageId":"xmqqha9fg225.fsf@gitster.dls.corp.google.com","threadId":"35620","inReplyTo":"20140107021404.GK3881@google.com","subject":"Re: [PATCH] pager: set LV=-c alongside LESS=FRSX","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-01-07T17:00:02Z","receivedAt":"2014-01-07T17:00:02Z","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> On systems with lv configured as the preferred pager (i.e.,\n> DEFAULT_PAGER=lv at build time, or PAGER=lv exported in the\n> environment) git commands that use color show control codes instead of\n> color in the pager:\n>\n> \t$ git diff\n> \t^[[1mdiff --git a/.mailfilter b/.mailfilter^[[m\n> \t^[[1mindex aa4f0b2..17e113e 100644^[[m\n> \t^[[1m--- a/.mailfilter^[[m\n> \t^[[1m+++ b/.mailfilter^[[m\n> \t^[[36m@@ -1,11 +1,58 @@^[[m\n>\n> \"less\" avoids this problem because git uses the LESS environment\n> variable to pass the -R option ('output ANSI color escapes in raw\n> form') by default.  Use the LV environment variable to pass 'lv' the\n> -c option ('allow ANSI escape sequences for text decoration / color')\n> to fix it for lv, too.\n>\n> Noticed when the default value for color.ui flipped to 'auto' in\n> v1.8.4-rc0~36^2~1 (2013-06-10).\n>\n> Reported-by: Olaf Meeuwissen <olaf.meeuwissen@avasys.jp>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> Olaf Meeuwissen wrote[1]:\n>\n>> Yes, it's called LV and documented in the lv(1) manual page.  Simply\n>> search for 'env' ;-)\n>\n> Ah, thanks.  How about this patch?\n>\n> [1] http://bugs.debian.org/730527\n\nLooks good; though I have to wonder two (and a half) things:\n\n - Scripted Porcelains get LESS=-FRSX while C Porcelains get\n   LESS=FRSX as the default (the leading dash being the\n   difference), which looks somewhat inconsistent.  Not a new\n   problem, though.\n\n - Can we generalize this a bit so that a builder can pass a list\n   of var=val pairs and demote the existing LESS=FRSX to just a\n   canned setting of such a mechanism?\n\n - Can such a code be reused to make this into a runtime setting,\n   even?  Would it be worth the complexity?\n\nThanks.\n\n>  Documentation/config.txt |  4 ++++\n>  git-sh-setup.sh          |  3 ++-\n>  pager.c                  | 11 +++++++++--\n>  perl/Git/SVN/Log.pm      |  1 +\n>  t/t7006-pager.sh         | 12 ++++++++++++\n>  5 files changed, 28 insertions(+), 3 deletions(-)\n>\n> diff --git a/Documentation/config.txt b/Documentation/config.txt\n> index a405806..ed59853 100644\n> --- a/Documentation/config.txt\n> +++ b/Documentation/config.txt\n> @@ -567,6 +567,10 @@ be passed to the shell by Git, which will translate the final\n>  command to `LESS=FRSX less -+S`. The environment tells the command\n>  to set the `S` option to chop long lines but the command line\n>  resets it to the default to fold long lines.\n> ++\n> +Likewise, when the `LV` environment variable is unset, Git sets it\n> +to `-c`.  You can override this setting by exporting `LV` with\n> +another value or setting `core.pager` to `lv +c`.\n>  \n>  core.whitespace::\n>  \tA comma separated list of common whitespace problems to\n> diff --git a/git-sh-setup.sh b/git-sh-setup.sh\n> index 190a539..fffa3c7 100644\n> --- a/git-sh-setup.sh\n> +++ b/git-sh-setup.sh\n> @@ -159,7 +159,8 @@ git_pager() {\n>  \t\tGIT_PAGER=cat\n>  \tfi\n>  \t: ${LESS=-FRSX}\n> -\texport LESS\n> +\t: ${LV=-c}\n> +\texport LESS LV\n>  \n>  \teval \"$GIT_PAGER\" '\"$@\"'\n>  }\n> diff --git a/pager.c b/pager.c\n> index 345b0bc..0cc75a8 100644\n> --- a/pager.c\n> +++ b/pager.c\n> @@ -80,8 +80,15 @@ void setup_pager(void)\n>  \tpager_process.use_shell = 1;\n>  \tpager_process.argv = pager_argv;\n>  \tpager_process.in = -1;\n> -\tif (!getenv(\"LESS\")) {\n> -\t\tstatic const char *env[] = { \"LESS=FRSX\", NULL };\n> +\tif (!getenv(\"LESS\") || !getenv(\"LV\")) {\n> +\t\tstatic const char *env[3];\n> +\t\tint i = 0;\n> +\n> +\t\tif (!getenv(\"LESS\"))\n> +\t\t\tenv[i++] = \"LESS=FRSX\";\n> +\t\tif (!getenv(\"LV\"))\n> +\t\t\tenv[i++] = \"LV=-c\";\n> +\t\tenv[i] = NULL;\n>  \t\tpager_process.env = env;\n>  \t}\n>  \tif (start_command(&pager_process))\n> diff --git a/perl/Git/SVN/Log.pm b/perl/Git/SVN/Log.pm\n> index 3f8350a..34f2869 100644\n> --- a/perl/Git/SVN/Log.pm\n> +++ b/perl/Git/SVN/Log.pm\n> @@ -117,6 +117,7 @@ sub run_pager {\n>  \t}\n>  \topen STDIN, '<&', $rfd or fatal \"Can't redirect stdin: $!\";\n>  \t$ENV{LESS} ||= 'FRSX';\n> +\t$ENV{LV} ||= '-c';\n>  \texec $pager or fatal \"Can't run pager: $! ($pager)\";\n>  }\n>  \n> diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh\n> index ff25908..7fe3367 100755\n> --- a/t/t7006-pager.sh\n> +++ b/t/t7006-pager.sh\n> @@ -37,6 +37,18 @@ test_expect_failure TTY 'pager runs from subdir' '\n>  \ttest_cmp expected actual\n>  '\n>  \n> +test_expect_success TTY 'LESS and LV envvars are set for pagination' '\n> +\t(\n> +\t\tsane_unset LESS LV &&\n> +\t\tPAGER=\"env >pager-env.out\" &&\n> +\t\texport PAGER &&\n> +\n> +\t\ttest_terminal git log\n> +\t) &&\n> +\tgrep ^LESS= pager-env.out &&\n> +\tgrep ^LV= pager-env.out\n> +'\n> +\n>  test_expect_success TTY 'some commands do not use a pager' '\n>  \trm -f paginated.out &&\n>  \ttest_terminal git rev-list HEAD &&\n"},{"id":"232824","messageId":"87iotvbqsa.fsf@igel.home","threadId":"35620","inReplyTo":"xmqqha9fg225.fsf@gitster.dls.corp.google.com","subject":"Re: [PATCH] pager: set LV=-c alongside LESS=FRSX","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2014-01-07T18:17:09Z","receivedAt":"2014-01-07T18:17:09Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>  - Scripted Porcelains get LESS=-FRSX while C Porcelains get\n>    LESS=FRSX as the default (the leading dash being the\n>    difference), which looks somewhat inconsistent.  Not a new\n>    problem, though.\n\nEven the less manpage is inconsistent about whether $LESS should start\nwith a dash (there are examples with and without it).\nImplementation-wise, less uses the same function to process an option\nargument (including the leading dash) and the value of $LESS, so the\nform with the leading dash is probably preferred.\n\nAndreas.\n\n-- \nAndreas Schwab, schwab@linux-m68k.org\nGPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5\n\"And now for something completely different.\"\n"},{"id":"233918","messageId":"52E9FC23.2030200@mit.edu","threadId":"35620","inReplyTo":"20140107021404.GK3881@google.com","subject":"Re: [PATCH] pager: set LV=-c alongside LESS=FRSX","fromName":"Anders Kaseorg","fromEmail":"andersk@mit.edu","sentAt":"2014-01-30T07:15:47Z","receivedAt":"2014-01-30T07:15:47Z","isPatch":true,"sender":{"key":"andersk@mit.edu","avatar":"https://avatars.githubusercontent.com/u/26471?v=4"},"body":"On 01/06/2014 09:14 PM, Jonathan Nieder wrote:\n> +test_expect_success TTY 'LESS and LV envvars are set for pagination' '\n> +\t(\n> +\t\tsane_unset LESS LV &&\n> +\t\tPAGER=\"env >pager-env.out\" &&\n> +\t\texport PAGER &&\n> +\n> +\t\ttest_terminal git log\n> +\t) &&\n> +\tgrep ^LESS= pager-env.out &&\n> +\tgrep ^LV= pager-env.out\n> +'\n> +\n\nOn the Ubuntu PPA builders, I’m seeing this new test fail with SIGPIPE \nabout half the time:\n\ndied of signal 13 at /build/buildd/git-1.9~rc1/t/test-terminal.perl line 33.\nnot ok 6 - LESS and LV envvars are set for pagination\n\nAlthough the test seems to work locally for me, I can reproduce a \nsimilar failure just by running\n\n$ GIT_PAGER='env >pager-env.out' ./test-terminal.perl git log\ndied of signal 13 at ./test-terminal.perl line 33.\n\nAnders\n"},{"id":"233949","messageId":"20140130164232.GF27577@google.com","threadId":"35620","inReplyTo":"52E9FC23.2030200@mit.edu","subject":"[PATCH jn/pager-lv-default-env] pager test: make fake pager consume all its input","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2014-01-30T16:42:32Z","receivedAt":"2014-01-30T16:42:32Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Otherwise there is a race: if 'git log' finishes writing before the\npager terminates and closes the pipe, all is well, and if the pager\nfinishes quickly enough then 'git log' terminates with SIGPIPE.\n\n died of signal 13 at /build/buildd/git-1.9~rc1/t/test-terminal.perl line 33.\n not ok 6 - LESS and LV envvars are set for pagination\n\nNoticed on Ubuntu PPA builders, where the race was lost about half the\ntime.  Compare v1.7.0.2~6^2 (tests: Fix race condition in t7006-pager,\n2010-02-22).\n\nReported-by: Anders Kaseorg <andersk@MIT.EDU>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\nAnders Kaseorg wrote:\n> On 01/06/2014 09:14 PM, Jonathan Nieder wrote:\n\n>> +\t\tPAGER=\"env >pager-env.out\" &&\n>> +\t\texport PAGER &&\n>> +\n>> +\t\ttest_terminal git log\n[...]\n> On the Ubuntu PPA builders, I’m seeing this new test fail with\n> SIGPIPE about half the time:\n>\n> died of signal 13 at /build/buildd/git-1.9~rc1/t/test-terminal.perl line 33.\n> not ok 6 - LESS and LV envvars are set for pagination\n\nGood catch.  Sorry for the trouble.\n\n t/t7006-pager.sh | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/t/t7006-pager.sh b/t/t7006-pager.sh\nindex 7fe3367..b9365b4 100755\n--- a/t/t7006-pager.sh\n+++ b/t/t7006-pager.sh\n@@ -40,7 +40,7 @@ test_expect_failure TTY 'pager runs from subdir' '\n test_expect_success TTY 'LESS and LV envvars are set for pagination' '\n \t(\n \t\tsane_unset LESS LV &&\n-\t\tPAGER=\"env >pager-env.out\" &&\n+\t\tPAGER=\"env >pager-env.out; wc\" &&\n \t\texport PAGER &&\n \n \t\ttest_terminal git log\n-- \n1.9.rc1.175.g0b1dcb5\n"},{"id":"233983","messageId":"xmqq7g9ghyfz.fsf@gitster.dls.corp.google.com","threadId":"35620","inReplyTo":"20140130164232.GF27577@google.com","subject":"Re: [PATCH jn/pager-lv-default-env] pager test: make fake pager consume all its input","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2014-01-31T17:07:44Z","receivedAt":"2014-01-31T17:07:44Z","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> Otherwise there is a race: if 'git log' finishes writing before the\n> pager terminates and closes the pipe, all is well, and if the pager\n> finishes quickly enough then 'git log' terminates with SIGPIPE.\n>\n>  died of signal 13 at /build/buildd/git-1.9~rc1/t/test-terminal.perl line 33.\n>  not ok 6 - LESS and LV envvars are set for pagination\n>\n> Noticed on Ubuntu PPA builders, where the race was lost about half the\n> time.  Compare v1.7.0.2~6^2 (tests: Fix race condition in t7006-pager,\n> 2010-02-22).\n>\n> Reported-by: Anders Kaseorg <andersk@MIT.EDU>\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n\nThanks.  The use of \"wc\" looks cute (I would have used \"cat\").\n\n> Anders Kaseorg wrote:\n>> On 01/06/2014 09:14 PM, Jonathan Nieder wrote:\n>\n>>> +\t\tPAGER=\"env >pager-env.out\" &&\n>>> +\t\texport PAGER &&\n>>> +\n>>> +\t\ttest_terminal git log\n> [...]\n>> On the Ubuntu PPA builders, I’m seeing this new test fail with\n>> SIGPIPE about half the time:\n>>\n>> died of signal 13 at /build/buildd/git-1.9~rc1/t/test-terminal.perl line 33.\n>> not ok 6 - LESS and LV envvars are set for pagination\n>\n> Good catch.  Sorry for the trouble.\n>\n>  t/t7006-pager.sh | 2 +-\n>  1 file changed, 1 insertion(+), 1 deletion(-)\n>\n> diff --git a/t/t7006-pager.sh b/t/t7006-pager.sh\n> index 7fe3367..b9365b4 100755\n> --- a/t/t7006-pager.sh\n> +++ b/t/t7006-pager.sh\n> @@ -40,7 +40,7 @@ test_expect_failure TTY 'pager runs from subdir' '\n>  test_expect_success TTY 'LESS and LV envvars are set for pagination' '\n>  \t(\n>  \t\tsane_unset LESS LV &&\n> -\t\tPAGER=\"env >pager-env.out\" &&\n> +\t\tPAGER=\"env >pager-env.out; wc\" &&\n>  \t\texport PAGER &&\n>  \n>  \t\ttest_terminal git log\n"}]}