{"thread":{"id":"14487","subject":"Hacks for AIX","startedAt":"2008-07-16T17:57:43Z","lastAt":"2008-07-22T21:42:07Z","messageCount":7,"participants":["Chris Cowan","Junio C Hamano","Linus Torvalds","Brandon Casey"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"83537","messageId":"5855afd30807161057v54ed4112jaea3bc07cebf44d4@mail.gmail.com","threadId":"14487","inReplyTo":null,"subject":"Hacks for AIX","fromName":"Chris Cowan","fromEmail":"chris.o.cowan@gmail.com","sentAt":"2008-07-16T17:57:43Z","receivedAt":"2008-07-16T17:57:43Z","isPatch":false,"sender":{"key":"chris.o.cowan@gmail.com","avatar":null},"body":"I saw some earlier postings about this, so I thought I would share my\nsolution (I'm using xlc, BTW).   The following tests were broken for\nme (using a pull from 2 days ago).\n\n    * t0002-gitfile.sh\n    * t1002-read-tree-m-u-2way.sh\n    * t2201-add-update-typechange.sh\n    * t4109-apply-multifrag.sh\n    * t4110-apply-scan.sh\n    * t7002-grep.sh\n\n\nThe problems all seem to be rooted in the default utilities shipped with AIX:\n\n    * /usr/bin/grep - behaves badly in t7002.   I believe it is test\n12 and related to the -n -w -e combination of options.\n    * /usr/bin/diff - has problems with -u and -U.\n                         I saw the $GIT_CMP_TEST env var, but this is\nnot used everywhere within the test scripts above.\n    * /usr/bin/patch - really old version, doesn't do well with some\ndiff formats.   I avoid using it.\n    * /usr/bin/install - doesn't behave the expected way either.\n\nIn some cases, the tests could have been made more portable by using a\nplain \"diff\" rather than \"diff -u\", for example.\n\nFortunately, there are optional freeware versions that can be\ninstalled for all of these (along with tar and wish too).   These\nversions if installed, are all found in /usr/linux/bin (or\nequivalently /opt/freeware/bin), I just wish they weren't optional.  I\nhave found that having these utilities installed and prepending\n/usr/linux/bin to the PATH results in a clean make test and build.\n\nI also saw one instance where the behavior of git-grep was affected by\nthe grep selected at build time.    I'm not sure if there's other\ninstances within the code base, but I'm wondering whether the\nconfigure script can be changed to do the check for /usr/linux/bin and\nuse those versions?   I can imagine that similar problems may occur on\nSolaris and HPUX.\n\nOtherwise, I'm quite happy with git.\n-- \nCC\n"},{"id":"83546","messageId":"7v3am9sn2p.fsf@gitster.siamese.dyndns.org","threadId":"14487","inReplyTo":"5855afd30807161057v54ed4112jaea3bc07cebf44d4@mail.gmail.com","subject":"Re: Hacks for AIX","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-16T18:25:50Z","receivedAt":"2008-07-16T18:25:50Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\"Chris Cowan\" <chris.o.cowan@gmail.com> writes:\n\n>     * /usr/bin/grep - behaves badly in t7002.   I believe it is test\n> 12 and related to the -n -w -e combination of options.\n\nPerhaps your version of AIX needs to...\n\n    $ make NO_EXTERNAL_GREP=UnfortunatelyYesOnThisAIX\n\n>     * /usr/bin/diff - has problems with -u and -U.\n>                          I saw the $GIT_CMP_TEST env var, but this is\n> not used everywhere within the test scripts above.\n> In some cases, the tests could have been made more portable by using a\n> plain \"diff\" rather than \"diff -u\", for example.\n\nA patch to the testsuite to replace use of \"diff\" and \"diff -u\" that test\nthe actual output matches expected output with \"test_cmp\" would be\nappreciated.\n\n>     * /usr/bin/patch - really old version, doesn't do well with some\n> diff formats.   I avoid using it.\n\nt4109 seems to use patch to produce expected output for the tests; we\nshould ship a precomputed expected results.  Do you know of any other\nplaces \"patch\" is used?\n"},{"id":"83547","messageId":"alpine.LFD.1.10.0807161117460.2835@woody.linux-foundation.org","threadId":"14487","inReplyTo":"5855afd30807161057v54ed4112jaea3bc07cebf44d4@mail.gmail.com","subject":"Re: Hacks for AIX","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-07-16T18:26:28Z","receivedAt":"2008-07-16T18:26:28Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 16 Jul 2008, Chris Cowan wrote:\n> \n> I also saw one instance where the behavior of git-grep was affected by\n> the grep selected at build time.    I'm not sure if there's other\n> instances within the code base, but I'm wondering whether the\n> configure script can be changed to do the check for /usr/linux/bin and\n> use those versions?   I can imagine that similar problems may occur on\n> Solaris and HPUX.\n\nThe grep selection at compile time is purely a choice between \"no external \ngrep at all\" and \"whatever external grep is in $PATH\".\n\nexec_grep() literally does\n\n\t..\n\tpid = fork();\n\tif (pid < 0)\n\t\treturn pid;\n\tif (!pid) {\n\t\texecvp(\"grep\", (char **) argv);\n\t\texit(255);\n\t}\n\t..\n\nso you can choose your version of external grep at run-time by just \nsetting PATH appropriately.\n\nOr you can just decide that you don't want to use any external grep binary \nat all, which is the compile-time choice of NO_EXTERNAL_GREP. In that \ncase, git will do the grep implementation all internally. It can do so, \nbut then it relies on the regex() library which is often less optimized \nthan the external grep.\n\nNote the \"often\". It's possible that the external grep is never worth it, \nin which case you should use NO_EXTERNAL_GREP. GNU grep happens to be very \ngood.\n\nEven with an external grep configured in, you'll end up using the internal \none for the case where you ask for the index information (\"--cached\") or \nwhen you ask for a particular version of the tree rather than the \nchecked-out tree. So regardless, you'll fall back to the internal version \nfor some things.\n\n\t\t\tLinus\n"},{"id":"83922","messageId":"JG5kjY-tH7BPWcgn8u14UlNtG-iT5ab0jyExlDkbmv3hzFsVs2Ve0Q@cipher.nrlssc.navy.mil","threadId":"14487","inReplyTo":"7v3am9sn2p.fsf@gitster.siamese.dyndns.org","subject":"Re: Hacks for AIX","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-07-18T23:14:07Z","receivedAt":"2008-07-18T23:14:07Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Junio C Hamano wrote:\n> \"Chris Cowan\" <chris.o.cowan@gmail.com> writes:\n\n>>     * /usr/bin/patch - really old version, doesn't do well with some\n>> diff formats.   I avoid using it.\n> \n> t4109 seems to use patch to produce expected output for the tests; we\n> should ship a precomputed expected results.  Do you know of any other\n> places \"patch\" is used?\n\nt4110 also uses patch in the same way.\n\n-brandon\n"},{"id":"84010","messageId":"7vd4l9c5ud.fsf@gitster.siamese.dyndns.org","threadId":"14487","inReplyTo":"7v3am9sn2p.fsf@gitster.siamese.dyndns.org","subject":"Re: Hacks for AIX","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2008-07-20T08:33:46Z","receivedAt":"2008-07-20T08:33:46Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Junio C Hamano <gitster@pobox.com> writes:\n\n>>     * /usr/bin/patch - really old version, doesn't do well with some\n>> diff formats.   I avoid using it.\n>\n> t4109 seems to use patch to produce expected output for the tests; we\n> should ship a precomputed expected results.  Do you know of any other\n> places \"patch\" is used?\n\nAs usual, I won't commit this patch unless I hear from people who\npotentially would benefit from it.  I do not need such a patch myself and\nI really shouldn't be spending too much of my time on these.\n\n-- >8 --\n[PATCH] do not rely on external \"patch\" in tests\n\nSome of our tests assumed a working \"patch\" command to produce expected\nresults when checking \"git-apply\", but some systems have broken \"patch\".\n\nWe can compare our output with expected output that is precomputed\ninstead to sidestep this issue.\n\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\n---\n t/t4109-apply-multifrag.sh |  119 +++++++++++++++++++++++++++++++++++---------\n t/t4110-apply-scan.sh      |   35 ++++++++++---\n 2 files changed, 123 insertions(+), 31 deletions(-)\n\ndiff --git a/t/t4109-apply-multifrag.sh b/t/t4109-apply-multifrag.sh\nindex bd40a21..4805863 100755\n--- a/t/t4109-apply-multifrag.sh\n+++ b/t/t4109-apply-multifrag.sh\n@@ -138,39 +138,112 @@ diff --git a/main.c b/main.c\n  \n EOF\n \n-test_expect_success \"S = git apply (1)\" \\\n-    'git apply patch1.patch patch2.patch'\n-mv main.c main.c.git\n+cat >expect_1 <<\\EOF\n+#include <stdlib.h>\n+#include <stdio.h>\n \n-test_expect_success \"S = patch (1)\" \\\n-    'cat patch1.patch patch2.patch | patch -p1'\n+int func(int num);\n+void print_int(int num);\n+void print_ln();\n \n-test_expect_success \"S = cmp (1)\" \\\n-    'cmp main.c.git main.c'\n+int main() {\n+\tint i;\n \n-rm -f main.c main.c.git\n+\tfor (i = 0; i < 10; i++) {\n+\t\tprint_int(func(i));\n+\t}\n \n-test_expect_success \"S = git apply (2)\" \\\n-    'git apply patch1.patch patch2.patch patch3.patch'\n-mv main.c main.c.git\n+\tprint_ln();\n \n-test_expect_success \"S = patch (2)\" \\\n-    'cat patch1.patch patch2.patch patch3.patch | patch -p1'\n+\treturn 0;\n+}\n \n-test_expect_success \"S = cmp (2)\" \\\n-    'cmp main.c.git main.c'\n+int func(int num) {\n+\treturn num * num;\n+}\n \n-rm -f main.c main.c.git\n+void print_int(int num) {\n+\tprintf(\"%d\", num);\n+}\n \n-test_expect_success \"S = git apply (3)\" \\\n-    'git apply patch1.patch patch4.patch'\n-mv main.c main.c.git\n+void print_ln() {\n+\tprintf(\"\\n\");\n+}\n \n-test_expect_success \"S = patch (3)\" \\\n-    'cat patch1.patch patch4.patch | patch -p1'\n+EOF\n+\n+test_expect_success 'git apply (1)' '\n+\tgit apply patch1.patch patch2.patch &&\n+\tmv main.c actual &&\n+\ttest_cmp expect_1 actual\n+'\n+\n+cat >expect_2 <<\\EOF\n+#include <stdio.h>\n+\n+int func(int num);\n+void print_int(int num);\n+\n+int main() {\n+\tint i;\n+\n+\tfor (i = 0; i < 10; i++) {\n+\t\tprint_int(func(i));\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int func(int num) {\n+\treturn num * num;\n+}\n+\n+void print_int(int num) {\n+\tprintf(\"%d\", num);\n+}\n+\n+EOF\n \n-test_expect_success \"S = cmp (3)\" \\\n-    'cmp main.c.git main.c'\n+test_expect_success 'git apply (2)' '\n+\trm -f main.c &&\n+\tgit apply patch1.patch patch2.patch patch3.patch &&\n+\tmv main.c actual &&\n+\ttest_cmp expect_2 actual\n+'\n+\n+cat >expect_3 <<\\EOF\n+#include <stdio.h>\n+\n+int func(int num);\n+int func2(int num);\n+\n+int main() {\n+\tint i;\n+\n+\tfor (i = 0; i < 10; i++) {\n+\t\tprintf(\"%d\", func(i));\n+\t\tprintf(\"%d\", func3(i));\n+\t}\n+\n+\treturn 0;\n+}\n+\n+int func(int num) {\n+\treturn num * num;\n+}\n+\n+int func2(int num) {\n+\treturn num * num * num;\n+}\n+\n+EOF\n+\n+test_expect_success 'git apply (3)' '\n+\trm -f main.c &&\n+\tgit apply patch1.patch patch4.patch &&\n+\tmv main.c actual &&\n+\ttest_cmp expect_3 actual\n+'\n \n test_done\n \ndiff --git a/t/t4110-apply-scan.sh b/t/t4110-apply-scan.sh\nindex db60652..ae300ca 100755\n--- a/t/t4110-apply-scan.sh\n+++ b/t/t4110-apply-scan.sh\n@@ -86,15 +86,34 @@ diff --git a/new.txt b/new.txt\n +c2222\n EOF\n \n-test_expect_success \"S = git apply scan\" \\\n-    'git apply patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch'\n-mv new.txt apply.txt\n+cat >expect <<\\EOF\n+a1\n+a11\n+a111\n+a1111\n+b1\n+b11\n+b111\n+b1111\n+b2\n+b22\n+b222\n+b2222\n+c1\n+c11\n+c111\n+c1111\n+c2\n+c22\n+c222\n+c2222\n+EOF\n \n-test_expect_success \"S = patch scan\" \\\n-    'cat patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch | patch'\n-mv new.txt patch.txt\n \n-test_expect_success \"S = cmp\" \\\n-    'cmp apply.txt patch.txt'\n+test_expect_success 'apply series of patches' '\n+\tgit apply patch1.patch patch2.patch patch3.patch patch4.patch patch5.patch &&\n+\tmv new.txt actual &&\n+\ttest_cmp expect actual\n+'\n \n test_done\n"},{"id":"84198","messageId":"hT7kYDX9f_eBxi8JC0s7jG9oqm8sZ1QCTlEg1n8Dqus7U98hWLWnBA@cipher.nrlssc.navy.mil","threadId":"14487","inReplyTo":"7vd4l9c5ud.fsf@gitster.siamese.dyndns.org","subject":"Re: Hacks for AIX","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-07-21T15:39:28Z","receivedAt":"2008-07-21T15:39:28Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Junio C Hamano wrote:\n> Junio C Hamano <gitster@pobox.com> writes:\n> \n>>>     * /usr/bin/patch - really old version, doesn't do well with some\n>>> diff formats.   I avoid using it.\n>> t4109 seems to use patch to produce expected output for the tests; we\n>> should ship a precomputed expected results.  Do you know of any other\n>> places \"patch\" is used?\n> \n> As usual, I won't commit this patch unless I hear from people who\n> potentially would benefit from it.  I do not need such a patch myself and\n> I really shouldn't be spending too much of my time on these.\n\n\nUnless I'm doing something wrong, this doesn't apply cleanly to master.\n\n\n> -- >8 --\n> [PATCH] do not rely on external \"patch\" in tests\n> \n> Some of our tests assumed a working \"patch\" command to produce expected\n> results when checking \"git-apply\", but some systems have broken \"patch\".\n> \n> We can compare our output with expected output that is precomputed\n> instead to sidestep this issue.\n> \n> Signed-off-by: Junio C Hamano <gitster@pobox.com>\n> ---\n>  t/t4109-apply-multifrag.sh |  119 +++++++++++++++++++++++++++++++++++---------\n>  t/t4110-apply-scan.sh      |   35 ++++++++++---\n>  2 files changed, 123 insertions(+), 31 deletions(-)\n> \n> diff --git a/t/t4109-apply-multifrag.sh b/t/t4109-apply-multifrag.sh\n> index bd40a21..4805863 100755\n> --- a/t/t4109-apply-multifrag.sh\n> +++ b/t/t4109-apply-multifrag.sh\n> @@ -138,39 +138,112 @@ diff --git a/main.c b/main.c\n\nThe t4109-apply-multifrag.sh that I have only has 52 lines.\n\n>  EOF\n\nIt does not have this line above. Perhaps you also moved the\n../t4109/patch*.patch files into the script in another commit?\n\n-brandon\n"},{"id":"84382","messageId":"egpEt3GbPWBZ1DtILuSJ02MgOG3IyxmMVqfP6ebtANiJ-7fx7sn29Q@cipher.nrlssc.navy.mil","threadId":"14487","inReplyTo":"hT7kYDX9f_eBxi8JC0s7jG9oqm8sZ1QCTlEg1n8Dqus7U98hWLWnBA@cipher.nrlssc.navy.mil","subject":"Re: Hacks for AIX","fromName":"Brandon Casey","fromEmail":"casey@nrlssc.navy.mil","sentAt":"2008-07-22T21:42:07Z","receivedAt":"2008-07-22T21:42:07Z","isPatch":false,"sender":{"key":"drafnel@gmail.com","avatar":"https://avatars.githubusercontent.com/u/921167?v=4"},"body":"Brandon Casey wrote:\n> Junio C Hamano wrote:\n>> Junio C Hamano <gitster@pobox.com> writes:\n>>\n>>>>     * /usr/bin/patch - really old version, doesn't do well with some\n>>>> diff formats.   I avoid using it.\n>>> t4109 seems to use patch to produce expected output for the tests; we\n>>> should ship a precomputed expected results.  Do you know of any other\n>>> places \"patch\" is used?\n>> As usual, I won't commit this patch unless I hear from people who\n>> potentially would benefit from it.  I do not need such a patch myself and\n>> I really shouldn't be spending too much of my time on these.\n> \n> \n> Unless I'm doing something wrong, this doesn't apply cleanly to master.\n\nI figured out that your patch was against maint.\n\nI see it is now applied to master and it helps out on solaris with old patch.\n\nNow I need to get rid of 'diff -U0' in t1002-read-tree-m-u-2way.sh.\n\n-brandon\n"}]}