{"thread":{"id":"21175","subject":"[PATCH 2/2] Makefile: use the native (Korn) shell on SunOS and IRIX/IRIX64","startedAt":"2009-10-09T18:39:56Z","lastAt":"2009-10-10T14:03:36Z","messageCount":11,"participants":["Brandon Casey","Jonathan Nieder","Junio C Hamano","Clemens Buchacher","Andreas Schwab","Ben Walton","Jeff King"],"isPatch":true,"patchVersion":1,"patchTotal":2},"messages":[{"id":"124518","messageId":"1eweIwf5YoFwmLPWwEFN69a2f-EUnj_kgiagVJoVQYfNQeLjlpm12U84RKxhzjh0NJv36SqO12lAX2c_x0WSgA@cipher.nrlssc.navy.mil","threadId":"21175","inReplyTo":null,"subject":"[PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-10-09T18:39:56Z","receivedAt":"2009-10-09T18:39:56Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"From: Brandon Casey <drafnel@gmail.com>\n\nCommit 6e7b5aaf introduced the concept of GIT_EXIT_OK as a way to indicate\nto die(), the exit handler, whether the exit was initiated by the test\nharness, or whether it was unexpected.  die() expects $? to contain the\nvalue passed to exit(), and when GIT_EXIT_OK is set, die() calls exit with\nthe value in $?.  This works as expected when using the Bash shell.  For\nthe Korn shell, $? has the value of the last executed statement _before_\nthe call to exit.  If that statement completed successfully, then die()\nwould incorrectly exit with a successful status when GIT_EXIT_OK is set.\n\nSo, rather than relying on the behavior of Bash in order to get the exit\ncode from $? inside die(), change GIT_EXIT_OK into GIT_EXIT_CODE, and set\nit to the code that we want to exit with.  This allows the test suite to\nbe run with the Korn shell.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n t/test-lib.sh |   15 ++++++++-------\n 1 files changed, 8 insertions(+), 7 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex f2ca536..64e793a 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -150,7 +150,7 @@ fi\n \n error () {\n \tsay_color error \"error: $*\"\n-\tGIT_EXIT_OK=t\n+\tGIT_EXIT_CODE=1\n \texit 1\n }\n \n@@ -183,16 +183,16 @@ test_success=0\n \n die () {\n \tcode=$?\n-\tif test -n \"$GIT_EXIT_OK\"\n+\tif test -n \"$GIT_EXIT_CODE\"\n \tthen\n-\t\texit $code\n+\t\texit $GIT_EXIT_CODE\n \telse\n \t\techo >&5 \"FATAL: Unexpected exit with code $code\"\n \t\texit 1\n \tfi\n }\n \n-GIT_EXIT_OK=\n+GIT_EXIT_CODE=\n trap 'die' EXIT\n \n # The semantics of the editor variables are that of invoking\n@@ -295,7 +295,7 @@ test_failure_ () {\n \tsay_color error \"FAIL $test_count: $1\"\n \tshift\n \techo \"$@\" | sed -e 's/^/\t/'\n-\ttest \"$immediate\" = \"\" || { GIT_EXIT_OK=t; exit 1; }\n+\ttest \"$immediate\" = \"\" || { GIT_EXIT_CODE=1; exit 1; }\n }\n \n test_known_broken_ok_ () {\n@@ -508,7 +508,6 @@ test_create_repo () {\n }\n \n test_done () {\n-\tGIT_EXIT_OK=t\n \ttest_results_dir=\"$TEST_DIRECTORY/test-results\"\n \tmkdir -p \"$test_results_dir\"\n \ttest_results_path=\"$test_results_dir/${0%.sh}-$$\"\n@@ -539,9 +538,11 @@ test_done () {\n \t\tcd \"$(dirname \"$remove_trash\")\" &&\n \t\trm -rf \"$(basename \"$remove_trash\")\"\n \n+\t\tGIT_EXIT_CODE=0\n \t\texit 0 ;;\n \n \t*)\n+\t\tGIT_EXIT_CODE=1\n \t\tsay_color error \"failed $test_failure among $msg\"\n \t\texit 1 ;;\n \n@@ -655,7 +656,7 @@ case \"$test\" in\n esac\n test ! -z \"$debug\" || remove_trash=$TRASH_DIRECTORY\n rm -fr \"$test\" || {\n-\tGIT_EXIT_OK=t\n+\tGIT_EXIT_CODE=1\n \techo >&5 \"FATAL: Cannot prepare test area\"\n \texit 1\n }\n-- \n1.6.5.rc3\n"},{"id":"124517","messageId":"1eweIwf5YoFwmLPWwEFN67wBtSRzI_L6x3UcjRimFe5P29LRa_0y-MvfV0H0uJhx2aoVUxbZP8vdM5evsZ8aZA@cipher.nrlssc.navy.mil","threadId":"21175","inReplyTo":"1eweIwf5YoFwmLPWwEFN69a2f-EUnj_kgiagVJoVQYfNQeLjlpm12U84RKxhzjh0NJv36SqO12lAX2c_x0WSgA@cipher.nrlssc.navy.mil","subject":"[PATCH 2/2] Makefile: use the native (Korn) shell on SunOS and IRIX/IRIX64","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-10-09T18:39:57Z","receivedAt":"2009-10-09T18:39:57Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"From: Brandon Casey <drafnel@gmail.com>\n\nNow that the test suite supports the Korn shell, we can use it as the\ndefault on platforms that do not ship with Bash.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n Makefile |    6 +++---\n 1 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 629ab35..9ada196 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -726,7 +726,7 @@ endif\n ifeq ($(uname_S),SunOS)\n \tNEEDS_SOCKET = YesPlease\n \tNEEDS_NSL = YesPlease\n-\tSHELL_PATH = /bin/bash\n+\tSHELL_PATH = /usr/xpg4/bin/sh\n \tSANE_TOOL_PATH = /usr/xpg6/bin:/usr/xpg4/bin\n \tNO_STRCASESTR = YesPlease\n \tNO_MEMMEM = YesPlease\n@@ -850,7 +850,7 @@ ifeq ($(uname_S),IRIX)\n \tNO_MMAP = YesPlease\n \tNO_EXTERNAL_GREP = UnfortunatelyYes\n \tSNPRINTF_RETURNS_BOGUS = YesPlease\n-\tSHELL_PATH = /usr/gnu/bin/bash\n+\tSHELL_PATH = /bin/ksh\n \tNEEDS_LIBGEN = YesPlease\n \tTHREADED_DELTA_SEARCH = YesPlease\n endif\n@@ -870,7 +870,7 @@ ifeq ($(uname_S),IRIX64)\n \tNO_MMAP = YesPlease\n \tNO_EXTERNAL_GREP = UnfortunatelyYes\n \tSNPRINTF_RETURNS_BOGUS = YesPlease\n-\tSHELL_PATH=/usr/gnu/bin/bash\n+\tSHELL_PATH=/bin/ksh\n \tNEEDS_LIBGEN = YesPlease\n \tTHREADED_DELTA_SEARCH = YesPlease\n endif\n-- \n1.6.5.rc3\n"},{"id":"124521","messageId":"20091009192812.GA4122@progeny.tock","threadId":"21175","inReplyTo":"1eweIwf5YoFwmLPWwEFN69a2f-EUnj_kgiagVJoVQYfNQeLjlpm12U84RKxhzjh0NJv36SqO12lAX2c_x0WSgA@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2009-10-09T19:28:12Z","receivedAt":"2009-10-09T19:28:12Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Brandon Casey wrote:\n\n> So, rather than relying on the behavior of Bash in order to get the exit\n> code from $? inside die(), change GIT_EXIT_OK into GIT_EXIT_CODE, and set\n> it to the code that we want to exit with.  This allows the test suite to\n> be run with the Korn shell.\n> \n> Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n\nSounds like a good idea.  A few thoughts:\n\nstart_httpd() from lib-httpd.sh uses a similar pattern:\n\nlib-httpd.sh:96:        trap 'code=$?; stop_httpd; (exit $code); die' EXIT\n\nIt is probably worth changing that, too, unless GIT_TEST_HTTPD would not\nwork on these platforms for some other reason.\n\n\"GIT_EXIT_CODE=1; exit 1\" sounds repetitive to my ear.  It’s probably just\nme, but if not, it might be worth adding a function like\n\n\texpected_exit() {\n\t\tGIT_EXIT_CODE=$1\n\t\texit \"$1\"\n\t}\n\nI’m not sure.\n\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index f2ca536..64e793a 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n[...]\n> @@ -183,16 +183,16 @@ test_success=0\n>  \n>  die () {\n>  \tcode=$?\n> -\tif test -n \"$GIT_EXIT_OK\"\n> +\tif test -n \"$GIT_EXIT_CODE\"\n>  \tthen\n> -\t\texit $code\n> +\t\texit $GIT_EXIT_CODE\n>  \telse\n>  \t\techo >&5 \"FATAL: Unexpected exit with code $code\"\n>  \t\texit 1\n>  \tfi\n>  }\n\n$code can be removed now, right?\n\nJonathan\n"},{"id":"124524","messageId":"20091009200103.GB3610@progeny.tock","threadId":"21175","inReplyTo":"20091009192812.GA4122@progeny.tock","subject":"Re: [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2009-10-09T20:01:03Z","receivedAt":"2009-10-09T20:01:03Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Sorry to reply to self, just want to correct something I missed.\n\nJonathan Nieder wrote:\n> Brandon Casey wrote:\n\n>> diff --git a/t/test-lib.sh b/t/test-lib.sh\n>> index f2ca536..64e793a 100644\n>> --- a/t/test-lib.sh\n>> +++ b/t/test-lib.sh\n> [...]\n>> @@ -183,16 +183,16 @@ test_success=0\n>>  \n>>  die () {\n>>  \tcode=$?\n>> -\tif test -n \"$GIT_EXIT_OK\"\n>> +\tif test -n \"$GIT_EXIT_CODE\"\n>>  \tthen\n>> -\t\texit $code\n>> +\t\texit $GIT_EXIT_CODE\n>>  \telse\n>>  \t\techo >&5 \"FATAL: Unexpected exit with code $code\"\n>>  \t\texit 1\n>>  \tfi\n>>  }\n>\n> $code can be removed now, right?\n\nSloppy reading on my part here: $code is still used in the error\nmessage on unexpected exits.  The $code will be inaccurate on Suns\nin some cases, but this is only a cosmetic problem and the wrong\nvalue should be better than nothing for debugging.\n\n> lib-httpd.sh:96:        trap 'code=$?; stop_httpd; (exit $code); die' EXIT\n>\n> It is probably worth changing that, too, unless GIT_TEST_HTTPD would not\n> work on these platforms for some other reason.\n\nThis is used to support that error message, so it should not be\nchanged, either.\n\nYour patch looks good.  Maybe the commit message could explain this,\nthough?\n\nApologies for the noise,\nJonathan\n"},{"id":"124533","messageId":"7vhbu8s151.fsf@alter.siamese.dyndns.org","threadId":"21175","inReplyTo":"1eweIwf5YoFwmLPWwEFN69a2f-EUnj_kgiagVJoVQYfNQeLjlpm12U84RKxhzjh0NJv36SqO12lAX2c_x0WSgA@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-09T21:33:46Z","receivedAt":"2009-10-09T21:33:46Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Casey <casey@nrlssc.navy.mil> writes:\n\n> From: Brandon Casey <drafnel@gmail.com>\n>\n> Commit 6e7b5aaf introduced the concept of GIT_EXIT_OK as a way to indicate\n> to die(), the exit handler, whether the exit was initiated by the test\n> harness, or whether it was unexpected.  die() expects $? to contain the\n> value passed to exit(), and when GIT_EXIT_OK is set, die() calls exit with\n> the value in $?.  This works as expected when using the Bash shell.  For\n> the Korn shell, $? has the value of the last executed statement _before_\n> the call to exit.  If that statement completed successfully, then die()\n> would incorrectly exit with a successful status when GIT_EXIT_OK is set.\n\nThat's somewhat unexpected, as I did not think this was an anomaly in\nbash.  FWIW, dash seems to behave the same way.\n\n    The environment in which the shell executes a trap on EXIT shall be\n    identical to the environment immediately after the last command executed\n    before the trap on EXIT was taken.\n\nIf the trap action was triggered because somebody called \"exit 13\", $? is\nexpected to contain that value, because that is the last command executed\nbefore the trap on EXIT was taken, no?\n\n> So, rather than relying on the behavior of Bash in order to get the exit\n> code from $? inside die(), change GIT_EXIT_OK into GIT_EXIT_CODE, and set\n> it to the code that we want to exit with.  This allows the test suite to\n> be run with the Korn shell.\n\nI wonder if the attached is a more clear and contained workaround for this\nissue.\n\n---\n t/test-lib.sh |    9 ++++++++-\n 1 files changed, 8 insertions(+), 1 deletions(-)\n\ndiff --git a/t/test-lib.sh b/t/test-lib.sh\nindex f2ca536..c47a295 100644\n--- a/t/test-lib.sh\n+++ b/t/test-lib.sh\n@@ -185,7 +185,14 @@ die () {\n \tcode=$?\n \tif test -n \"$GIT_EXIT_OK\"\n \tthen\n-\t\texit $code\n+\t\t# Korn does not update $? when \"exit 47\" triggers\n+\t\t# the EXIT trap.\n+\t\tif test $code = 0\n+\t\tthen\n+\t\t\texit 1\n+\t\telse\n+\t\t\texit $code\n+\t\tfi\n \telse\n \t\techo >&5 \"FATAL: Unexpected exit with code $code\"\n \t\texit 1\n"},{"id":"124541","messageId":"ee63ef30910091537i40a8cc68y2513f07c91fb35b@mail.gmail.com","threadId":"21175","inReplyTo":"7vhbu8s151.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE","fromName":"Brandon Casey","fromEmail":"drafnel@gmail.com","sentAt":"2009-10-09T22:37:23Z","receivedAt":"2009-10-09T22:37:23Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"I'm away from a computer right now. Junio, if gmail is showing me the\nentirety of your workaround, then no, I don't think that will work.\nYour code will always exit non-zero, but there are cases where 'exit\n0' is called and a '0' exit status is desired. e.g. when test_done is\ncalled.\n\nI'll look more closely at the suggestions when I get back to a computer.\n\n-brandon\n\nOn 10/9/09, Junio C Hamano <gitster@pobox.com> wrote:\n> Brandon Casey <casey@nrlssc.navy.mil> writes:\n>\n>> From: Brandon Casey <drafnel@gmail.com>\n>>\n>> Commit 6e7b5aaf introduced the concept of GIT_EXIT_OK as a way to indicate\n>> to die(), the exit handler, whether the exit was initiated by the test\n>> harness, or whether it was unexpected.  die() expects $? to contain the\n>> value passed to exit(), and when GIT_EXIT_OK is set, die() calls exit with\n>> the value in $?.  This works as expected when using the Bash shell.  For\n>> the Korn shell, $? has the value of the last executed statement _before_\n>> the call to exit.  If that statement completed successfully, then die()\n>> would incorrectly exit with a successful status when GIT_EXIT_OK is set.\n>\n> That's somewhat unexpected, as I did not think this was an anomaly in\n> bash.  FWIW, dash seems to behave the same way.\n>\n>     The environment in which the shell executes a trap on EXIT shall be\n>     identical to the environment immediately after the last command executed\n>     before the trap on EXIT was taken.\n>\n> If the trap action was triggered because somebody called \"exit 13\", $? is\n> expected to contain that value, because that is the last command executed\n> before the trap on EXIT was taken, no?\n>\n>> So, rather than relying on the behavior of Bash in order to get the exit\n>> code from $? inside die(), change GIT_EXIT_OK into GIT_EXIT_CODE, and set\n>> it to the code that we want to exit with.  This allows the test suite to\n>> be run with the Korn shell.\n>\n> I wonder if the attached is a more clear and contained workaround for this\n> issue.\n>\n> ---\n>  t/test-lib.sh |    9 ++++++++-\n>  1 files changed, 8 insertions(+), 1 deletions(-)\n>\n> diff --git a/t/test-lib.sh b/t/test-lib.sh\n> index f2ca536..c47a295 100644\n> --- a/t/test-lib.sh\n> +++ b/t/test-lib.sh\n> @@ -185,7 +185,14 @@ die () {\n>  \tcode=$?\n>  \tif test -n \"$GIT_EXIT_OK\"\n>  \tthen\n> -\t\texit $code\n> +\t\t# Korn does not update $? when \"exit 47\" triggers\n> +\t\t# the EXIT trap.\n> +\t\tif test $code = 0\n> +\t\tthen\n> +\t\t\texit 1\n> +\t\telse\n> +\t\t\texit $code\n> +\t\tfi\n>  \telse\n>  \t\techo >&5 \"FATAL: Unexpected exit with code $code\"\n>  \t\texit 1\n>\n\n-- \nSent from my mobile device\n"},{"id":"124552","messageId":"7vocogdq10.fsf@alter.siamese.dyndns.org","threadId":"21175","inReplyTo":"ee63ef30910091537i40a8cc68y2513f07c91fb35b@mail.gmail.com","subject":"Re: [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-10-10T00:57:31Z","receivedAt":"2009-10-10T00:57:31Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Casey <drafnel@gmail.com> writes:\n\n> I'm away from a computer right now. Junio, if gmail is showing me the\n> entirety of your workaround, then no, I don't think that will work.\n> Your code will always exit non-zero, but there are cases where 'exit\n> 0' is called and a '0' exit status is desired. e.g. when test_done is\n> called.\n\nAh, of course you are right.\n"},{"id":"124565","messageId":"20091010120121.GA16336@localhost","threadId":"21175","inReplyTo":"1eweIwf5YoFwmLPWwEFN69a2f-EUnj_kgiagVJoVQYfNQeLjlpm12U84RKxhzjh0NJv36SqO12lAX2c_x0WSgA@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE","fromName":"Clemens Buchacher","fromEmail":"drizzd@aon.at","sentAt":"2009-10-10T12:01:21Z","receivedAt":"2009-10-10T12:01:21Z","isPatch":true,"sender":{"key":"drizzd@gmx.net","avatar":"https://avatars.githubusercontent.com/u/59082?v=4"},"body":"Hi,\n\nOn Fri, Oct 09, 2009 at 01:39:56PM -0500, Brandon Casey wrote:\n\n> For the Korn shell, $? has the value of the last executed statement\n> _before_ the call to exit.\n\nI just installed ksh/stable (version 93s+ 2008-01-31) on Debian and it\nbehaves correctly. Maybe you need to upgrade? This really looks like a bug\nin your shell to me.\n\n>  die () {\n>  \tcode=$?\n> -\tif test -n \"$GIT_EXIT_OK\"\n> +\tif test -n \"$GIT_EXIT_CODE\"\n>  \tthen\n> -\t\texit $code\n> +\t\texit $GIT_EXIT_CODE\n>  \telse\n>  \t\techo >&5 \"FATAL: Unexpected exit with code $code\"\n>  \t\texit 1\n>  \tfi\n>  }\n\nSo in your shell an unexpected exit will always output this?\n\n FATAL: Unexpected exit with code <some command>\n\nIf we can't rely on the value of $?, we should not use it.\n\nClemens\n"},{"id":"124567","messageId":"m2eipbphbr.fsf@igel.home","threadId":"21175","inReplyTo":"20091010120121.GA16336@localhost","subject":"Re: [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2009-10-10T12:24:40Z","receivedAt":"2009-10-10T12:24:40Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Clemens Buchacher <drizzd@aon.at> writes:\n\n> Hi,\n>\n> On Fri, Oct 09, 2009 at 01:39:56PM -0500, Brandon Casey wrote:\n>\n>> For the Korn shell, $? has the value of the last executed statement\n>> _before_ the call to exit.\n>\n> I just installed ksh/stable (version 93s+ 2008-01-31) on Debian and it\n> behaves correctly. Maybe you need to upgrade? This really looks like a bug\n> in your shell to me.\n\nAccording to the autoconf docs this bug is also present in the Solaris\n/bin/sh (and autoconf generated scripts use some elaborated workaround).\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":"124568","messageId":"1255178966-sup-5813@ntdws12.chass.utoronto.ca","threadId":"21175","inReplyTo":"m2eipbphbr.fsf@igel.home","subject":"Re: [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE","fromName":"Ben Walton","fromEmail":"bwalton@artsci.utoronto.ca","sentAt":"2009-10-10T12:53:00Z","receivedAt":"2009-10-10T12:53:00Z","isPatch":true,"sender":{"key":"bdwalton@gmail.com","avatar":"https://avatars.githubusercontent.com/u/396061?v=4"},"body":"Excerpts from Andreas Schwab's message of Sat Oct 10 08:24:40 -0400 2009:\n\n> According to the autoconf docs this bug is also present in the Solaris\n> /bin/sh (and autoconf generated scripts use some elaborated workaround).\n\nSolaris' /bin/sh shouldn't be used for anything but forking a decent\nshell, imo.  It was brought to my attention recently that the test\nsuite for mercurial on solaris was failing the git tests.  The\nmercurial folks initially thought this was a git on solaris bug.\n\nAfter looking into it, I discovered that ^ is still treated[1] as a\npipe symbol[2] in some cases.  So, test suite programs run under\n/bin/sh on solaris with commands like `git reset --hard HEAD^` were\nmisbehaving due to the shell setting up a pipeline under the right\ncircumstances.\n\n-Ben\n\n[1] http://cvs.opensolaris.org/source/xref/onnv/onnv-gate/usr/src/cmd/sh/cmd.c\n    line 184\n\n[2] This dates back to the Thomson shell:\n    http://en.wikipedia.org/wiki/Thompson_shell\n-- \nBen Walton\nSystems Programmer - CHASS\nUniversity of Toronto\nC:416.407.5610 | W:416.978.4302\n\nGPG Key Id: 8E89F6D2; Key Server: pgp.mit.edu\nContact me to arrange for a CAcert assurance meeting.\n"},{"id":"124570","messageId":"20091010140336.GB16827@sigill.intra.peff.net","threadId":"21175","inReplyTo":"1255178966-sup-5813@ntdws12.chass.utoronto.ca","subject":"Re: [PATCH 1/2] t/test-lib.sh: support Korn shell by converting GIT_EXIT_OK to GIT_EXIT_CODE","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-10-10T14:03:36Z","receivedAt":"2009-10-10T14:03:36Z","isPatch":true,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Sat, Oct 10, 2009 at 08:53:00AM -0400, Ben Walton wrote:\n\n> > According to the autoconf docs this bug is also present in the Solaris\n> > /bin/sh (and autoconf generated scripts use some elaborated workaround).\n> \n> Solaris' /bin/sh shouldn't be used for anything but forking a decent\n> shell, imo.  It was brought to my attention recently that the test\n> suite for mercurial on solaris was failing the git tests.  The\n> mercurial folks initially thought this was a git on solaris bug.\n\nYes, that is the attitude we take towards /bin/sh on Solaris. Most\npeople running git on Solaris (or other broken-shell platforms) point\nSHELL_PATH to bash. I think the point of Brandon's patch is to let them\nuse a native shell.\n\nSo while /bin/sh is broken, the question is whether the alternate native\nshell is broken enough to use or not.\n\n-Peff\n"}]}