{"thread":{"id":"19194","subject":"shell compatibility issues with SunOS 5.10","startedAt":"2009-05-06T05:59:13Z","lastAt":"2009-05-07T14:57:19Z","messageCount":31,"participants":["Nguyen Thai Ngoc Duy","Junio C Hamano","Johannes Sixt","Ralf Wildenhues","Johannes Schindelin","Jeff King","Brandon Casey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"113065","messageId":"20090506055913.GA9701@dektop","threadId":"19194","inReplyTo":null,"subject":"shell compatibility issues with SunOS 5.10","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-05-06T05:59:13Z","receivedAt":"2009-05-06T05:59:13Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"Hi,\n\nI did \"make test\" on a SunOS 5.10 and it failed. With the below patch,\nonly t7400 and t8005 kept failing. For the first case, t7400.5 failed\nbecause extensive use of sed to normalize path in git-submodule.sh\n\n\t# normalize path:\n\t# multiple //; leading ./; /./; /../; trailing /\n\tpath=$(printf '%s/\\n' \"$path\" |\n\t\tsed -e '\n\t\t\ts|//*|/|g\n\t\t\ts|^\\(\\./\\)*||\n\t\t\ts|/\\./|/|g\n\t\t\t:start\n\t\t\ts|\\([^/]*\\)/\\.\\./||\n\t\t\ttstart\n\t\t\ts|/*$||\n\t\t')\n\nThe second failed because it used extended regexp\n\ngrep \"^\\(author\\|summary\\) \"\n\nI'm no sed/grep wizard (and quite new to SunOS too), no clue how to do\nit properly. Any help?\n\ndiff --git a/git-am.sh b/git-am.sh\nindex 6d1848b..5a91d52 100755\n--- a/git-am.sh\n+++ b/git-am.sh\n@@ -46,7 +46,7 @@ fi\n sq () {\n \tfor sqarg\n \tdo\n-\t\tprintf \"%s\" \"$sqarg\" |\n+\t\tprintf \"%s\\n\" \"$sqarg\" |\n \t\tsed -e 's/'\\''/'\\''\\\\'\\'''\\''/g' -e 's/.*/ '\\''&'\\''/'\n \tdone\n }\ndiff --git a/t/t2019-checkout-sparse.sh b/t/t2019-checkout-sparse.sh\nindex 4ea1ee6..6949a59 100755\n--- a/t/t2019-checkout-sparse.sh\n+++ b/t/t2019-checkout-sparse.sh\n@@ -68,13 +68,13 @@ test_expect_success 'update narrow prefix with modification' '\n \ttest -f work1/one &&\n \ttest -f work2/two &&\n \t! test -f work3/three &&\n-\tgrep -q modified work2/two &&\n+\tgrep modified work2/two &&\n \n \t! git checkout --sparse=work1/:work3/ &&\n \ttest -f work1/one &&\n \ttest -f work2/two &&\n \t! test -f work3/three &&\n-\tgrep -q modified work2/two &&\n+\tgrep modified work2/two &&\n \tgit checkout work2/two\n '\n \ndiff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\nindex b68ab11..61ccdee 100755\n--- a/t/t4200-rerere.sh\n+++ b/t/t4200-rerere.sh\n@@ -57,7 +57,7 @@ test_expect_success 'conflicting merge' '\n \ttest_must_fail git merge first\n '\n \n-sha1=$(sed -e 's/\t.*//' .git/MERGE_RR)\n+sha1=$(cut -f 1 .git/MERGE_RR)\n rr=.git/rr-cache/$sha1\n test_expect_success 'recorded preimage' \"grep ^=======$ $rr/preimage\"\n \ndiff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh\nindex e2aa254..9a916d3 100755\n--- a/t/t5300-pack-object.sh\n+++ b/t/t5300-pack-object.sh\n@@ -315,7 +315,7 @@ test_expect_success 'unpacking with --strict' '\n \thead -n 10 LIST | git update-index --index-info &&\n \tLI=$(git write-tree) &&\n \trm -f .git/index &&\n-\ttail -n 10 LIST | git update-index --index-info &&\n+\ttail -10 LIST | git update-index --index-info &&\n \tST=$(git write-tree) &&\n \tPACK5=$( git rev-list --objects \"$LIST\" \"$LI\" \"$ST\" | \\\n \t\tgit pack-objects test-5 ) &&\n@@ -362,7 +362,7 @@ test_expect_success 'index-pack with --strict' '\n \thead -n 10 LIST | git update-index --index-info &&\n \tLI=$(git write-tree) &&\n \trm -f .git/index &&\n-\ttail -n 10 LIST | git update-index --index-info &&\n+\ttail -10 LIST | git update-index --index-info &&\n \tST=$(git write-tree) &&\n \tPACK5=$( git rev-list --objects \"$LIST\" \"$LI\" \"$ST\" | \\\n \t\tgit pack-objects test-5 ) &&\ndiff --git a/t/t7501-commit.sh b/t/t7501-commit.sh\nindex e2ef532..b3633d0 100755\n--- a/t/t7501-commit.sh\n+++ b/t/t7501-commit.sh\n@@ -142,10 +142,10 @@ test_expect_success \\\n \t'editor not invoked if -F is given' '\n \t echo \"moo\" >file &&\n \t VISUAL=./editor git commit -a -F msg &&\n-\t git show -s --pretty=format:\"%s\" | grep -q good &&\n+\t git show -s --pretty=format:\"%s\" | grep good &&\n \t echo \"quack\" >file &&\n \t echo \"Another good message.\" | VISUAL=./editor git commit -a -F - &&\n-\t git show -s --pretty=format:\"%s\" | grep -q good\n+\t git show -s --pretty=format:\"%s\" | grep good\n \t '\n # We could just check the head sha1, but checking each commit makes it\n # easier to isolate bugs.\n"},{"id":"113066","messageId":"7vljpaycwg.fsf@alter.siamese.dyndns.org","threadId":"19194","inReplyTo":"20090506055913.GA9701@dektop","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-05-06T06:16:15Z","receivedAt":"2009-05-06T06:16:15Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Nguyen Thai Ngoc Duy <pclouds@gmail.com> writes:\n\n> diff --git a/git-am.sh b/git-am.sh\n> index 6d1848b..5a91d52 100755\n> --- a/git-am.sh\n> +++ b/git-am.sh\n> @@ -46,7 +46,7 @@ fi\n>  sq () {\n>  \tfor sqarg\n>  \tdo\n> -\t\tprintf \"%s\" \"$sqarg\" |\n> +\t\tprintf \"%s\\n\" \"$sqarg\" |\n>  \t\tsed -e 's/'\\''/'\\''\\\\'\\'''\\''/g' -e 's/.*/ '\\''&'\\''/'\n\nI think this is a correct fix; according to POSIX sed is required only to\nwork on text files, so we should terminate its input with a newline.\n\n> diff --git a/t/t2019-checkout-sparse.sh b/t/t2019-checkout-sparse.sh\n> index 4ea1ee6..6949a59 100755\n> --- a/t/t2019-checkout-sparse.sh\n> +++ b/t/t2019-checkout-sparse.sh\n> @@ -68,13 +68,13 @@ test_expect_success 'update narrow prefix with modification' '\n> -\tgrep -q modified work2/two &&\n> +\tgrep modified work2/two &&\n\nLooks harmless (-q is in POSIX by the way), but you may want to redirect\nthe standard output to /dev/null instead (applies to your other rewrites\nto \"grep -q\" as well).\n\n> diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\n> index b68ab11..61ccdee 100755\n> --- a/t/t4200-rerere.sh\n> +++ b/t/t4200-rerere.sh\n> @@ -57,7 +57,7 @@ test_expect_success 'conflicting merge' '\n>  \ttest_must_fail git merge first\n>  '\n>  \n> -sha1=$(sed -e 's/\t.*//' .git/MERGE_RR)\n> +sha1=$(cut -f 1 .git/MERGE_RR)\n\nI do not know why you need this one.  It shouldn't hurt, though.\n\n> diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh\n> index e2aa254..9a916d3 100755\n> --- a/t/t5300-pack-object.sh\n> +++ b/t/t5300-pack-object.sh\n> @@ -315,7 +315,7 @@ test_expect_success 'unpacking with --strict' '\n>  \thead -n 10 LIST | git update-index --index-info &&\n>  \tLI=$(git write-tree) &&\n>  \trm -f .git/index &&\n> -\ttail -n 10 LIST | git update-index --index-info &&\n> +\ttail -10 LIST | git update-index --index-info &&\n\nI do not know why your \"head\" apparently accepts -n (see the context) but\nnot your \"tail\"; as POSIX frowns upon head/tail -$number, this one is a\nregression.\n"},{"id":"113067","messageId":"fcaeb9bf0905052343s7388d057j3d2b219aecc2faeb@mail.gmail.com","threadId":"19194","inReplyTo":"7vljpaycwg.fsf@alter.siamese.dyndns.org","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-05-06T06:43:19Z","receivedAt":"2009-05-06T06:43:19Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, May 6, 2009 at 4:16 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\n>> index b68ab11..61ccdee 100755\n>> --- a/t/t4200-rerere.sh\n>> +++ b/t/t4200-rerere.sh\n>> @@ -57,7 +57,7 @@ test_expect_success 'conflicting merge' '\n>>       test_must_fail git merge first\n>>  '\n>>\n>> -sha1=$(sed -e 's/    .*//' .git/MERGE_RR)\n>> +sha1=$(cut -f 1 .git/MERGE_RR)\n>\n> I do not know why you need this one.  It shouldn't hurt, though.\n\nWell because it wouldn't work without it. But on the other hand, I\ngrepped \"sed.*\\t\" through and found many of them. Still wondering\nwhile only this fails. I will look at it again when I have time.\n\n>> diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh\n>> index e2aa254..9a916d3 100755\n>> --- a/t/t5300-pack-object.sh\n>> +++ b/t/t5300-pack-object.sh\n>> @@ -315,7 +315,7 @@ test_expect_success 'unpacking with --strict' '\n>>       head -n 10 LIST | git update-index --index-info &&\n>>       LI=$(git write-tree) &&\n>>       rm -f .git/index &&\n>> -     tail -n 10 LIST | git update-index --index-info &&\n>> +     tail -10 LIST | git update-index --index-info &&\n>\n> I do not know why your \"head\" apparently accepts -n (see the context) but\n> not your \"tail\"; as POSIX frowns upon head/tail -$number, this one is a\n> regression.\n>\n\nHey, it's Sun's magic. head manpage mentions -n and it works (I\nchecked) while tail does not accept it. GNU tail's manpage does not\nmention that it supports [+-]N syntax but it seems to work.\n-- \nDuy\n"},{"id":"113068","messageId":"4A01320A.2050600@viscovery.net","threadId":"19194","inReplyTo":"20090506055913.GA9701@dektop","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-05-06T06:45:30Z","receivedAt":"2009-05-06T06:45:30Z","isPatch":false,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Nguyen Thai Ngoc Duy schrieb:\n> I did \"make test\" on a SunOS 5.10 and it failed. With the below patch,\n> only t7400 and t8005 kept failing. For the first case, t7400.5 failed\n> because extensive use of sed to normalize path in git-submodule.sh\n> \n> \t# normalize path:\n> \t# multiple //; leading ./; /./; /../; trailing /\n> \tpath=$(printf '%s/\\n' \"$path\" |\n> \t\tsed -e '\n> \t\t\ts|//*|/|g\n> \t\t\ts|^\\(\\./\\)*||\n> \t\t\ts|/\\./|/|g\n> \t\t\t:start\n> \t\t\ts|\\([^/]*\\)/\\.\\./||\n> \t\t\ttstart\n> \t\t\ts|/*$||\n> \t\t')\n\nThere was a lengthy thread that lead to this version of the sed\nexpression. Could you please tell what your sed has to say about it? It\nworks even on AIX 4.3.3.\n\n-- Hannes\n"},{"id":"113069","messageId":"fcaeb9bf0905052357v6773cbf5i12795c1866a80783@mail.gmail.com","threadId":"19194","inReplyTo":"4A01320A.2050600@viscovery.net","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-05-06T06:57:16Z","receivedAt":"2009-05-06T06:57:16Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, May 6, 2009 at 4:45 PM, Johannes Sixt <j.sixt@viscovery.net> wrote:\n> Nguyen Thai Ngoc Duy schrieb:\n>> I did \"make test\" on a SunOS 5.10 and it failed. With the below patch,\n>> only t7400 and t8005 kept failing. For the first case, t7400.5 failed\n>> because extensive use of sed to normalize path in git-submodule.sh\n>>\n>>       # normalize path:\n>>       # multiple //; leading ./; /./; /../; trailing /\n>>       path=$(printf '%s/\\n' \"$path\" |\n>>               sed -e '\n>>                       s|//*|/|g\n>>                       s|^\\(\\./\\)*||\n>>                       s|/\\./|/|g\n>>                       :start\n>>                       s|\\([^/]*\\)/\\.\\./||\n>>                       tstart\n>>                       s|/*$||\n>>               ')\n>\n> There was a lengthy thread that lead to this version of the sed\n> expression. Could you please tell what your sed has to say about it? It\n> works even on AIX 4.3.3.\n\nIt says nothing. The result of \"printf '%s\\n' ./foo/bar | sed -e blah\"\nis just wrong, (i.e. \"./\" remains). I stripped down to \"sed -e\n's|^\\(\\./\\)*||'\", does not work. Probably due to \\( \\) pair. Skimmed\nthrough sed manpage, seems no mention of bracket grouping.\n-- \nDuy\n"},{"id":"113074","messageId":"loom.20090506T091628-717@post.gmane.org","threadId":"19194","inReplyTo":"fcaeb9bf0905052357v6773cbf5i12795c1866a80783@mail.gmail.com","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Ralf Wildenhues","fromEmail":"ralf.wildenhues@gmx.de","sentAt":"2009-05-06T09:19:06Z","receivedAt":"2009-05-06T09:19:06Z","isPatch":false,"sender":{"key":"ralf.wildenhues@gmx.de","avatar":null},"body":"Nguyen Thai Ngoc Duy writes:\n> On Wed, May 6, 2009 at 4:45 PM, Johannes Sixt wrote:\n> > Nguyen Thai Ngoc Duy schrieb:\n> >>       # normalize path:\n> >>       # multiple //; leading ./; /./; /../; trailing /\n> >>       path=$(printf '%s/\\n' \"$path\" |\n> >>               sed -e '\n> >>                       s|//*|/|g\n> >>                       s|^\\(\\./\\)*||\n> >>                       s|/\\./|/|g\n> >>                       :start\n> >>                       s|\\([^/]*\\)/\\.\\./||\n> >>                       tstart\n> >>                       s|/*$||\n> >>               ')\n\n> It says nothing. The result of \"printf '%s\\n' ./foo/bar | sed -e blah\"\n> is just wrong, (i.e. \"./\" remains). I stripped down to \"sed -e\n> 's|^\\(\\./\\)*||'\", does not work. Probably due to \\( \\) pair. Skimmed\n> through sed manpage, seems no mention of bracket grouping.\n\nQuoting 'info Autoconf \"Limitation of Usual Tools\"':\n\n     Some `sed' implementations, e.g., Solaris, restrict the special\n     role of the asterisk to one-character regular expressions.  This\n     may lead to unexpected behavior:\n\n          $ echo '1*23*4' | /usr/bin/sed 's/\\(.\\)*/x/g'\n          x2x4\n          $ echo '1*23*4' | /usr/xpg4/bin/sed 's/\\(.\\)*/x/g'\n          x\n\nYou can work around it in this case with\n  :again\n  s|^\\./||\n  t again\n\nBTW, you should put a space between t and the label (but not between\n: and label), POSIX requires that and some sed versions expect it.\n\nCheers,\nRalf\n"},{"id":"113076","messageId":"alpine.DEB.1.00.0905061137300.14230@intel-tinevez-2-302","threadId":"19194","inReplyTo":"loom.20090506T091628-717@post.gmane.org","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-05-06T09:38:16Z","receivedAt":"2009-05-06T09:38:16Z","isPatch":false,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Wed, 6 May 2009, Ralf Wildenhues wrote:\n\n> Nguyen Thai Ngoc Duy writes:\n> > On Wed, May 6, 2009 at 4:45 PM, Johannes Sixt wrote:\n> > > Nguyen Thai Ngoc Duy schrieb:\n> > >>       # normalize path:\n> > >>       # multiple //; leading ./; /./; /../; trailing /\n> > >>       path=$(printf '%s/\\n' \"$path\" |\n> > >>               sed -e '\n> > >>                       s|//*|/|g\n> > >>                       s|^\\(\\./\\)*||\n> > >>                       s|/\\./|/|g\n> > >>                       :start\n> > >>                       s|\\([^/]*\\)/\\.\\./||\n> > >>                       tstart\n> > >>                       s|/*$||\n> > >>               ')\n> \n> > It says nothing. The result of \"printf '%s\\n' ./foo/bar | sed -e blah\"\n> > is just wrong, (i.e. \"./\" remains). I stripped down to \"sed -e\n> > 's|^\\(\\./\\)*||'\", does not work. Probably due to \\( \\) pair. Skimmed\n> > through sed manpage, seems no mention of bracket grouping.\n> \n> Quoting 'info Autoconf \"Limitation of Usual Tools\"':\n> \n>      Some `sed' implementations, e.g., Solaris, restrict the special\n>      role of the asterisk to one-character regular expressions.  This\n>      may lead to unexpected behavior:\n> \n>           $ echo '1*23*4' | /usr/bin/sed 's/\\(.\\)*/x/g'\n>           x2x4\n>           $ echo '1*23*4' | /usr/xpg4/bin/sed 's/\\(.\\)*/x/g'\n>           x\n> \n> You can work around it in this case with\n>   :again\n>   s|^\\./||\n>   t again\n> \n> BTW, you should put a space between t and the label (but not between\n> : and label), POSIX requires that and some sed versions expect it.\n\nMaybe the time is better spent on turning submodule into a builtin, before \nit gets even larger, and before we have to jump through even more hoops \nbecause of shell compatibility issues?\n\nCiao,\nDscho\n"},{"id":"113079","messageId":"20090506130750.GB11081@sigill.intra.peff.net","threadId":"19194","inReplyTo":"20090506055913.GA9701@dektop","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2009-05-06T13:07:50Z","receivedAt":"2009-05-06T13:07:50Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Wed, May 06, 2009 at 03:59:13PM +1000, Nguyen Thai Ngoc Duy wrote:\n\n> I did \"make test\" on a SunOS 5.10 and it failed. With the below patch,\n> only t7400 and t8005 kept failing. For the first case, t7400.5 failed\n> because extensive use of sed to normalize path in git-submodule.sh\n\nYou may consider putting /usr/xpg4/bin in your PATH. It has much more\nsane versions of shell utilities (including a tail which supports \"-n\").\n\n-Peff\n"},{"id":"113104","messageId":"-ElxRhvpfY_jx1Ps8nJ42rHdrKbR03T1y96WpGK19gM@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"20090506055913.GA9701@dektop","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-06T18:14:07Z","receivedAt":"2009-05-06T18:14:07Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Nguyen Thai Ngoc Duy wrote:\n> Hi,\n> \n> I did \"make test\" on a SunOS 5.10 and it failed.\n\n> diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\n> index b68ab11..61ccdee 100755\n> --- a/t/t4200-rerere.sh\n> +++ b/t/t4200-rerere.sh\n> @@ -57,7 +57,7 @@ test_expect_success 'conflicting merge' '\n>  \ttest_must_fail git merge first\n>  '\n>  \n> -sha1=$(sed -e 's/\t.*//' .git/MERGE_RR)\n> +sha1=$(cut -f 1 .git/MERGE_RR)\n\nAre you using /bin/sed?  I think it has a problem with tabs.\n/usr/xpg4/bin/sed works correctly, but it has a problem with\nfiles that are not newline terminated.  So you will get other\nerrors.  I have a set of \"ugly\" patches that I will follow this\nemail with that allow me to compile on Solaris 10 while skipping\nthe following tests:\n\n   GIT_SKIP_TESTS='\n      t3900.2[23]\n      t3901.[67]\n      t6030.1[23]\n      t8005.*\n   '\n\nThe t3900 and t3901 are due to iconv failures.\n\nThe t6030 issues are due to a flaw in Sun's ksh, i.e. /usr/xpg4/bin/sh\nwhich I use for testing.  This ksh seems to only call a trap that is\nset within at most the next outer-layer function.  In other words, if\nfunc1 sets a trap, and calls func2 which calls func3 which exits, then\nthe trap in func1 will _not_ be called. If instead, func2 exits, then\nthe trap will be called.  Bisect does such a thing.  You should not\nhave a problem with other ksh or bash.\n\nI had assumed t8005 was failing because of iconv, but since you have\npointed out the extended RE in grep, some of these should pass.\nConverting to egrep allows tests 1, 4 and 5 to pass for me. So my skip\nexpression can be changed to t8005.[23].\n\n>  rr=.git/rr-cache/$sha1\n>  test_expect_success 'recorded preimage' \"grep ^=======$ $rr/preimage\"\n\nPatches to follow.\n\n-brandon\n"},{"id":"113109","messageId":"IHOAO7NDkb8K9nkprnkd2cQW6duDZ3aYmQzpqboBi5HibQoO83nGG2Z4562gIb22HVW3ho6Z250@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"-ElxRhvpfY_jx1Ps8nJ42rHdrKbR03T1y96WpGK19gM@cipher.nrlssc.navy.mil","subject":"[PATCH 0/4] workaround some Solaris sed issues","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-06T18:29:13Z","receivedAt":"2009-05-06T18:29:13Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Here are 4 patches that I have been using to work around the issue that\nsed on Solaris exits non-zero if it's input is not newline terminated.\n\nThe first two patches are signed-off-on and I think can be applied to\ngit.git.\n\nThe last two are kludges which Junio may not want to apply and maybe\nsomeone has a better work around for.\n\nBrandon Casey (4):\n  t4118: add missing '&&'\n  t4118: avoid sed invocation on file without terminating newline\n  t/annotate-tests.sh: avoid passing a non-newline terminated file to\n    sed\n  t4200: avoid passing a non-newline terminated file to sed\n\n t/annotate-tests.sh            |    5 ++++-\n t/t4118-apply-empty-context.sh |    4 ++--\n t/t4200-rerere.sh              |    2 +-\n 3 files changed, 7 insertions(+), 4 deletions(-)\n"},{"id":"113107","messageId":"IHOAO7NDkb8K9nkprnkd2TGjPUHc5N7wdnoXRYKelDZEem1S0tynQeYlVheR46_5TDmYxS1O9i4@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"IHOAO7NDkb8K9nkprnkd2cQW6duDZ3aYmQzpqboBi5HibQoO83nGG2Z4562gIb22HVW3ho6Z250@cipher.nrlssc.navy.mil","subject":"[PATCH 1/4] t4118: add missing '&&'","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-06T18:29:14Z","receivedAt":"2009-05-06T18:29:14Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Signed-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n t/t4118-apply-empty-context.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t4118-apply-empty-context.sh b/t/t4118-apply-empty-context.sh\nindex f92e259..314bc6e 100755\n--- a/t/t4118-apply-empty-context.sh\n+++ b/t/t4118-apply-empty-context.sh\n@@ -20,7 +20,7 @@ test_expect_success setup '\n \t\tcat file1 &&\n \t\techo Q | tr -d \"\\\\012\"\n \t} >file2 &&\n-\tcat file2 >file2.orig\n+\tcat file2 >file2.orig &&\n \tgit add file1 file2 &&\n \tsed -e \"/^B/d\" <file1.orig >file1 &&\n \tsed -e \"/^[BQ]/d\" <file2.orig >file2 &&\n-- \n1.6.2.4.24.gde59d2\n"},{"id":"113106","messageId":"IHOAO7NDkb8K9nkprnkd2QibZp-GnWBSpcJ8fxO9NTUsmXbuv4_2x5S6YNLzUogav4gLkrx9ClI@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"IHOAO7NDkb8K9nkprnkd2TGjPUHc5N7wdnoXRYKelDZEem1S0tynQeYlVheR46_5TDmYxS1O9i4@cipher.nrlssc.navy.mil","subject":"[PATCH 2/4] t4118: avoid sed invocation on file without terminating newline","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-06T18:29:15Z","receivedAt":"2009-05-06T18:29:15Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Some versions of sed exit non-zero if the file they are supplied is not\nnewline terminated. Solaris's /usr/xpg4/bin/sed is one such sed.  In\nthis case the sed invocation can be avoided entirely since the resulting\nfile is equivalent to a previously created file.  So, just copy that file\ninto place instead.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n t/t4118-apply-empty-context.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t4118-apply-empty-context.sh b/t/t4118-apply-empty-context.sh\nindex 314bc6e..65f2e4c 100755\n--- a/t/t4118-apply-empty-context.sh\n+++ b/t/t4118-apply-empty-context.sh\n@@ -23,7 +23,7 @@ test_expect_success setup '\n \tcat file2 >file2.orig &&\n \tgit add file1 file2 &&\n \tsed -e \"/^B/d\" <file1.orig >file1 &&\n-\tsed -e \"/^[BQ]/d\" <file2.orig >file2 &&\n+\tcat file1 > file2 &&\n \techo Q | tr -d \"\\\\012\" >>file2 &&\n \tcat file1 >file1.mods &&\n \tcat file2 >file2.mods &&\n-- \n1.6.2.4.24.gde59d2\n"},{"id":"113105","messageId":"IHOAO7NDkb8K9nkprnkd2ZsdySdVG_ssYL84wqJwNHZYBqMWRKBIa_Ni6jJRHumlZvrQcXOEMhQ@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"IHOAO7NDkb8K9nkprnkd2QibZp-GnWBSpcJ8fxO9NTUsmXbuv4_2x5S6YNLzUogav4gLkrx9ClI@cipher.nrlssc.navy.mil","subject":"[PATCH 3/4] t/annotate-tests.sh: avoid passing a non-newline terminated file to sed","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-06T18:29:16Z","receivedAt":"2009-05-06T18:29:16Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Some versions of sed exit non-zero if the file they are supplied is not\nnewline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So\nrework this test to avoid doing so.\n\nThis affects tests t8001-annotate.sh and t8002-blame.sh.\n---\n t/annotate-tests.sh |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/t/annotate-tests.sh b/t/annotate-tests.sh\nindex cacb273..396b965 100644\n--- a/t/annotate-tests.sh\n+++ b/t/annotate-tests.sh\n@@ -114,7 +114,10 @@ test_expect_success \\\n test_expect_success \\\n     'some edit' \\\n     'mv file file.orig &&\n-    sed -e \"s/^3A/99/\" -e \"/^1A/d\" -e \"/^incomplete/d\" < file.orig > file &&\n+    {\n+\tcat file.orig &&\n+\techo\n+    } | sed -e \"s/^3A/99/\" -e \"/^1A/d\" -e \"/^incomplete/d\" > file &&\n     echo \"incomplete\" | tr -d \"\\\\012\" >>file &&\n     GIT_AUTHOR_NAME=\"D\" git commit -a -m \"edit\"'\n \n-- \n1.6.2.4.24.gde59d2\n"},{"id":"113108","messageId":"IHOAO7NDkb8K9nkprnkd2ep5vFgQr-bAuDGJW-OdtSbS6WmpSHl041GRSXpP3OcDP4_PsYKsQDU@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"IHOAO7NDkb8K9nkprnkd2ZsdySdVG_ssYL84wqJwNHZYBqMWRKBIa_Ni6jJRHumlZvrQcXOEMhQ@cipher.nrlssc.navy.mil","subject":"[PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-06T18:29:17Z","receivedAt":"2009-05-06T18:29:17Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Some versions of sed exit non-zero if the file they are supplied is not\nnewline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So\nrework this test to avoid doing so.\n---\n t/t4200-rerere.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\nindex b68ab11..48dbd8e 100755\n--- a/t/t4200-rerere.sh\n+++ b/t/t4200-rerere.sh\n@@ -190,7 +190,7 @@ test_expect_success 'file2 added differently in two branches' '\n \tgit add file2 &&\n \tgit commit -m version2 &&\n \ttest_must_fail git merge fourth &&\n-\tsha1=$(sed -e \"s/\t.*//\" .git/MERGE_RR) &&\n+\tsha1=$({ cat .git/MERGE_RR; echo; } | sed -e \"s/\t.*//\") &&\n \trr=.git/rr-cache/$sha1 &&\n \techo Cello > file2 &&\n \tgit add file2 &&\n-- \n1.6.2.4.24.gde59d2\n"},{"id":"113111","messageId":"7vhbzyukyi.fsf@alter.siamese.dyndns.org","threadId":"19194","inReplyTo":"IHOAO7NDkb8K9nkprnkd2ep5vFgQr-bAuDGJW-OdtSbS6WmpSHl041GRSXpP3OcDP4_PsYKsQDU@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-05-06T18:48:05Z","receivedAt":"2009-05-06T18:48:05Z","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> Some versions of sed exit non-zero if the file they are supplied is not\n> newline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So\n> rework this test to avoid doing so.\n\nI think up to your 3/4 is reasonable, but this is not enough for POSIX\nconformance (it is Ok if it is just aiming to fix \"Solaris quirk\").  POSIX\nsed is only required to work on text files, but .git/MERGE_RR is not a\ntext file (it is a sequence of NUL terminated records).\n\nI think something like this may work better.  Can somebody test?\n\n> -\tsha1=$(sed -e \"s/\t.*//\" .git/MERGE_RR) &&\n> +\tsha1=$({ cat .git/MERGE_RR; echo; } | sed -e \"s/\t.*//\") &&\n\n\tsha1=$(tr \"\\\\000\" \"\\\\012\" <./git/MERGE_RR | sed -e \"s/\t.*//\") &&\n"},{"id":"113132","messageId":"RsLiW_EIDQ01u5uSMUrIIMzSbMhkfwGJBEGppONH79Im4WyT76bS5A@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"7vhbzyukyi.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-06T21:12:25Z","receivedAt":"2009-05-06T21:12:25Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Junio C Hamano wrote:\n> Brandon Casey <casey@nrlssc.navy.mil> writes:\n> \n>> Some versions of sed exit non-zero if the file they are supplied is not\n>> newline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So\n>> rework this test to avoid doing so.\n> \n> I think up to your 3/4 is reasonable, but this is not enough for POSIX\n> conformance (it is Ok if it is just aiming to fix \"Solaris quirk\").  POSIX\n> sed is only required to work on text files, but .git/MERGE_RR is not a\n> text file (it is a sequence of NUL terminated records).\n> \n> I think something like this may work better.  Can somebody test?\n> \n>> -\tsha1=$(sed -e \"s/\t.*//\" .git/MERGE_RR) &&\n>> +\tsha1=$({ cat .git/MERGE_RR; echo; } | sed -e \"s/\t.*//\") &&\n> \n> \tsha1=$(tr \"\\\\000\" \"\\\\012\" <./git/MERGE_RR | sed -e \"s/\t.*//\") &&\n\nI was about to reply that this fix works fine (actually, I was about to\nreply over an hour ago but was interrupted).\n\nBut, while testing it I noticed that you had a typo in your version that\n_did_not_ cause the test to fail.  You have an extra slash in the path\nto '.git/MERGE_RR' which would have caused sha1 to be unset.\n\nThe 'sha1' variable that is set here on line 193 is used on the next line\nto set 'rr', but 'rr' is never used again.  Unless I'm missing something,\nit appears these two lines can be deleted.\n\n-brandon\n"},{"id":"113136","messageId":"7vpreluckk.fsf@alter.siamese.dyndns.org","threadId":"19194","inReplyTo":"RsLiW_EIDQ01u5uSMUrIIMzSbMhkfwGJBEGppONH79Im4WyT76bS5A@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-05-06T21:49:15Z","receivedAt":"2009-05-06T21:49:15Z","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> The 'sha1' variable that is set here on line 193 is used on the next line\n> to set 'rr', but 'rr' is never used again.  Unless I'm missing something,\n> it appears these two lines can be deleted.\n\nYeah, it looks like this is a mindless cut&paste; I do not see the point\nof setting rr there unless it is used to make sure that a corresponding\nrerere cache is created, or something.\n"},{"id":"113142","messageId":"Lle9L7vlL2vfnqjU75q2MR6WXGGP9aOKv8J97cnRHcQgyJeGbOMDDB2xJugZ0LoonfCRYmzXx9E@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"7vpreluckk.fsf@alter.siamese.dyndns.org","subject":"[PATCH 1/2] t4200: remove two unnecessary lines","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-06T22:56:17Z","receivedAt":"2009-05-06T22:56:17Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"These two lines appear to be unnecessary.  They set variables which are not\nused afterwards.  The primary motivation to remove them is that the sed\ninvocation exits non-zero for seds which require newline termination of\ninput files.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n t/t4200-rerere.sh |    2 --\n 1 files changed, 0 insertions(+), 2 deletions(-)\n\ndiff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\nindex b68ab11..504802c 100755\n--- a/t/t4200-rerere.sh\n+++ b/t/t4200-rerere.sh\n@@ -190,8 +190,6 @@ test_expect_success 'file2 added differently in two branches' '\n \tgit add file2 &&\n \tgit commit -m version2 &&\n \ttest_must_fail git merge fourth &&\n-\tsha1=$(sed -e \"s/\t.*//\" .git/MERGE_RR) &&\n-\trr=.git/rr-cache/$sha1 &&\n \techo Cello > file2 &&\n \tgit add file2 &&\n \tgit commit -m resolution\n-- \n1.6.2.4.24.gde59d2\n"},{"id":"113141","messageId":"Lle9L7vlL2vfnqjU75q2MW9kwH-igiKVkmBrtmLzQmOXU0OyvCI2tl4UD8Kdhyg0x_gCHDJIHDM@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"Lle9L7vlL2vfnqjU75q2MR6WXGGP9aOKv8J97cnRHcQgyJeGbOMDDB2xJugZ0LoonfCRYmzXx9E@cipher.nrlssc.navy.mil","subject":"[PATCH 2/2] t4200: convert sed expression which operates on non-text file to perl","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-06T22:56:18Z","receivedAt":"2009-05-06T22:56:18Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"POSIX only requires sed to work on text files and MERGE_RR is not a text\nfile.  Some versions of sed complain that this file is not newline\nterminated, and exit non-zero.  Use perl instead which does not have a\nproblem with it.\n\nSigned-off-by: Brandon Casey <casey@nrlssc.navy.mil>\n---\n\n\nInitially, I changed this to use the tr workaround Junio suggested, so it\nlooked like this:\n\n   sha1=$(tr '\\000' '\\012' <.git/MERGE_RR | sed -e 's/\t.*//')\n\nThen I noticed Jeff King's commit e85fe4d8 which changed uses of tr to perl\nfor portability's sake.  So the line became:\n\n   sha1=$(perl -pe 'y/\\000/\\012/' .git/MERGE_RR | sed -e 's/\t.*//')\n\nThen I thought, \"Why call sed?  I already started up perl, let _it_ do the\nsubstitution.\", so it became:\n\n   sha1=$(perl -pe 'y/\\000/\\012/; s/\t.*//' .git/MERGE_RR)\n\nAnd then I thought, \"Why do I need the transliteration?\".  So we end up\nwith this simple patch.\n\n-brandon\n\n\n t/t4200-rerere.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\nindex 504802c..5a1721d 100755\n--- a/t/t4200-rerere.sh\n+++ b/t/t4200-rerere.sh\n@@ -57,7 +57,7 @@ test_expect_success 'conflicting merge' '\n \ttest_must_fail git merge first\n '\n \n-sha1=$(sed -e 's/\t.*//' .git/MERGE_RR)\n+sha1=$(perl -pe 's/\t.*//' .git/MERGE_RR)\n rr=.git/rr-cache/$sha1\n test_expect_success 'recorded preimage' \"grep ^=======$ $rr/preimage\"\n \n-- \n1.6.2.4.24.gde59d2\n"},{"id":"113146","messageId":"fcaeb9bf0905061607n51457fa3x3a198c61911d0228@mail.gmail.com","threadId":"19194","inReplyTo":"alpine.DEB.1.00.0905061137300.14230@intel-tinevez-2-302","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-05-06T23:07:00Z","receivedAt":"2009-05-06T23:07:00Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, May 6, 2009 at 7:38 PM, Johannes Schindelin\n<Johannes.Schindelin@gmx.de> wrote:\n> Hi,\n>\n> On Wed, 6 May 2009, Ralf Wildenhues wrote:\n>\n>> Nguyen Thai Ngoc Duy writes:\n>> > On Wed, May 6, 2009 at 4:45 PM, Johannes Sixt wrote:\n>> > > Nguyen Thai Ngoc Duy schrieb:\n>> > >>       # normalize path:\n>> > >>       # multiple //; leading ./; /./; /../; trailing /\n>> > >>       path=$(printf '%s/\\n' \"$path\" |\n>> > >>               sed -e '\n>> > >>                       s|//*|/|g\n>> > >>                       s|^\\(\\./\\)*||\n>> > >>                       s|/\\./|/|g\n>> > >>                       :start\n>> > >>                       s|\\([^/]*\\)/\\.\\./||\n>> > >>                       tstart\n>> > >>                       s|/*$||\n>> > >>               ')\n>>\n>> > It says nothing. The result of \"printf '%s\\n' ./foo/bar | sed -e blah\"\n>> > is just wrong, (i.e. \"./\" remains). I stripped down to \"sed -e\n>> > 's|^\\(\\./\\)*||'\", does not work. Probably due to \\( \\) pair. Skimmed\n>> > through sed manpage, seems no mention of bracket grouping.\n>>\n>> Quoting 'info Autoconf \"Limitation of Usual Tools\"':\n>>\n>>      Some `sed' implementations, e.g., Solaris, restrict the special\n>>      role of the asterisk to one-character regular expressions.  This\n>>      may lead to unexpected behavior:\n>>\n>>           $ echo '1*23*4' | /usr/bin/sed 's/\\(.\\)*/x/g'\n>>           x2x4\n>>           $ echo '1*23*4' | /usr/xpg4/bin/sed 's/\\(.\\)*/x/g'\n>>           x\n>>\n>> You can work around it in this case with\n>>   :again\n>>   s|^\\./||\n>>   t again\n>>\n>> BTW, you should put a space between t and the label (but not between\n>> : and label), POSIX requires that and some sed versions expect it.\n>\n> Maybe the time is better spent on turning submodule into a builtin, before\n> it gets even larger, and before we have to jump through even more hoops\n> because of shell compatibility issues?\n\nTotally agree. git-submodule is the second largest shell script.\nBetter do it now or it will take git-rebase--interactive position as\nthe biggest one.\n-- \nDuy\n"},{"id":"113148","messageId":"fcaeb9bf0905061615v2c1b1b4fmc6ade674aabf9586@mail.gmail.com","threadId":"19194","inReplyTo":"-ElxRhvpfY_jx1Ps8nJ42rHdrKbR03T1y96WpGK19gM@cipher.nrlssc.navy.mil","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-05-06T23:15:23Z","receivedAt":"2009-05-06T23:15:23Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, May 7, 2009 at 4:14 AM, Brandon Casey <casey@nrlssc.navy.mil> wrote:\n> Nguyen Thai Ngoc Duy wrote:\n>> Hi,\n>>\n>> I did \"make test\" on a SunOS 5.10 and it failed.\n>\n>> diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\n>> index b68ab11..61ccdee 100755\n>> --- a/t/t4200-rerere.sh\n>> +++ b/t/t4200-rerere.sh\n>> @@ -57,7 +57,7 @@ test_expect_success 'conflicting merge' '\n>>       test_must_fail git merge first\n>>  '\n>>\n>> -sha1=$(sed -e 's/    .*//' .git/MERGE_RR)\n>> +sha1=$(cut -f 1 .git/MERGE_RR)\n>\n> Are you using /bin/sed?  I think it has a problem with tabs.\n\nYes I use /bin/sed. if /usr/xpg4/bin/sed is recommended, test-lib.sh\nshould set up PATH automatically, I think.\n-- \nDuy\n"},{"id":"113149","messageId":"fcaeb9bf0905061624s515d9b13i188b27f4c5472eba@mail.gmail.com","threadId":"19194","inReplyTo":"Lle9L7vlL2vfnqjU75q2MW9kwH-igiKVkmBrtmLzQmOXU0OyvCI2tl4UD8Kdhyg0x_gCHDJIHDM@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 2/2] t4200: convert sed expression which operates on non-text file to perl","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-05-06T23:24:37Z","receivedAt":"2009-05-06T23:24:37Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, May 7, 2009 at 8:56 AM, Brandon Casey <casey@nrlssc.navy.mil> wrote:\n> diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\n> index 504802c..5a1721d 100755\n> --- a/t/t4200-rerere.sh\n> +++ b/t/t4200-rerere.sh\n> @@ -57,7 +57,7 @@ test_expect_success 'conflicting merge' '\n>        test_must_fail git merge first\n>  '\n>\n> -sha1=$(sed -e 's/      .*//' .git/MERGE_RR)\n> +sha1=$(perl -pe 's/    .*//' .git/MERGE_RR)\n\nCan we have a wrapper for this please? This is correction solution.\nBut my work to make git work on windows without msys/cygwin also means\nthat I don't have perl. Maybe something like this? I know perl regex\nand sed one is not completely compatible, but it should work for\nsimple regex used here and elsewhere.\n\nsed_wrapper() {\n  if test_have_prereq PERL; then\n    perl -pe \"$@\"\n  else\n    sed -e \"$@\"\n  fi\n}\n-- \nDuy\n"},{"id":"113156","messageId":"vmGwFm-7sqyeL1D7WrJ-qBXW02LwMMHQ7rLy7XbfdUutAtORXrswbw@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"fcaeb9bf0905061615v2c1b1b4fmc6ade674aabf9586@mail.gmail.com","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-07T00:22:08Z","receivedAt":"2009-05-07T00:22:08Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Nguyen Thai Ngoc Duy wrote:\n> On Thu, May 7, 2009 at 4:14 AM, Brandon Casey <casey@nrlssc.navy.mil> wrote:\n>> Nguyen Thai Ngoc Duy wrote:\n>>> Hi,\n>>>\n>>> I did \"make test\" on a SunOS 5.10 and it failed.\n>>> diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\n>>> index b68ab11..61ccdee 100755\n>>> --- a/t/t4200-rerere.sh\n>>> +++ b/t/t4200-rerere.sh\n>>> @@ -57,7 +57,7 @@ test_expect_success 'conflicting merge' '\n>>>       test_must_fail git merge first\n>>>  '\n>>>\n>>> -sha1=$(sed -e 's/    .*//' .git/MERGE_RR)\n>>> +sha1=$(cut -f 1 .git/MERGE_RR)\n>> Are you using /bin/sed?  I think it has a problem with tabs.\n> \n> Yes I use /bin/sed. if /usr/xpg4/bin/sed is recommended, test-lib.sh\n> should set up PATH automatically, I think.\n\n/usr/xpg*/bin is where Sun puts the POSIX compliant versions of standard\nsystem utilities.\n\nThe binaries in /bin/ retain their historical Solaris behavior.\n\nCheck out the XPG4 man page on a sun.\n\nNot sure about the best route to take here.  /usr/xpg4/bin should probably\nbe in the user's PATH when git is executed too.\n\n-brandon\n"},{"id":"113158","messageId":"7vab5pu321.fsf@alter.siamese.dyndns.org","threadId":"19194","inReplyTo":"vmGwFm-7sqyeL1D7WrJ-qBXW02LwMMHQ7rLy7XbfdUutAtORXrswbw@cipher.nrlssc.navy.mil","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-05-07T01:14:46Z","receivedAt":"2009-05-07T01:14:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Brandon Casey <casey@nrlssc.navy.mil> writes:\n\n> /usr/xpg*/bin is where Sun puts the POSIX compliant versions of standard\n> system utilities.\n>\n> The binaries in /bin/ retain their historical Solaris behavior.\n>\n> Check out the XPG4 man page on a sun.\n>\n> Not sure about the best route to take here.  /usr/xpg4/bin should probably\n> be in the user's PATH when git is executed too.\n\nI doubt it is limited to git.\n\nMy experience from the days I had to do things on Solaris boxes several\nyears ago was that it was the only way to have a workable environment to\nhave /usr/xpg*/bin on my PATH.\n\nIf the contents of the stock /usr/bin has been frozen at the historical\nstate while the outside world made progress, I would imagine that the\nsituation has gotten worse for people who still use tools from /usr/bin\nand expect their scripts to be portable with anybody else.\n\nOn Solaris, I expect everybody to build git with SHELL_PATH set to\nsomething other than /bin/sh, and binary packaged one (I do not know\nSolaris have such a packaging system, though) would also be set to avoid\nthe broken /bin/sh.  I suspect you could do something like this...\n\n Makefile        |   13 +++++++++++++\n git-sh-setup.sh |    2 ++\n 2 files changed, 15 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex 6e21643..081f06a 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -3,6 +3,11 @@ all::\n \n # Define V=1 to have a more verbose compile.\n #\n+# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.\n+#\n+# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend\n+# to PATH if your tools in /usr/bin are broken.\n+#\n # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()\n # or vsnprintf() return -1 instead of number of characters which would\n # have been written to the final string if enough space had been available.\n@@ -694,6 +699,7 @@ ifeq ($(uname_S),SunOS)\n \tNEEDS_SOCKET = YesPlease\n \tNEEDS_NSL = YesPlease\n \tSHELL_PATH = /bin/bash\n+\tSANE_TOOL_PATH = /usr/xpg5/bin:/usr/xpg4/bin\n \tNO_STRCASESTR = YesPlease\n \tNO_MEMMEM = YesPlease\n \tNO_HSTRERROR = YesPlease\n@@ -852,6 +858,12 @@ endif\n -include config.mak.autogen\n -include config.mak\n \n+ifdef SANE_TOOL_PATH\n+BROKEN_PATH_FIX = s|^. @@PATH@@|PATH=$(SANE_TOOL_PATH)|\n+else\n+BROKEN_PATH_FIX = d\n+endif\n+\n ifeq ($(uname_S),Darwin)\n \tifndef NO_FINK\n \t\tifeq ($(shell test -d /sw/lib && echo y),y)\n@@ -1251,6 +1263,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh\n \t    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \\\n \t    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \\\n \t    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \\\n+\t    -e '/^# @@PATH@@/$(BROKEN_PATH_FIX)' \\\n \t    $@.sh >$@+ && \\\n \tchmod +x $@+ && \\\n \tmv $@+ $@\ndiff --git a/git-sh-setup.sh b/git-sh-setup.sh\nindex 8382339..7802581 100755\n--- a/git-sh-setup.sh\n+++ b/git-sh-setup.sh\n@@ -11,6 +11,8 @@\n # exporting it.\n unset CDPATH\n \n+# @@PATH@@:$PATH\n+\n die() {\n \techo >&2 \"$@\"\n \texit 1\n"},{"id":"113159","messageId":"fcaeb9bf0905061838l1e2079f9rd248b40c87b00388@mail.gmail.com","threadId":"19194","inReplyTo":"7vljpaycwg.fsf@alter.siamese.dyndns.org","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-05-07T01:38:16Z","receivedAt":"2009-05-07T01:38:16Z","isPatch":false,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Wed, May 6, 2009 at 4:16 PM, Junio C Hamano <gitster@pobox.com> wrote:\n>> diff --git a/t/t5300-pack-object.sh b/t/t5300-pack-object.sh\n>> index e2aa254..9a916d3 100755\n>> --- a/t/t5300-pack-object.sh\n>> +++ b/t/t5300-pack-object.sh\n>> @@ -315,7 +315,7 @@ test_expect_success 'unpacking with --strict' '\n>>       head -n 10 LIST | git update-index --index-info &&\n>>       LI=$(git write-tree) &&\n>>       rm -f .git/index &&\n>> -     tail -n 10 LIST | git update-index --index-info &&\n>> +     tail -10 LIST | git update-index --index-info &&\n>\n> I do not know why your \"head\" apparently accepts -n (see the context) but\n> not your \"tail\"; as POSIX frowns upon head/tail -$number, this one is a\n> regression.\n>\n\nI digged back in history and found Jeff's b4ce54fc, so my approach is\nwrong too. Does it have to be exactly ten last lines? If it's just one\nor two lines, then sed -ne '$p' can be used.\n-- \nDuy\n"},{"id":"113160","messageId":"fcaeb9bf0905061849v1dd50d8fk36e6804824a59032@mail.gmail.com","threadId":"19194","inReplyTo":"7vhbzyukyi.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed","fromName":"Nguyen Thai Ngoc Duy","fromEmail":"pclouds@gmail.com","sentAt":"2009-05-07T01:49:08Z","receivedAt":"2009-05-07T01:49:08Z","isPatch":true,"sender":{"key":"pclouds@gmail.com","avatar":"https://avatars.githubusercontent.com/u/720?v=4"},"body":"On Thu, May 7, 2009 at 4:48 AM, Junio C Hamano <gitster@pobox.com> wrote:\n> Brandon Casey <casey@nrlssc.navy.mil> writes:\n>\n>> Some versions of sed exit non-zero if the file they are supplied is not\n>> newline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So\n>> rework this test to avoid doing so.\n>\n> I think up to your 3/4 is reasonable, but this is not enough for POSIX\n> conformance (it is Ok if it is just aiming to fix \"Solaris quirk\").  POSIX\n> sed is only required to work on text files, but .git/MERGE_RR is not a\n> text file (it is a sequence of NUL terminated records).\n>\n> I think something like this may work better.  Can somebody test?\n>\n>> -     sha1=$(sed -e \"s/       .*//\" .git/MERGE_RR) &&\n>> +     sha1=$({ cat .git/MERGE_RR; echo; } | sed -e \"s/        .*//\") &&\n>\n>        sha1=$(tr \"\\\\000\" \"\\\\012\" <./git/MERGE_RR | sed -e \"s/  .*//\") &&\n>\n\nI would replace it again, according to e85fe4d8.\n-- \nDuy\n"},{"id":"113161","messageId":"rfLKcKXRAh_59y1L8wcIkQ16qjwUMJxA85JMjC1VL2Y42LunBol3Kg@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"fcaeb9bf0905061849v1dd50d8fk36e6804824a59032@mail.gmail.com","subject":"Re: [PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-07T02:06:10Z","receivedAt":"2009-05-07T02:06:10Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Nguyen Thai Ngoc Duy wrote:\n> On Thu, May 7, 2009 at 4:48 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>> Brandon Casey <casey@nrlssc.navy.mil> writes:\n>>\n>>> Some versions of sed exit non-zero if the file they are supplied is not\n>>> newline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So\n>>> rework this test to avoid doing so.\n>> I think up to your 3/4 is reasonable, but this is not enough for POSIX\n>> conformance (it is Ok if it is just aiming to fix \"Solaris quirk\").  POSIX\n>> sed is only required to work on text files, but .git/MERGE_RR is not a\n>> text file (it is a sequence of NUL terminated records).\n>>\n>> I think something like this may work better.  Can somebody test?\n>>\n>>> -     sha1=$(sed -e \"s/       .*//\" .git/MERGE_RR) &&\n>>> +     sha1=$({ cat .git/MERGE_RR; echo; } | sed -e \"s/        .*//\") &&\n>>        sha1=$(tr \"\\\\000\" \"\\\\012\" <./git/MERGE_RR | sed -e \"s/  .*//\") &&\n>>\n> \n> I would replace it again, according to e85fe4d8.\n\nThe line referenced above will actually be deleted unless someone chimes\nin and says it is needed.\n\nThe commit you referenced was taken into account in the patch for the other\nuse of sed on .git/MERGE_RR in the same test script:\n\"[PATCH 2/2] t4200: convert sed expression which operates on non-text-file to perl\"\n\n-brandon\n"},{"id":"113162","messageId":"lY5mDJaMc8ZsUIxG3yg4tkxBAjyuVrPMXYpGwLvsJHPpUgB4geWcOw@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"7vab5pu321.fsf@alter.siamese.dyndns.org","subject":"Re: shell compatibility issues with SunOS 5.10","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-07T02:23:31Z","receivedAt":"2009-05-07T02:23:31Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"\nI like it.  The PATH would still need to be set up properly\nfor the tests though.  Either test-lib should handle SANE_TOOL_PATH\nor Makefile could export PATH like\n\nifdef SANE_TOOL_PATH\n  PATH := $(SANE_TOOL_PATH):${PATH}\n\n-brandon\n\n\nJunio C Hamano wrote:\n\n> I suspect you could do something like this...\n\n>  Makefile        |   13 +++++++++++++\n>  git-sh-setup.sh |    2 ++\n>  2 files changed, 15 insertions(+), 0 deletions(-)\n> \n> diff --git a/Makefile b/Makefile\n> index 6e21643..081f06a 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -3,6 +3,11 @@ all::\n>  \n>  # Define V=1 to have a more verbose compile.\n>  #\n> +# Define SHELL_PATH to a POSIX shell if your /bin/sh is broken.\n> +#\n> +# Define SANE_TOOL_PATH to a colon-separated list of paths to prepend\n> +# to PATH if your tools in /usr/bin are broken.\n> +#\n>  # Define SNPRINTF_RETURNS_BOGUS if your are on a system which snprintf()\n>  # or vsnprintf() return -1 instead of number of characters which would\n>  # have been written to the final string if enough space had been available.\n> @@ -694,6 +699,7 @@ ifeq ($(uname_S),SunOS)\n>  \tNEEDS_SOCKET = YesPlease\n>  \tNEEDS_NSL = YesPlease\n>  \tSHELL_PATH = /bin/bash\n> +\tSANE_TOOL_PATH = /usr/xpg5/bin:/usr/xpg4/bin\n>  \tNO_STRCASESTR = YesPlease\n>  \tNO_MEMMEM = YesPlease\n>  \tNO_HSTRERROR = YesPlease\n> @@ -852,6 +858,12 @@ endif\n>  -include config.mak.autogen\n>  -include config.mak\n>  \n> +ifdef SANE_TOOL_PATH\n> +BROKEN_PATH_FIX = s|^. @@PATH@@|PATH=$(SANE_TOOL_PATH)|\n> +else\n> +BROKEN_PATH_FIX = d\n> +endif\n> +\n>  ifeq ($(uname_S),Darwin)\n>  \tifndef NO_FINK\n>  \t\tifeq ($(shell test -d /sw/lib && echo y),y)\n> @@ -1251,6 +1263,7 @@ $(patsubst %.sh,%,$(SCRIPT_SH)) : % : %.sh\n>  \t    -e 's|@@PERL@@|$(PERL_PATH_SQ)|g' \\\n>  \t    -e 's/@@GIT_VERSION@@/$(GIT_VERSION)/g' \\\n>  \t    -e 's/@@NO_CURL@@/$(NO_CURL)/g' \\\n> +\t    -e '/^# @@PATH@@/$(BROKEN_PATH_FIX)' \\\n>  \t    $@.sh >$@+ && \\\n>  \tchmod +x $@+ && \\\n>  \tmv $@+ $@\n> diff --git a/git-sh-setup.sh b/git-sh-setup.sh\n> index 8382339..7802581 100755\n> --- a/git-sh-setup.sh\n> +++ b/git-sh-setup.sh\n> @@ -11,6 +11,8 @@\n>  # exporting it.\n>  unset CDPATH\n>  \n> +# @@PATH@@:$PATH\n> +\n>  die() {\n>  \techo >&2 \"$@\"\n>  \texit 1\n> \n> \n"},{"id":"113163","messageId":"7v4ovxtzlb.fsf@alter.siamese.dyndns.org","threadId":"19194","inReplyTo":"rfLKcKXRAh_59y1L8wcIkQ16qjwUMJxA85JMjC1VL2Y42LunBol3Kg@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-05-07T02:29:36Z","receivedAt":"2009-05-07T02:29:36Z","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> Nguyen Thai Ngoc Duy wrote:\n>> On Thu, May 7, 2009 at 4:48 AM, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Brandon Casey <casey@nrlssc.navy.mil> writes:\n>>>\n>>>> Some versions of sed exit non-zero if the file they are supplied is not\n>>>> newline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So\n>>>> rework this test to avoid doing so.\n>>> I think up to your 3/4 is reasonable, but this is not enough for POSIX\n>>> conformance (it is Ok if it is just aiming to fix \"Solaris quirk\").  POSIX\n>>> sed is only required to work on text files, but .git/MERGE_RR is not a\n>>> text file (it is a sequence of NUL terminated records).\n>>>\n>>> I think something like this may work better.  Can somebody test?\n>>>\n>>>> -     sha1=$(sed -e \"s/       .*//\" .git/MERGE_RR) &&\n>>>> +     sha1=$({ cat .git/MERGE_RR; echo; } | sed -e \"s/        .*//\") &&\n>>>        sha1=$(tr \"\\\\000\" \"\\\\012\" <./git/MERGE_RR | sed -e \"s/  .*//\") &&\n>\n> The line referenced above will actually be deleted unless someone chimes\n> in and says it is needed.\n\nI've already removed it; thanks.\n"},{"id":"113177","messageId":"4A028D24.9@viscovery.net","threadId":"19194","inReplyTo":"IHOAO7NDkb8K9nkprnkd2ep5vFgQr-bAuDGJW-OdtSbS6WmpSHl041GRSXpP3OcDP4_PsYKsQDU@cipher.nrlssc.navy.mil","subject":"Re: [PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed","fromName":"Johannes Sixt","fromEmail":"j.sixt@viscovery.net","sentAt":"2009-05-07T07:26:28Z","receivedAt":"2009-05-07T07:26:28Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"Brandon Casey schrieb:\n> Some versions of sed exit non-zero if the file they are supplied is not\n> newline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So\n> rework this test to avoid doing so.\n> ---\n>  t/t4200-rerere.sh |    2 +-\n>  1 files changed, 1 insertions(+), 1 deletions(-)\n> \n> diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\n> index b68ab11..48dbd8e 100755\n> --- a/t/t4200-rerere.sh\n> +++ b/t/t4200-rerere.sh\n> @@ -190,7 +190,7 @@ test_expect_success 'file2 added differently in two branches' '\n>  \tgit add file2 &&\n>  \tgit commit -m version2 &&\n>  \ttest_must_fail git merge fourth &&\n> -\tsha1=$(sed -e \"s/\t.*//\" .git/MERGE_RR) &&\n> +\tsha1=$({ cat .git/MERGE_RR; echo; } | sed -e \"s/\t.*//\") &&\n\nCouldn't that line become\n\n\tsha1=$(cat .git/MERGE_RR) &&\n\tsha1=%{sha1%%\t*} &&\n\n(a literal tab before the '*')?\n\n-- Hannes\n"},{"id":"113223","messageId":"_6ButG1D1Yw2WmmzcwyJjDYXsQ4Xp1VSI7VKH_AFjgKZ7nVeFjzl3g@cipher.nrlssc.navy.mil","threadId":"19194","inReplyTo":"4A028D24.9@viscovery.net","subject":"Re: [PATCH 4/4] t4200: avoid passing a non-newline terminated file to sed","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2009-05-07T14:57:19Z","receivedAt":"2009-05-07T14:57:19Z","isPatch":true,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Johannes Sixt wrote:\n> Brandon Casey schrieb:\n>> Some versions of sed exit non-zero if the file they are supplied is not\n>> newline terminated.  Solaris's /usr/xpg4/bin/sed is one such sed.  So\n>> rework this test to avoid doing so.\n>> ---\n>>  t/t4200-rerere.sh |    2 +-\n>>  1 files changed, 1 insertions(+), 1 deletions(-)\n>>\n>> diff --git a/t/t4200-rerere.sh b/t/t4200-rerere.sh\n>> index b68ab11..48dbd8e 100755\n>> --- a/t/t4200-rerere.sh\n>> +++ b/t/t4200-rerere.sh\n>> @@ -190,7 +190,7 @@ test_expect_success 'file2 added differently in two branches' '\n>>  \tgit add file2 &&\n>>  \tgit commit -m version2 &&\n>>  \ttest_must_fail git merge fourth &&\n>> -\tsha1=$(sed -e \"s/\t.*//\" .git/MERGE_RR) &&\n>> +\tsha1=$({ cat .git/MERGE_RR; echo; } | sed -e \"s/\t.*//\") &&\n> \n> Couldn't that line become\n> \n> \tsha1=$(cat .git/MERGE_RR) &&\n> \tsha1=%{sha1%%\t*} &&\n> \n> (a literal tab before the '*')?\n\nYes, that works here.  The line above has been removed so it's moot for\nthis case.  Your change could be applied at line 60 of t4200-rerere.sh to\nreplace my perl call that was just applied if you think it is worth it.\n\n-brandon\n"}]}