{"thread":{"id":"24326","subject":"[PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","startedAt":"2010-07-08T00:42:15Z","lastAt":"2010-08-18T10:41:09Z","messageCount":36,"participants":["Ævar Arnfjörð Bjarmason","Junio C Hamano","René Scharfe","Andreas Schwab","Jonathan Nieder","Paolo Bonzini"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"145073","messageId":"1278549735-19278-1-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":null,"subject":"[PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-07-08T00:42:15Z","receivedAt":"2010-07-08T00:42:15Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Change the git grep test that utilizes the REG_STARTEND flag so that\nit doesn't TODO pass on platforms where REG_STARTEND is supported.\n\nGit's own harness doesn't care, but a TAP harness will report all TODO\ntests that pass. Having t7008-grep-binary.sh be the only test (aside\nfrom the test-lib.sh test) that passes a TODO test is distracting.\n\nBefore prove(1)'s test summary looked like this:\n\n    All tests successful.\n\n    Test Summary Report\n    -------------------\n    ./t0000-basic.sh                        (Wstat: 0 Tests: 46 Failed: 0)\n      TODO passed:   5\n    ./t7008-grep-binary.sh                  (Wstat: 0 Tests: 18 Failed: 0)\n      TODO passed:   11\n    Files=476, Tests=6071, [...]\n    Result: PASS\n\nAnd now it'll give:\n\n    All tests successful.\n\n    Test Summary Report\n    -------------------\n    ./t0000-basic.sh                        (Wstat: 0 Tests: 46 Failed: 0)\n      TODO passed:   5\n    Files=476, Tests=6071,\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t7008-grep-binary.sh |   15 ++++++++++-----\n 1 files changed, 10 insertions(+), 5 deletions(-)\n\ndiff --git a/t/t7008-grep-binary.sh b/t/t7008-grep-binary.sh\nindex eb8ca88..6fd2b40 100755\n--- a/t/t7008-grep-binary.sh\n+++ b/t/t7008-grep-binary.sh\n@@ -59,11 +59,16 @@ test_expect_success 'git grep -Fi iLE a' '\n \tgit grep -Fi iLE a\n '\n \n-# This test actually passes on platforms where regexec() supports the\n-# flag REG_STARTEND.\n-test_expect_failure 'git grep ile a' '\n-\tgit grep ile a\n-'\n+if git grep ile a\n+then\n+\t# This only passes on platforms where regexec() supports the\n+\t# REG_STARTEND flag.\n+\ttest_expect_success 'git grep ile a' 'git grep ile a'\n+else\n+\t# On platforms where REG_STARTEND isn't supported we mark the\n+\t# failure as a TODO.\n+\ttest_expect_failure 'git grep ile a' 'git grep ile a'\n+fi\n \n test_expect_failure 'git grep .fi a' '\n \tgit grep .fi a\n-- \n1.7.0.4\n"},{"id":"145156","messageId":"7viq4ppxt9.fsf@alter.siamese.dyndns.org","threadId":"24326","inReplyTo":"1278549735-19278-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-07-08T19:40:02Z","receivedAt":"2010-07-08T19:40:02Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n\n> +if git grep ile a\n> +then\n> +\ttest_expect_success 'git grep ile a' 'git grep ile a'\n> +else\n> +\ttest_expect_failure 'git grep ile a' 'git grep ile a'\n> +fi\n\nSo if command \"X\" is known to succeed, we run it inside expect_success\nand if not we run it inside expect_failure?\n\nWhat kind of idiocy is that, I have to wonder...\n"},{"id":"145160","messageId":"AANLkTikuGY4LVrCB6UoGFhxthoI8MgvAXCwCbiXhwq_d@mail.gmail.com","threadId":"24326","inReplyTo":"7viq4ppxt9.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-07-08T20:09:17Z","receivedAt":"2010-07-08T20:09:17Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Thu, Jul 8, 2010 at 19:40, Junio C Hamano <gitster@pobox.com> wrote:\n> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>\n>> +if git grep ile a\n>> +then\n>> +     test_expect_success 'git grep ile a' 'git grep ile a'\n>> +else\n>> +     test_expect_failure 'git grep ile a' 'git grep ile a'\n>> +fi\n>\n> So if command \"X\" is known to succeed, we run it inside expect_success\n> and if not we run it inside expect_failure?\n>\n> What kind of idiocy is that, I have to wonder...\n\nWell, the point is to normalize the test suite so that we never have\npassing TODO tests if everything's OK.\n"},{"id":"145166","messageId":"4C364A0B.2020909@lsrfire.ath.cx","threadId":"24326","inReplyTo":"AANLkTikuGY4LVrCB6UoGFhxthoI8MgvAXCwCbiXhwq_d@mail.gmail.com","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"René Scharfe","fromEmail":"rene.scharfe@lsrfire.ath.cx","sentAt":"2010-07-08T21:58:35Z","receivedAt":"2010-07-08T21:58:35Z","isPatch":true,"sender":{"key":"l.s.r@web.de","avatar":"https://avatars.githubusercontent.com/u/26122331?v=4"},"body":"Am 08.07.2010 22:09, schrieb Ævar Arnfjörð Bjarmason:\n> On Thu, Jul 8, 2010 at 19:40, Junio C Hamano <gitster@pobox.com> wrote:\n>> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>>\n>>> +if git grep ile a\n>>> +then\n>>> +     test_expect_success 'git grep ile a' 'git grep ile a'\n>>> +else\n>>> +     test_expect_failure 'git grep ile a' 'git grep ile a'\n>>> +fi\n>>\n>> So if command \"X\" is known to succeed, we run it inside expect_success\n>> and if not we run it inside expect_failure?\n>>\n>> What kind of idiocy is that, I have to wonder...\n> \n> Well, the point is to normalize the test suite so that we never have\n> passing TODO tests if everything's OK.\n\nIn this particular case the tested functionality is not provided accross\nall platforms supported by git.  It would be better to fix the actual\nissue, namely that the fallback regex lib we provide doesn't support\nREG_STARTEND.\n\nRené\n"},{"id":"145627","messageId":"AANLkTin5a39MQurIdXYu-SZVLhNTefbyZmJALT5SrdQF@mail.gmail.com","threadId":"24326","inReplyTo":"4C364A0B.2020909@lsrfire.ath.cx","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-07-15T15:32:57Z","receivedAt":"2010-07-15T15:32:57Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Thu, Jul 8, 2010 at 21:58, René Scharfe <rene.scharfe@lsrfire.ath.cx> wrote:\n\n> In this particular case the tested functionality is not provided accross\n> all platforms supported by git.  It would be better to fix the actual\n> issue, namely that the fallback regex lib we provide doesn't support\n> REG_STARTEND.\n\nWe're currently providing the GNU regex library, it seems Mac OS X and\nFreeBSD ship with a regex library that has REG_STARTEND (according to\n`git log --reverse compat/regex` the current library was added because\nof incompatibilities on OSX, but those were since fixed in\n310e0216c8).\n\nIf the FreeBSD and Mac OS X implementations are good enough we could\njust swap the GNU one for the FreeBSD one\n(http://www.freebsd.org/cgi/cvsweb.cgi/src/lib/libc/regex/). Is there\nany reason not to do this, or would a different regex library be a\nbetter fit?\n"},{"id":"145643","messageId":"7vtyo0vdpz.fsf@alter.siamese.dyndns.org","threadId":"24326","inReplyTo":"AANLkTikuGY4LVrCB6UoGFhxthoI8MgvAXCwCbiXhwq_d@mail.gmail.com","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-07-15T17:47:52Z","receivedAt":"2010-07-15T17:47:52Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> On Thu, Jul 8, 2010 at 19:40, Junio C Hamano <gitster@pobox.com> wrote:\n>> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>>\n>>> +if git grep ile a\n>>> +then\n>>> +     test_expect_success 'git grep ile a' 'git grep ile a'\n>>> +else\n>>> +     test_expect_failure 'git grep ile a' 'git grep ile a'\n>>> +fi\n>>\n>> So if command \"X\" is known to succeed, we run it inside expect_success\n>> and if not we run it inside expect_failure?\n>>\n>> What kind of idiocy is that, I have to wonder...\n>\n> Well, the point is to normalize the test suite so that we never have\n> passing TODO tests if everything's OK.\n\nI do not consider a test that passes under some condition but doesn't\nunder some other condition \"everything is OK\".  Marking the test as\n\"expect failure\" as René originally did makes a lot of sense to me.\n\nThe quoted patch is even worse as it will _actively_ prevent you from\ncatching a new error you just introduced while futzing \"git grep\" on a\nplatform that used to work.  Your \"if\" statement will say \"ah, grep is\nbroken\", and you will use expect-failure, not because your platform does\nnot support REG_STARTEND, but because you broke \"git grep\".\n\nThe point of having tests is to help you catch your bugs while you\ndevelop.  A test that turns itself off when the feature it is testing is\nbroken helps nobody.\n\nSo forget about \"passing TODO tests\", whatever a \"TODO test\" is.  The\nchange in question is actively _wrong_.\n"},{"id":"145646","messageId":"AANLkTim-4I5Sdu653yJOmnVYDqI8bb71839Vqfd3FKCi@mail.gmail.com","threadId":"24326","inReplyTo":"7vtyo0vdpz.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-07-15T18:44:10Z","receivedAt":"2010-07-15T18:44:10Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Thu, Jul 15, 2010 at 17:47, Junio C Hamano <gitster@pobox.com> wrote:\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>\n>> On Thu, Jul 8, 2010 at 19:40, Junio C Hamano <gitster@pobox.com> wrote:\n>>> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>>>\n>>>> +if git grep ile a\n>>>> +then\n>>>> +     test_expect_success 'git grep ile a' 'git grep ile a'\n>>>> +else\n>>>> +     test_expect_failure 'git grep ile a' 'git grep ile a'\n>>>> +fi\n>>>\n>>> So if command \"X\" is known to succeed, we run it inside expect_success\n>>> and if not we run it inside expect_failure?\n>>>\n>>> What kind of idiocy is that, I have to wonder...\n>>\n>> Well, the point is to normalize the test suite so that we never have\n>> passing TODO tests if everything's OK.\n>\n> I do not consider a test that passes under some condition but doesn't\n> under some other condition \"everything is OK\".  Marking the test as\n> \"expect failure\" as René originally did makes a lot of sense to me.\n>\n> The quoted patch is even worse as it will _actively_ prevent you from\n> catching a new error you just introduced while futzing \"git grep\" on a\n> platform that used to work.  Your \"if\" statement will say \"ah, grep is\n> broken\", and you will use expect-failure, not because your platform does\n> not support REG_STARTEND, but because you broke \"git grep\".\n>\n> The point of having tests is to help you catch your bugs while you\n> develop.  A test that turns itself off when the feature it is testing is\n> broken helps nobody.\n>\n> So forget about \"passing TODO tests\", whatever a \"TODO test\" is.  The\n> change in question is actively _wrong_.\n\nI was under the impression that REG_STARTEND was considered purely\nicing on the cake, i.e. that the tests should be passing whether or\nnot it was present.\n\nI guess my reasoning at the time was that if that wasn't the case,\nreporting an unexpected pass by default, as opposed to a failing TODO\non platforms without REG_STARTEND. Since only TAP will report this, I\nthought that was just an omission.\n\nAnyway, since REG_STARTEND *isn't* obviously considered icing you're\nof course right, but the test is still broken as-is. Now it reports an\nabnormal condition if REG_STARTEND is present (passing TODO test), it\nshould instead have a failing TODO test where REG_STARTEND isn't\npresent. I'll come up with a patch to fix that.\n\nWe should also just upgrade the GNU regex library in compat/regex to\nthe version that supports REG_STARTEND. Unfortunately that seems\neasier said than done, since the library is now part of glibc, and has\naquired a lot of glibc specific macros and other constructs that would\nneed to be #defined away or otherwise worked around.\n\nThanks for the review.\n"},{"id":"145690","messageId":"AANLkTimQZDT3PuiLDdjPXzWlLiEI5Iv1zy5iFPlRswyC@mail.gmail.com","threadId":"24326","inReplyTo":"20100715220059.GA3312@burratino","subject":"Re: [RFC/PATCH] Update compat/regex","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-07-16T13:58:03Z","receivedAt":"2010-07-16T13:58:03Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Thu, Jul 15, 2010 at 22:00, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> The old glibc regular expression library git uses does not support\n> REG_STARTEND. Borrow the latest version from the GNU C library\n> (version 2.12, license is LGPL 2.1 or later).\n>\n> Changes from glibc version: update the FSF address in the license\n> header, use _LIBC_REGEX macro to allow building outside of glibc,\n> add MAX, bool, true, and false macros to allow building with a C89\n> compiler.\n>\n> Reintroduces warnings that were fixed in git before.  They can be\n> defeated again separately.  Nevertheless this should be an\n> improvement.\n\nThose should be funneled upstream anyway, not just fixed in our tree.\n\n> Signed-off-by: Jonathan Nieder <jrnieder@gmail.com>\n> ---\n> Ęvar Arnfjörš Bjarmason wrote:\n>\n>> Unfortunately that seems\n>> easier said than done, since the library is now part of glibc, and has\n>> aquired a lot of glibc specific macros and other constructs\n>\n> Oh, come on. :)\n>\n> Completely untested.\n\nThis patch has all the glibc-specific stuff that makes it break hard\nif you don't have the GNU C library. Writing macros/definitions to fix all that\nstuff up was the \"easier said than done\" part I was referring to.\n\nIt's probably not that hard (although I wouldn't put it past GNU to\nhave e.g. GCC-specific stuff in the code, but I haven't checked), just\ntedious.\n\non Solaris:\n\n    In file included from compat/regex/regex.c:73:\n    compat/regex/regex_internal.c:40: error: syntax error before\n\"re_string_allocate\"\n    compat/regex/regex_internal.c:42: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:68: error: syntax error before\n\"re_string_construct\"\n    compat/regex/regex_internal.c:70: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:131: error: syntax error before\n\"re_string_realloc_buffers\"\n    compat/regex/regex_internal.c:132: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:132: error: conflicting types for\n're_string_realloc_buffers'\n    compat/regex/regex_internal.h:392: error: previous declaration of\n're_string_realloc_buffers' was here\n    compat/regex/regex_internal.c:132: error: conflicting types for\n're_string_realloc_buffers'\n    compat/regex/regex_internal.h:392: error: previous declaration of\n're_string_realloc_buffers' was here\n    compat/regex/regex_internal.c:572: error: syntax error before\n\"re_string_reconstruct\"\n    compat/regex/regex_internal.c:573: warning: return type defaults to `int'\n    compat/regex/regex_internal.c: In function `re_string_reconstruct':\n    compat/regex/regex_internal.c:687: warning: unused variable `prev_valid_len'\n    compat/regex/regex_internal.c: At top level:\n    compat/regex/regex_internal.c:962: error: syntax error before\n\"re_node_set_alloc\"\n    compat/regex/regex_internal.c:963: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:974: error: syntax error before\n\"re_node_set_init_1\"\n    compat/regex/regex_internal.c:975: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:990: error: syntax error before\n\"re_node_set_init_2\"\n    compat/regex/regex_internal.c:991: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:1020: error: syntax error before\n\"re_node_set_init_copy\"\n    compat/regex/regex_internal.c:1021: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:1045: error: syntax error before\n\"re_node_set_add_intersect\"\n    compat/regex/regex_internal.c:1047: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:1136: error: syntax error before\n\"re_node_set_init_union\"\n    compat/regex/regex_internal.c:1138: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:1189: error: syntax error before\n\"re_node_set_merge\"\n    compat/regex/regex_internal.c:1190: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:1272: error: syntax error before\n\"re_node_set_insert\"\n    compat/regex/regex_internal.c:1273: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:1329: error: syntax error before\n\"re_node_set_insert_last\"\n    compat/regex/regex_internal.c:1330: warning: return type defaults to `int'\n    compat/regex/regex_internal.c: In function `re_dfa_add_node':\n    compat/regex/regex_internal.c:1406: warning: unused variable `type'\n    compat/regex/regex_internal.c: At top level:\n    compat/regex/regex_internal.c:1472: error: syntax error before\n\"re_acquire_state\"\n    compat/regex/regex_internal.c:1474: warning: return type defaults to `int'\n    compat/regex/regex_internal.c: In function `re_acquire_state':\n    compat/regex/regex_internal.c:1493: warning: return makes integer\nfrom pointer without a cast\n    compat/regex/regex_internal.c:1501: warning: return makes integer\nfrom pointer without a cast\n    compat/regex/regex_internal.c: At top level:\n    compat/regex/regex_internal.c:1516: error: syntax error before\n\"re_acquire_state_context\"\n    compat/regex/regex_internal.c:1518: warning: return type defaults to `int'\n    compat/regex/regex_internal.c: In function `re_acquire_state_context':\n    compat/regex/regex_internal.c:1537: warning: return makes integer\nfrom pointer without a cast\n    compat/regex/regex_internal.c:1544: warning: return makes integer\nfrom pointer without a cast\n    compat/regex/regex_internal.c: At top level:\n    compat/regex/regex_internal.c:1553: error: syntax error before\n\"register_state\"\n    compat/regex/regex_internal.c:1555: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:1608: error: syntax error before\n\"create_ci_newstate\"\n    compat/regex/regex_internal.c:1610: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:1610: error: conflicting types for\n'create_ci_newstate'\n    compat/regex/regex_internal.c:27: error: previous declaration of\n'create_ci_newstate' was here\n    compat/regex/regex_internal.c:1610: error: conflicting types for\n'create_ci_newstate'\n    compat/regex/regex_internal.c:27: error: previous declaration of\n'create_ci_newstate' was here\n    compat/regex/regex_internal.c: In function `create_ci_newstate':\n    compat/regex/regex_internal.c:1650: warning: return makes integer\nfrom pointer without a cast\n    compat/regex/regex_internal.c: At top level:\n    compat/regex/regex_internal.c:1658: error: syntax error before\n\"create_cd_newstate\"\n    compat/regex/regex_internal.c:1660: warning: return type defaults to `int'\n    compat/regex/regex_internal.c:1660: error: conflicting types for\n'create_cd_newstate'\n    compat/regex/regex_internal.c:31: error: previous declaration of\n'create_cd_newstate' was here\n    compat/regex/regex_internal.c:1660: error: conflicting types for\n'create_cd_newstate'\n    compat/regex/regex_internal.c:31: error: previous declaration of\n'create_cd_newstate' was here\n    compat/regex/regex_internal.c: In function `create_cd_newstate':\n    compat/regex/regex_internal.c:1726: warning: return makes integer\nfrom pointer without a cast\n    In file included from compat/regex/regex.c:74:\n    compat/regex/regcomp.c: In function `create_initial_state':\n    compat/regex/regcomp.c:1013: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regcomp.c:1020: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regcomp.c:1022: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regcomp.c:1026: warning: assignment makes pointer\nfrom integer without a cast\n    In file included from compat/regex/regex.c:75:\n    compat/regex/regexec.c: In function `regexec':\n    compat/regex/regexec.c:230: warning: unused variable `dfa'\n    compat/regex/regexec.c: In function `re_search_stub':\n    compat/regex/regexec.c:418: warning: unused variable `dfa'\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:629: error: syntax error before \"re_search_internal\"\n    compat/regex/regexec.c:631: warning: return type defaults to `int'\n    compat/regex/regexec.c:631: error: conflicting types for\n're_search_internal'\n    compat/regex/regexec.c:43: error: previous declaration of\n're_search_internal' was here\n    compat/regex/regexec.c:631: error: conflicting types for\n're_search_internal'\n    compat/regex/regexec.c:43: error: previous declaration of\n're_search_internal' was here\n    compat/regex/regexec.c:956: error: syntax error before\n\"prune_impossible_nodes\"\n    compat/regex/regexec.c:957: warning: return type defaults to `int'\n    compat/regex/regexec.c:957: error: conflicting types for\n'prune_impossible_nodes'\n    compat/regex/regexec.c:56: error: previous declaration of\n'prune_impossible_nodes' was here\n    compat/regex/regexec.c:957: error: conflicting types for\n'prune_impossible_nodes'\n    compat/regex/regexec.c:56: error: previous declaration of\n'prune_impossible_nodes' was here\n    compat/regex/regexec.c: In function `acquire_init_state_context':\n    compat/regex/regexec.c:1074: warning: return makes pointer from\ninteger without a cast\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:1095: error: syntax error before \"check_matching\"\n    compat/regex/regexec.c:1097: warning: return type defaults to `int'\n    compat/regex/regexec.c:1097: error: conflicting types for 'check_matching'\n    compat/regex/regexec.c:58: error: previous declaration of\n'check_matching' was here\n    compat/regex/regexec.c:1097: error: conflicting types for 'check_matching'\n    compat/regex/regexec.c:58: error: previous declaration of\n'check_matching' was here\n    compat/regex/regexec.c:1368: error: syntax error before \"push_fail_stack\"\n    compat/regex/regexec.c:1370: warning: return type defaults to `int'\n    compat/regex/regexec.c:1370: error: conflicting types for 'push_fail_stack'\n    compat/regex/regexec.c:69: error: previous declaration of\n'push_fail_stack' was here\n    compat/regex/regexec.c:1370: error: conflicting types for 'push_fail_stack'\n    compat/regex/regexec.c:69: error: previous declaration of\n'push_fail_stack' was here\n    compat/regex/regexec.c:1415: error: syntax error before \"set_regs\"\n    compat/regex/regexec.c:1417: warning: return type defaults to `int'\n    compat/regex/regexec.c:1417: error: conflicting types for 'set_regs'\n    compat/regex/regexec.c:73: error: previous declaration of\n'set_regs' was here\n    compat/regex/regexec.c:1417: error: conflicting types for 'set_regs'\n    compat/regex/regexec.c:73: error: previous declaration of\n'set_regs' was here\n    compat/regex/regexec.c:1669: error: syntax error before\n\"build_sifted_states\"\n    compat/regex/regexec.c:1671: warning: return type defaults to `int'\n    compat/regex/regexec.c:1671: error: conflicting types for\n'build_sifted_states'\n    compat/regex/regexec.c:89: error: previous declaration of\n'build_sifted_states' was here\n    compat/regex/regexec.c:1671: error: conflicting types for\n'build_sifted_states'\n    compat/regex/regexec.c:89: error: previous declaration of\n'build_sifted_states' was here\n    compat/regex/regexec.c: In function `merge_state_array':\n    compat/regex/regexec.c:1772: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: In function `update_cur_sifted_state':\n    compat/regex/regexec.c:1815: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:1831: error: syntax error before\n\"add_epsilon_src_nodes\"\n    compat/regex/regexec.c:1833: warning: return type defaults to `int'\n    compat/regex/regexec.c:1833: error: conflicting types for\n'add_epsilon_src_nodes'\n    compat/regex/regexec.c:98: error: previous declaration of\n'add_epsilon_src_nodes' was here\n    compat/regex/regexec.c:1833: error: conflicting types for\n'add_epsilon_src_nodes'\n    compat/regex/regexec.c:98: error: previous declaration of\n'add_epsilon_src_nodes' was here\n    compat/regex/regexec.c: In function `add_epsilon_src_nodes':\n    compat/regex/regexec.c:1837: warning: initialization makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:2144: error: syntax error before \"sift_states_bkref\"\n    compat/regex/regexec.c:2146: warning: return type defaults to `int'\n    compat/regex/regexec.c:2146: error: conflicting types for\n'sift_states_bkref'\n    compat/regex/regexec.c:120: error: previous declaration of\n'sift_states_bkref' was here\n    compat/regex/regexec.c:2146: error: conflicting types for\n'sift_states_bkref'\n    compat/regex/regexec.c:120: error: previous declaration of\n'sift_states_bkref' was here\n    compat/regex/regexec.c:2274: error: syntax error before \"transit_state\"\n    compat/regex/regexec.c:2276: warning: return type defaults to `int'\n    compat/regex/regexec.c:2276: error: conflicting types for 'transit_state'\n    compat/regex/regexec.c:129: error: previous declaration of\n'transit_state' was here\n    compat/regex/regexec.c:2276: error: conflicting types for 'transit_state'\n    compat/regex/regexec.c:129: error: previous declaration of\n'transit_state' was here\n    compat/regex/regexec.c: In function `transit_state':\n    compat/regex/regexec.c:2303: warning: return makes integer from\npointer without a cast\n    compat/regex/regexec.c:2314: warning: return makes integer from\npointer without a cast\n    compat/regex/regexec.c:2316: warning: return makes integer from\npointer without a cast\n    compat/regex/regexec.c: In function `merge_state_with_log':\n    compat/regex/regexec.c:2375: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: In function `transit_state_bkref':\n    compat/regex/regexec.c:2648: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c:2665: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:2699: error: syntax error before \"get_subexp\"\n    compat/regex/regexec.c:2700: warning: return type defaults to `int'\n    compat/regex/regexec.c:2700: error: conflicting types for 'get_subexp'\n    compat/regex/regexec.c:153: error: previous declaration of\n'get_subexp' was here\n    compat/regex/regexec.c:2700: error: conflicting types for 'get_subexp'\n    compat/regex/regexec.c:153: error: previous declaration of\n'get_subexp' was here\n    compat/regex/regexec.c:2899: error: syntax error before \"check_arrival\"\n    compat/regex/regexec.c:2901: warning: return type defaults to `int'\n    compat/regex/regexec.c:2901: error: conflicting types for 'check_arrival'\n    compat/regex/regexec.c:164: error: previous declaration of\n'check_arrival' was here\n    compat/regex/regexec.c:2901: error: conflicting types for 'check_arrival'\n    compat/regex/regexec.c:164: error: previous declaration of\n'check_arrival' was here\n    compat/regex/regexec.c: In function `check_arrival':\n    compat/regex/regexec.c:2974: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c:3025: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:3060: error: syntax error before\n\"check_arrival_add_next_nodes\"\n    compat/regex/regexec.c:3062: warning: return type defaults to `int'\n    compat/regex/regexec.c:3062: error: conflicting types for\n'check_arrival_add_next_nodes'\n    compat/regex/regexec.c:169: error: previous declaration of\n'check_arrival_add_next_nodes' was here\n    compat/regex/regexec.c:3062: error: conflicting types for\n'check_arrival_add_next_nodes'\n    compat/regex/regexec.c:169: error: previous declaration of\n'check_arrival_add_next_nodes' was here\n    compat/regex/regexec.c: In function `check_arrival_add_next_nodes':\n    compat/regex/regexec.c:3066: warning: unused variable `err'\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:3192: error: syntax error before\n\"check_arrival_expand_ecl_sub\"\n    compat/regex/regexec.c:3194: warning: return type defaults to `int'\n    compat/regex/regexec.c:3194: error: conflicting types for\n'check_arrival_expand_ecl_sub'\n    compat/regex/regexec.c:177: error: previous declaration of\n'check_arrival_expand_ecl_sub' was here\n    compat/regex/regexec.c:3194: error: conflicting types for\n'check_arrival_expand_ecl_sub'\n    compat/regex/regexec.c:177: error: previous declaration of\n'check_arrival_expand_ecl_sub' was here\n    compat/regex/regexec.c:3236: error: syntax error before \"expand_bkref_cache\"\n    compat/regex/regexec.c:3238: warning: return type defaults to `int'\n    compat/regex/regexec.c:3238: error: conflicting types for\n'expand_bkref_cache'\n    compat/regex/regexec.c:181: error: previous declaration of\n'expand_bkref_cache' was here\n    compat/regex/regexec.c:3238: error: conflicting types for\n'expand_bkref_cache'\n    compat/regex/regexec.c:181: error: previous declaration of\n'expand_bkref_cache' was here\n    compat/regex/regexec.c: In function `expand_bkref_cache':\n    compat/regex/regexec.c:3309: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: In function `build_trtable':\n    compat/regex/regexec.c:3434: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c:3442: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c:3450: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:4102: error: syntax error before \"extend_buffers\"\n    compat/regex/regexec.c:4103: warning: return type defaults to `int'\n    compat/regex/regexec.c:4103: error: conflicting types for 'extend_buffers'\n    compat/regex/regexec.c:202: error: previous declaration of\n'extend_buffers' was here\n    compat/regex/regexec.c:4103: error: conflicting types for 'extend_buffers'\n    compat/regex/regexec.c:202: error: previous declaration of\n'extend_buffers' was here\n    compat/regex/regexec.c:4165: error: syntax error before \"match_ctx_init\"\n    compat/regex/regexec.c:4166: warning: return type defaults to `int'\n    compat/regex/regexec.c:4166: error: conflicting types for 'match_ctx_init'\n    compat/regex/regexec.c:22: error: previous declaration of\n'match_ctx_init' was here\n    compat/regex/regexec.c:4166: error: conflicting types for 'match_ctx_init'\n    compat/regex/regexec.c:22: error: previous declaration of\n'match_ctx_init' was here\n    compat/regex/regexec.c:4238: error: syntax error before\n\"match_ctx_add_entry\"\n    compat/regex/regexec.c:4240: warning: return type defaults to `int'\n    compat/regex/regexec.c:4240: error: conflicting types for\n'match_ctx_add_entry'\n    compat/regex/regexec.c:27: error: previous declaration of\n'match_ctx_add_entry' was here\n    compat/regex/regexec.c:4240: error: conflicting types for\n'match_ctx_add_entry'\n    compat/regex/regexec.c:27: error: previous declaration of\n'match_ctx_add_entry' was here\n    compat/regex/regexec.c:4310: error: syntax error before\n\"match_ctx_add_subtop\"\n    compat/regex/regexec.c:4311: warning: return type defaults to `int'\n    compat/regex/regexec.c:4311: error: conflicting types for\n'match_ctx_add_subtop'\n    compat/regex/regexec.c:31: error: previous declaration of\n'match_ctx_add_subtop' was here\n    compat/regex/regexec.c:4311: error: conflicting types for\n'match_ctx_add_subtop'\n    compat/regex/regexec.c:31: error: previous declaration of\n'match_ctx_add_subtop' was here\n    compat/regex/regex_internal.h:392: warning:\n're_string_realloc_buffers' declared `static' but never defined\n    compat/regex/regex_internal.c:27: warning: 'create_ci_newstate'\ndeclared `static' but never defined\n    compat/regex/regex_internal.c:31: warning: 'create_cd_newstate'\ndeclared `static' but never defined\n    compat/regex/regexec.c:22: warning: 'match_ctx_init' declared\n`static' but never defined\n    compat/regex/regexec.c:27: warning: 'match_ctx_add_entry' declared\n`static' but never defined\n    compat/regex/regexec.c:31: warning: 'match_ctx_add_subtop'\ndeclared `static' but never defined\n    compat/regex/regexec.c:43: warning: 're_search_internal' declared\n`static' but never defined\n    compat/regex/regexec.c:56: warning: 'prune_impossible_nodes'\ndeclared `static' but never defined\n    compat/regex/regexec.c:58: warning: 'check_matching' declared\n`static' but never defined\n    compat/regex/regexec.c:69: warning: 'push_fail_stack' declared\n`static' but never defined\n    compat/regex/regexec.c:73: warning: 'set_regs' declared `static'\nbut never defined\n    compat/regex/regexec.c:89: warning: 'build_sifted_states' declared\n`static' but never defined\n    compat/regex/regexec.c:98: warning: 'add_epsilon_src_nodes'\ndeclared `static' but never defined\n    compat/regex/regexec.c:120: warning: 'sift_states_bkref' declared\n`static' but never defined\n    compat/regex/regexec.c:129: warning: 'transit_state' declared\n`static' but never defined\n    compat/regex/regexec.c:153: warning: 'get_subexp' declared\n`static' but never defined\n    compat/regex/regexec.c:164: warning: 'check_arrival' declared\n`static' but never defined\n    compat/regex/regexec.c:169: warning:\n'check_arrival_add_next_nodes' declared `static' but never defined\n    compat/regex/regexec.c:177: warning:\n'check_arrival_expand_ecl_sub' declared `static' but never defined\n    compat/regex/regexec.c:181: warning: 'expand_bkref_cache' declared\n`static' but never defined\n    compat/regex/regexec.c:202: warning: 'extend_buffers' declared\n`static' but never defined\n    gmake: *** [compat/regex/regex.o] Error 1\n\nAnd on FreeBSD:\n\n    In file included from git-compat-util.h:93,\n                     from cache.h:4,\n                     from thread-utils.c:1:\n    compat/regex/regex.h:367: warning: declaration does not declare anything\n        CC compat/memmem.o\n    In file included from compat/../git-compat-util.h:93,\n                     from compat/memmem.c:1:\n    compat/regex/regex.h:367: warning: declaration does not declare anything\n        CC compat/regex/regex.o\n    In file included from compat/regex/regex.c:63:\n    compat/regex/regex_internal.h:421:20: error: alloca.h: No such\nfile or directory\n    In file included from compat/regex/regex.c:73:\n    compat/regex/regex_internal.c:40: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_string_allocate'\n    compat/regex/regex_internal.c:68: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_string_construct'\n    compat/regex/regex_internal.c:131: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_string_realloc_buffers'\n    compat/regex/regex_internal.c:572: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_string_reconstruct'\n    compat/regex/regex_internal.c:962: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_node_set_alloc'\n    compat/regex/regex_internal.c:974: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_node_set_init_1'\n    compat/regex/regex_internal.c:990: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_node_set_init_2'\n    compat/regex/regex_internal.c:1020: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_node_set_init_copy'\n    compat/regex/regex_internal.c:1045: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_node_set_add_intersect'\n    compat/regex/regex_internal.c:1136: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_node_set_init_union'\n    compat/regex/regex_internal.c:1189: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_node_set_merge'\n    compat/regex/regex_internal.c:1272: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_node_set_insert'\n    compat/regex/regex_internal.c:1329: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_node_set_insert_last'\n    compat/regex/regex_internal.c: In function 're_dfa_add_node':\n    compat/regex/regex_internal.c:1406: warning: unused variable 'type'\n    compat/regex/regex_internal.c: At top level:\n    compat/regex/regex_internal.c:1472: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_acquire_state'\n    compat/regex/regex_internal.c:1516: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 're_acquire_state_context'\n    compat/regex/regex_internal.c:1553: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 'register_state'\n    compat/regex/regex_internal.c:1608: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 'create_ci_newstate'\n    compat/regex/regex_internal.c:1658: error: expected '=', ',', ';',\n'asm' or '__attribute__' before 'create_cd_newstate'\n    In file included from compat/regex/regex.c:74:\n    compat/regex/regcomp.c: In function 're_compile_internal':\n    compat/regex/regcomp.c:778: warning: implicit declaration of\nfunction 're_string_construct'\n    compat/regex/regcomp.c: In function 'create_initial_state':\n    compat/regex/regcomp.c:969: warning: implicit declaration of\nfunction 're_node_set_init_copy'\n    compat/regex/regcomp.c:1002: warning: implicit declaration of\nfunction 're_node_set_merge'\n    compat/regex/regcomp.c:1013: warning: implicit declaration of\nfunction 're_acquire_state_context'\n    compat/regex/regcomp.c:1013: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regcomp.c:1020: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regcomp.c:1022: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regcomp.c:1026: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regcomp.c: In function 'link_nfa_nodes':\n    compat/regex/regcomp.c:1408: warning: implicit declaration of\nfunction 're_node_set_init_2'\n    compat/regex/regcomp.c:1415: warning: implicit declaration of\nfunction 're_node_set_init_1'\n    compat/regex/regcomp.c: In function 'duplicate_node_closure':\n    compat/regex/regcomp.c:1459: warning: implicit declaration of\nfunction 're_node_set_insert'\n    compat/regex/regcomp.c: In function 'calc_inveclosure':\n    compat/regex/regcomp.c:1590: warning: implicit declaration of\nfunction 're_node_set_insert_last'\n    compat/regex/regcomp.c: In function 'calc_eclosure_iter':\n    compat/regex/regcomp.c:1653: warning: implicit declaration of\nfunction 're_node_set_alloc'\n    In file included from compat/regex/regex.c:75:\n    compat/regex/regexec.c: In function 'regexec':\n    compat/regex/regexec.c:230: warning: unused variable 'dfa'\n    compat/regex/regexec.c: In function 're_search_stub':\n    compat/regex/regexec.c:418: warning: unused variable 'dfa'\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:629: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 're_search_internal'\n    compat/regex/regexec.c:636: error: expected identifier or '('\nbefore '{' token\n    compat/regex/regexec.c:956: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'prune_impossible_nodes'\n    compat/regex/regexec.c:958: error: expected identifier or '('\nbefore '{' token\n    compat/regex/regexec.c: In function 'acquire_init_state_context':\n    compat/regex/regexec.c:1074: warning: return makes pointer from\ninteger without a cast\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:1095: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'check_matching'\n    compat/regex/regexec.c:1368: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'push_fail_stack'\n    compat/regex/regexec.c:1415: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'set_regs'\n    compat/regex/regexec.c:1669: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'build_sifted_states'\n    compat/regex/regexec.c: In function 'merge_state_array':\n    compat/regex/regexec.c:1768: warning: implicit declaration of\nfunction 're_node_set_init_union'\n    compat/regex/regexec.c:1772: warning: implicit declaration of\nfunction 're_acquire_state'\n    compat/regex/regexec.c:1772: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: In function 'update_cur_sifted_state':\n    compat/regex/regexec.c:1815: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:1831: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'add_epsilon_src_nodes'\n    compat/regex/regexec.c: In function 'sub_epsilon_src_nodes':\n    compat/regex/regexec.c:1884: warning: implicit declaration of\nfunction 're_node_set_add_intersect'\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:2144: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'sift_states_bkref'\n    compat/regex/regexec.c:2274: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'transit_state'\n    compat/regex/regexec.c: In function 'merge_state_with_log':\n    compat/regex/regexec.c:2375: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: In function 'transit_state_bkref':\n    compat/regex/regexec.c:2648: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c:2665: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:2699: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'get_subexp'\n    compat/regex/regexec.c:2899: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'check_arrival'\n    compat/regex/regexec.c:3060: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'check_arrival_add_next_nodes'\n    compat/regex/regexec.c:3192: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'check_arrival_expand_ecl_sub'\n    compat/regex/regexec.c:3236: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'expand_bkref_cache'\n    compat/regex/regexec.c: In function 'build_trtable':\n    compat/regex/regexec.c:3434: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c:3442: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c:3450: warning: assignment makes pointer\nfrom integer without a cast\n    compat/regex/regexec.c: At top level:\n    compat/regex/regexec.c:4102: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'extend_buffers'\n    compat/regex/regexec.c:4165: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'match_ctx_init'\n    compat/regex/regexec.c:4238: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'match_ctx_add_entry'\n    compat/regex/regexec.c:4310: error: expected '=', ',', ';', 'asm'\nor '__attribute__' before 'match_ctx_add_subtop'\n    gmake: *** [compat/regex/regex.o] Error 1\n"},{"id":"145691","messageId":"m2630fqzn1.fsf@igel.home","threadId":"24326","inReplyTo":"AANLkTimQZDT3PuiLDdjPXzWlLiEI5Iv1zy5iFPlRswyC@mail.gmail.com","subject":"Re: [RFC/PATCH] Update compat/regex","fromName":"Andreas Schwab","fromEmail":"schwab@linux-m68k.org","sentAt":"2010-07-16T14:17:54Z","receivedAt":"2010-07-16T14:17:54Z","isPatch":true,"sender":{"key":"schwab@linux-m68k.org","avatar":"https://avatars.githubusercontent.com/u/2175493?v=4"},"body":"Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n\n> This patch has all the glibc-specific stuff that makes it break hard\n> if you don't have the GNU C library. Writing macros/definitions to fix all that\n> stuff up was the \"easier said than done\" part I was referring to.\n\nYou might want to try out the gnulib version instead.\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":"145694","messageId":"AANLkTimZ3f550HQwx3OEpO6n1b037He6hJ6rAXP8vfIk@mail.gmail.com","threadId":"24326","inReplyTo":"AANLkTim-4I5Sdu653yJOmnVYDqI8bb71839Vqfd3FKCi@mail.gmail.com","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-07-16T14:33:55Z","receivedAt":"2010-07-16T14:33:55Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Thu, Jul 15, 2010 at 18:44, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n> On Thu, Jul 15, 2010 at 17:47, Junio C Hamano <gitster@pobox.com> wrote:\n>> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>>\n>>> On Thu, Jul 8, 2010 at 19:40, Junio C Hamano <gitster@pobox.com> wrote:\n>>>> Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:\n>>>>\n>>>>> +if git grep ile a\n>>>>> +then\n>>>>> +     test_expect_success 'git grep ile a' 'git grep ile a'\n>>>>> +else\n>>>>> +     test_expect_failure 'git grep ile a' 'git grep ile a'\n>>>>> +fi\n>>>>\n>>>> So if command \"X\" is known to succeed, we run it inside expect_success\n>>>> and if not we run it inside expect_failure?\n>>>>\n>>>> What kind of idiocy is that, I have to wonder...\n>>>\n>>> Well, the point is to normalize the test suite so that we never have\n>>> passing TODO tests if everything's OK.\n>>\n>> I do not consider a test that passes under some condition but doesn't\n>> under some other condition \"everything is OK\".  Marking the test as\n>> \"expect failure\" as René originally did makes a lot of sense to me.\n>>\n>> The quoted patch is even worse as it will _actively_ prevent you from\n>> catching a new error you just introduced while futzing \"git grep\" on a\n>> platform that used to work.  Your \"if\" statement will say \"ah, grep is\n>> broken\", and you will use expect-failure, not because your platform does\n>> not support REG_STARTEND, but because you broke \"git grep\".\n>>\n>> The point of having tests is to help you catch your bugs while you\n>> develop.  A test that turns itself off when the feature it is testing is\n>> broken helps nobody.\n>>\n>> So forget about \"passing TODO tests\", whatever a \"TODO test\" is.  The\n>> change in question is actively _wrong_.\n>\n> I was under the impression that REG_STARTEND was considered purely\n> icing on the cake, i.e. that the tests should be passing whether or\n> not it was present.\n>\n> I guess my reasoning at the time was that if that wasn't the case,\n> reporting an unexpected pass by default, as opposed to a failing TODO\n> on platforms without REG_STARTEND. Since only TAP will report this, I\n> thought that was just an omission.\n>\n> Anyway, since REG_STARTEND *isn't* obviously considered icing you're\n> of course right, but the test is still broken as-is. Now it reports an\n> abnormal condition if REG_STARTEND is present (passing TODO test), it\n> should instead have a failing TODO test where REG_STARTEND isn't\n> present. I'll come up with a patch to fix that.\n\nWell to clarify: The TAP is arguably right, although semantically\nthese sort of tests should probably be a SKIP on unsupported\nplatforms, not a passing TODO.\n\nprove(1) also features passing TODO tests a bit too prominently for my\ntastes. I've filed a bug for that:\nhttps://rt.cpan.org/Public/Bug/Display.html?id=59428\n\n> We should also just upgrade the GNU regex library in compat/regex to\n> the version that supports REG_STARTEND. Unfortunately that seems\n> easier said than done, since the library is now part of glibc, and has\n> aquired a lot of glibc specific macros and other constructs that would\n> need to be #defined away or otherwise worked around.\n\nThis is what we should be focusing on, the patch by Jonathan Nieder is\na good start.\n"},{"id":"145707","messageId":"20100716195007.GC16371@burratino","threadId":"24326","inReplyTo":"AANLkTimZ3f550HQwx3OEpO6n1b037He6hJ6rAXP8vfIk@mail.gmail.com","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-16T19:50:08Z","receivedAt":"2010-07-16T19:50:08Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> Well to clarify: The TAP is arguably right, although semantically\n> these sort of tests should probably be a SKIP on unsupported\n> platforms, not a passing TODO.\n\nNo, we support all platforms people are willing to fix without\nuglifying the code too much.  So a bug is a bug.  Test\nprerequisites get used for behavior that is either out of scope\n(Posix-style permissions on Windows) or hard to test (signal\ndelivery to child process in t7502-commit).\n\nThe semantic problem you are describing here is that we have no\nseparate way to mark bugs that are not consistently reproducible.\nA “fixed” test_expect_failure is sometimes a fluke, like in this\nexample.\n\nIf lucky, you can find an appropriate condition and use\ntest_expect_success or test_expect_failure as appropriate.  In\nthe general case, that is not always easy.  Better to eliminate the\nunreproducible bugs.\n\n> On Thu, Jul 15, 2010 at 18:44, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n\n>> We should also just upgrade the GNU regex library in compat/regex to\n>> the version that supports REG_STARTEND.\n[...]\n> This is what we should be focusing on\n\nBy the way, I have no preference for choice of regex library here.  If\nsomething else is easier to get working correctly, that would be great.\n"},{"id":"145710","messageId":"AANLkTikDwJaBN8Y0814m6JaVab9BAXPx_VKE7Z_Q6hq7@mail.gmail.com","threadId":"24326","inReplyTo":"20100716195007.GC16371@burratino","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-07-16T20:51:24Z","receivedAt":"2010-07-16T20:51:24Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Fri, Jul 16, 2010 at 19:50, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> Well to clarify: The TAP is arguably right, although semantically\n>> these sort of tests should probably be a SKIP on unsupported\n>> platforms, not a passing TODO.\n>\n> No, we support all platforms people are willing to fix without\n> uglifying the code too much.  So a bug is a bug.  Test\n> prerequisites get used for behavior that is either out of scope\n> (Posix-style permissions on Windows) or hard to test (signal\n> delivery to child process in t7502-commit).\n>\n> The semantic problem you are describing here is that we have no\n> separate way to mark bugs that are not consistently reproducible.\n> A “fixed” test_expect_failure is sometimes a fluke, like in this\n> example.\n>\n> If lucky, you can find an appropriate condition and use\n> test_expect_success or test_expect_failure as appropriate.  In\n> the general case, that is not always easy.  Better to eliminate the\n> unreproducible bugs.\n\nThe failure is totally predicated on whether or not REG_STARTEND is\navailable on the system, so in a perfect world (where we couldn't\nprovide a compat regex library) we should detect whether REG_STARTEND\nis defined in regex.h, and then stick it in GIT-BUILD-OPTIONS.\n\nThen you could do:\n\n    test_expect_success REG_STARTEND 'git grep ile a' '\n        git grep ile a\n    '\n\nBut it's much easier to just fix the replacement regex library so the\ntest works everywhere instead of detecting for REG_STARTEND\n(e.g. using a helper).\n\n>> On Thu, Jul 15, 2010 at 18:44, Ævar Arnfjörð Bjarmason <avarab@gmail.com> wrote:\n>\n>>> We should also just upgrade the GNU regex library in compat/regex to\n>>> the version that supports REG_STARTEND.\n> [...]\n>> This is what we should be focusing on\n>\n> By the way, I have no preference for choice of regex library here.  If\n> something else is easier to get working correctly, that would be great.\n\nThe glibc one is probably pretty good as far as minimal POSIX DFA\nengines go. Hopefully you can patch it up to get it to compile on\nnon-GNU systems.\n\nMore generally, the regex use in Git is something I've wanted to look\nat more closely. Right now a bunch of Git tools use regexes in one\nform or another, but they don't do so consistently:\n\n    config.c:847:\t\t  !regexec(store.value_regex, value, 0, NULL, 0)));\n    config.c:1155:\t\t\tif (regcomp(store.value_regex, value_regex,\n    builtin/remote.c:1432:\tif (regcomp(&old_regex, oldurl, REG_EXTENDED))\n    builtin/remote.c:1436:\t\tif (!regexec(&old_regex, urlset[i], 0, NULL, 0))\n    builtin/blame.c:1963:\tif (!(reg_error = regcomp(&regexp, spec + 1,\nREG_NEWLINE)) &&\n    builtin/blame.c:1964:\t    !(reg_error = regexec(&regexp, line, 1,\nmatch, 0))) {\n    builtin/config.c:104:\tif (use_key_regexp && regexec(key_regexp,\nkey_, 0, NULL, 0))\n    builtin/config.c:107:\t    (do_not_match ^ !!regexec(regexp,\n(value_?value_:\"\"), 0, NULL, 0)))\n    builtin/config.c:177:\t\tif (regcomp(key_regexp, key, REG_EXTENDED)) {\n    builtin/config.c:190:\t\tif (regcomp(regexp, regex_, REG_EXTENDED)) {\n    builtin/apply.c:579:\t\tif (regcomp(stamp, stamp_regexp, REG_EXTENDED)) {\n    builtin/apply.c:586:\tstatus = regexec(stamp, timestamp,\nARRAY_SIZE(m), m, 0);\n    sha1_name.c:703:\tif (regcomp(&regex, prefix, REG_EXTENDED))\n    sha1_name.c:729:\t\tif (!regexec(&regex, p + 2, 0, NULL, 0)) {\n    diff.c:779:\t\tif (!regexec(word_regex, buffer->ptr + *begin, 1, match, 0)) {\n    diff.c:2011:\t\t\t\tif (regcomp(ecbdata.diff_words->word_regex,\n    xdiff-interface.c:276:\t\tif (!regexec(&reg->re, line_buffer, 2, pmatch, 0)) {\n    xdiff-interface.c:323:\t\tif (regcomp(&reg->re, expression, cflags))\n    diffcore-pickaxe.c:29:\t\twhile (*data && !regexec(regexp, data, 1,\n&regmatch, flags)) {\n    diffcore-pickaxe.c:62:\t\terr = regcomp(&regex, needle, REG_EXTENDED\n| REG_NEWLINE);\n    grep.c:73:\terr = regcomp(&p->regexp, p->pattern, opt->regflags);\n    grep.c:375:\treturn regexec(preg, line, 1, match, eflags);\n    http-backend.c:567:\t\tif (regcomp(&re, c->pattern, REG_EXTENDED))\n    http-backend.c:569:\t\tif (!regexec(&re, dir, 1, out, 0)) {\n\nSome of these are supplying REG_EXTENDED, some (like git-grep) allow\nfor passing REG_ICASE, some don't.\n\nThere's no way to do e.g. do a case insensitive git blame -L'/start/',\nother than -L'/[sS][tT][aA][rR][tT]/' that is. It would be nice if we\ncould consistently pass regex flags, like -L'/start/i' in this\ncase. This also applies to features like the new ':/string' feature\nadded by Linus, maybe that should optionally be ':/string/i' (or\nwithin the scope of the current implementation, ':!i/string' or\n':!/string/i').\n\nRegarding regular expression implementations. We might want to look\ninto bundling one implementation and using it everywhere, but I\nhaven't tested that to see if there are significant wins to be had.\n\nThere are regex implementations (notably GNU awk and GNU grep) that\nare probably better fits for what Git does, a GNU grep backend for\ngit-log would probably search through revisions with a regex faster,\nbut I haven't tested it so I don't know if it's fast enough to bother\nwith it.\n\nUsing NFA engines like that also gives you some performance guarantees\n(see [1][2]). Although that mostly matters in pathological\nsituations. But having Git make that guarantee might be useful,\ne.g. so Gitweb can offer an interface to git-grep without having the\nCPU on the host burned up by a pattern like (a*|a*)*.\n\nThe NFA engines we could use to get those features include Google's\nRE2 (it's in C++, but we might fall back on e.g. the Plan9 engine),\nGNU awk/grep, TRE, and probably some others.\n\nBut maybe this isn't something that's wanted or needed. Does anyone\nelse want a more unified regex interface in Git, or a determanistic\nregex engine built-in?\n\n1. http://swtch.com/~rsc/regexp/regexp1.html\n2. http://stackoverflow.com/questions/1178173/regex-implementation-that-can-handle-machine-generated-regexs-non-backtracking\n"},{"id":"145712","messageId":"20100716210609.GA23044@burratino","threadId":"24326","inReplyTo":"AANLkTikDwJaBN8Y0814m6JaVab9BAXPx_VKE7Z_Q6hq7@mail.gmail.com","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-07-16T21:06:09Z","receivedAt":"2010-07-16T21:06:09Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> The failure is totally predicated on whether or not REG_STARTEND is\n> available on the system\n[...]\n> Then you could do:\n> \n>     test_expect_success REG_STARTEND 'git grep ile a' '\n>         git grep ile a\n>     '\n\nSorry to harp on this, but no, that would not be right.  When\nREG_STARTEND is not available on a system, this is still a bug and\nwe still want to know when it is fixed.  The test should not be\nskipped.\n\nSo one could do:\n\n if have_reg_startend\n then\n\texpectation=success\n else\n\texpectation=failure\n fi\n test_expect_$expectation 'git grep ile a' '\n\tgit grep ile a\n '\n\n> The glibc one is probably pretty good as far as minimal POSIX DFA\n> engines go. Hopefully you can patch it up to get it to compile on\n> non-GNU systems.\n\nNo promises, in particular because I don’t have any non-GNU\ninstallations handy to test on.  Probably gnulib’s copy will do,\nas Andreas suggested.\n\n> Regarding regular expression implementations. We might want to look\n> into bundling one implementation and using it everywhere\n\nPlease no. :)\n\nIf we can do better than glibc, then glibc should be improved (yes,\nI know GNU grep does much better than glibc already).\n\n> Using NFA engines like that also gives you some performance guarantees\n\nDo you mean “using DFA engines”?  i.e. I thought GNU grep avoids\nbacktracking by converting the NFA to a DFA, at least conceptually.\n\nThanks for the food for thought,\nJonathan\n"},{"id":"145714","messageId":"AANLkTim4iI-MMkSCEU6ln9wrlC_X1GvfMHM5Qij3P591@mail.gmail.com","threadId":"24326","inReplyTo":"20100716210609.GA23044@burratino","subject":"Re: [PATCH] grep: Don't pass a TODO test if REG_STARTEND is supported","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-07-16T21:19:40Z","receivedAt":"2010-07-16T21:19:40Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Fri, Jul 16, 2010 at 21:06, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> The failure is totally predicated on whether or not REG_STARTEND is\n>> available on the system\n> [...]\n>> Then you could do:\n>>\n>>     test_expect_success REG_STARTEND 'git grep ile a' '\n>>         git grep ile a\n>>     '\n>\n> Sorry to harp on this, but no, that would not be right.  When\n> REG_STARTEND is not available on a system, this is still a bug and\n> we still want to know when it is fixed.  The test should not be\n> skipped.\n>\n> So one could do:\n>\n>  if have_reg_startend\n>  then\n>        expectation=success\n>  else\n>        expectation=failure\n>  fi\n>  test_expect_$expectation 'git grep ile a' '\n>        git grep ile a\n>  '\n\nWell, the assumption I was making that we would do something in the\nmake or ./configure process to set NO_REGEX=YesPlease if we found that\nthe system didn't support REG_STARTEND, and fail loudly if that\nrequirenment wasn't met.\n\nHowever, what you posted above would be what we'd want if we wanted a\nsoft requirement. Maybe that's what we want, I don't know :)\n\n>> The glibc one is probably pretty good as far as minimal POSIX DFA\n>> engines go. Hopefully you can patch it up to get it to compile on\n>> non-GNU systems.\n>\n> No promises, in particular because I don’t have any non-GNU\n> installations handy to test on.  Probably gnulib’s copy will do,\n> as Andreas suggested.\n\nProbably, I didn't look closely at it.\n\n>> Regarding regular expression implementations. We might want to look\n>> into bundling one implementation and using it everywhere\n>\n> Please no. :)\n>\n> If we can do better than glibc, then glibc should be improved (yes,\n> I know GNU grep does much better than glibc already).\n\nI think engines like GNU grep get some of their speed by not\nsupporting some POSIX features. So it's not something you can\ncompletely solve at the libc level, since regcomp/regexec should only\nhave POSIX semantics.\n\nBut I should find out if we need this before we discuss this any\nfurther, if it's a big performance win when e.g. grep-ing through the\nentire history of Linux it might be worth it.\n\n>> Using NFA engines like that also gives you some performance guarantees\n>\n> Do you mean “using DFA engines”?  i.e. I thought GNU grep avoids\n> backtracking by converting the NFA to a DFA, at least conceptually.\n\nYes, I always mix up my NFA and DFA at this time of night. I should\njust start writing whatever I think I don't mean, and that'll be what\nI mean :)\n"},{"id":"148139","messageId":"AANLkTik4FL56EM4HdpfZ7ha8GNkbLsJeb415WFWUh+O_@mail.gmail.com","threadId":"24326","inReplyTo":"m2630fqzn1.fsf@igel.home","subject":"Re: [RFC/PATCH] Update compat/regex","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-15T11:08:01Z","receivedAt":"2010-08-15T11:08:01Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Fri, Jul 16, 2010 at 14:17, Andreas Schwab <schwab@linux-m68k.org> wrote:\n> Ævar Arnfjörð Bjarmason <avarab@gmail.com> writes:\n>\n>> This patch has all the glibc-specific stuff that makes it break hard\n>> if you don't have the GNU C library. Writing macros/definitions to fix all that\n>> stuff up was the \"easier said than done\" part I was referring to.\n>\n> You might want to try out the gnulib version instead.\n\nI fiddled a bit with gnulib for both the regex engine and libintl, but\nI can't get it to do what I want.\n\nThe assumption with gnulib seems to be that you're including the\nlibraries in a GNU program that only uses the autotools, it seems to\nbe about as easy to just copy/paste things from glibc if you're adding\nlibraries to a program like Git that uses its own build system.\n"},{"id":"148186","messageId":"4C692E8F.7090904@gnu.org","threadId":"24326","inReplyTo":"AANLkTik4FL56EM4HdpfZ7ha8GNkbLsJeb415WFWUh+O_@mail.gmail.com","subject":"Re: [RFC/PATCH] Update compat/regex","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2010-08-16T12:26:55Z","receivedAt":"2010-08-16T12:26:55Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"On 08/15/2010 01:08 PM, Ævar Arnfjörð Bjarmason wrote:\n> On Fri, Jul 16, 2010 at 14:17, Andreas Schwab<schwab@linux-m68k.org>  wrote:\n>> Ævar Arnfjörð Bjarmason<avarab@gmail.com>  writes:\n>>\n>>> This patch has all the glibc-specific stuff that makes it break hard\n>>> if you don't have the GNU C library. Writing macros/definitions to fix all that\n>>> stuff up was the \"easier said than done\" part I was referring to.\n>>\n>> You might want to try out the gnulib version instead.\n>\n> I fiddled a bit with gnulib for both the regex engine and libintl, but\n> I can't get it to do what I want.\n>\n> The assumption with gnulib seems to be that you're including the\n> libraries in a GNU program that only uses the autotools, it seems to\n> be about as easy to just copy/paste things from glibc if you're adding\n> libraries to a program like Git that uses its own build system.\n\nAndreas is right, the glibc code is not meant to be portable.\n\nIt is really simpler if you start from the version in gnulib, which is \nthe one that is included in most GNU packages nowadays.  You should \ndownload GNU grep 2.6.x and (starting from lib/reg*) add headers from \nits lib/ directory until it compiles.\n\nAlternatively try out gawk, as it does not use gnulib but has the same \nset of sanitizations.\n\nPaolo\n"},{"id":"148215","messageId":"1282015548-19074-1-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"AANLkTik4FL56EM4HdpfZ7ha8GNkbLsJeb415WFWUh+O_@mail.gmail.com","subject":"[PATCH/RFC 0/3] Update compat/regex","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T03:25:45Z","receivedAt":"2010-08-17T03:25:45Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Mon, Aug 16, 2010 at 12:26, Paolo Bonzini <bonzini@gnu.org> wrote:\n\n> Alternatively try out gawk, as it does not use gnulib but has the same set\n> of sanitizations.\n\nWhy didn't you say that earlier? :)\n\nHere's a RFC patch series that uses the gawk regex engine from the\ngawk-devel branch of gawk CVS.\n\nIt compiles on Linux/FreeBSD and Solaris, with only a single warning\non FreeBSD due to an unused variable (upstream bug).\n\nÆvar Arnfjörð Bjarmason (3):\n  compat/regex: use the regex engine from gawk for compat\n  compat/regex: hacks to get the gawk regex engine to compile within\n    git\n  t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND\n\n Makefile                      |    4 +\n compat/regex/COPYING          |  674 ++++++\n compat/regex/mbsupport.h      |   59 +\n compat/regex/regcomp.c        | 3892 ++++++++++++++++++++++++++++++++\n compat/regex/regex.c          | 5003 +----------------------------------------\n compat/regex/regex.h          |  462 +++--\n compat/regex/regex_internal.c | 1744 ++++++++++++++\n compat/regex/regex_internal.h |  810 +++++++\n compat/regex/regexec.c        | 4377 +++++++++++++++++++++++++++++++++++\n t/t7008-grep-binary.sh        |    2 +-\n 10 files changed, 11921 insertions(+), 5106 deletions(-)\n create mode 100644 compat/regex/COPYING\n create mode 100644 compat/regex/mbsupport.h\n create mode 100644 compat/regex/regcomp.c\n create mode 100644 compat/regex/regex_internal.c\n create mode 100644 compat/regex/regex_internal.h\n create mode 100644 compat/regex/regexec.c\n\n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148216","messageId":"1282015548-19074-3-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"AANLkTik4FL56EM4HdpfZ7ha8GNkbLsJeb415WFWUh+O_@mail.gmail.com","subject":"[PATCH/RFC 2/3] compat/regex: hacks to get the gawk regex engine to compile within git","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T03:25:47Z","receivedAt":"2010-08-17T03:25:47Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"The gawk regex engine didn't include stdio.h, and only include\nstddef.h if HAVE_STDDEF_H is set.\n\nAdding -DHAVE_STDDEF_H caused some internal errors in by /usr/include\nheaders, so change the regex.h code to include it unconditionally.\n\nWe also need to define -DGAWK so that e.g. \"bool\", \"MAX\" and other\nsimilar things used inside gawk get defined.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile             |    4 ++++\n compat/regex/regex.h |    7 +++++--\n 2 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex b4745a5..6704780 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1443,6 +1443,10 @@ ifdef UNRELIABLE_FSTAT\n \tBASIC_CFLAGS += -DUNRELIABLE_FSTAT\n endif\n ifdef NO_REGEX\n+\t# TODO: How do I compile just regex.o with this flag, not the\n+\t# whole of Git?\n+\tBASIC_CFLAGS += -DGAWK\n+\n \tCOMPAT_CFLAGS += -Icompat/regex\n \tCOMPAT_OBJS += compat/regex/regex.o\n endif\ndiff --git a/compat/regex/regex.h b/compat/regex/regex.h\nindex de93327..508bc80 100644\n--- a/compat/regex/regex.h\n+++ b/compat/regex/regex.h\n@@ -22,9 +22,12 @@\n #ifndef _REGEX_H\n #define _REGEX_H 1\n \n-#ifdef HAVE_STDDEF_H\n+#include <stdio.h>\n+/*\n+  Git: Was in `#ifdef HAVE_STDDEF_H` in gawk, adding -DHAVE_STDDEF_H makes a\n+  *lot* of other things break\n+*/\n #include <stddef.h>\n-#endif\n \n #ifdef HAVE_SYS_TYPES_H\n #include <sys/types.h>\n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148217","messageId":"1282015548-19074-4-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"AANLkTik4FL56EM4HdpfZ7ha8GNkbLsJeb415WFWUh+O_@mail.gmail.com","subject":"[PATCH/RFC 3/3] t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T03:25:48Z","receivedAt":"2010-08-17T03:25:48Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Now that we have a regex engine that supports REG_STARTEND this test\nshould fail if \"git grep\" can't grep NULL characters. Platforms that\ndon't have a POSIX regex engine that supports REG_STARTEND should\nalways define NO_REGEX=YesPlease when compiling.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t7008-grep-binary.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t7008-grep-binary.sh b/t/t7008-grep-binary.sh\nindex eb8ca88..c0f9f3f 100755\n--- a/t/t7008-grep-binary.sh\n+++ b/t/t7008-grep-binary.sh\n@@ -61,7 +61,7 @@ test_expect_success 'git grep -Fi iLE a' '\n \n # This test actually passes on platforms where regexec() supports the\n # flag REG_STARTEND.\n-test_expect_failure 'git grep ile a' '\n+test_expect_success 'git grep ile a' '\n \tgit grep ile a\n '\n \n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148218","messageId":"20100817033511.GA17840@burratino","threadId":"24326","inReplyTo":"1282015548-19074-3-git-send-email-avarab@gmail.com","subject":"Re: [PATCH/RFC 2/3] compat/regex: hacks to get the gawk regex engine to compile within git","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-17T03:35:11Z","receivedAt":"2010-08-17T03:35:11Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Hi!\n\nÆvar Arnfjörð Bjarmason wrote:\n\n> +\t# TODO: How do I compile just regex.o with this flag, not the\n> +\t# whole of Git?\n> +\tBASIC_CFLAGS += -DGAWK\n\n gawk.o: EXTRA_CPPFLAGS = -DGAWK\n\nSee v1.7.1-rc0~60 and v1.7.0-rc0~90^2~2.\n\n> --- a/compat/regex/regex.h\n> +++ b/compat/regex/regex.h\n> @@ -22,9 +22,12 @@\n>  #ifndef _REGEX_H\n>  #define _REGEX_H 1\n>  \n> -#ifdef HAVE_STDDEF_H\n> +#include <stdio.h>\n> +/*\n> +  Git: Was in `#ifdef HAVE_STDDEF_H` in gawk, adding -DHAVE_STDDEF_H makes a\n> +  *lot* of other things break\n> +*/\n>  #include <stddef.h>\n> -#endif\n\nMaybe\n\n #if 1\n #include \"git-compat-util.h\"\n #else\n ...\n\nwould be simpler.\n"},{"id":"148219","messageId":"20100817033701.GB17840@burratino","threadId":"24326","inReplyTo":"1282015548-19074-2-git-send-email-avarab@gmail.com","subject":"Re: [PATCH/RFC 1/3] compat/regex: use the regex engine from gawk for compat","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-17T03:37:01Z","receivedAt":"2010-08-17T03:37:01Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> +++ b/compat/regex/mbsupport.h\n> @@ -0,0 +1,59 @@\n> +/*\n> + * mbsupport.h --- Localize determination of whether we have multibyte stuff.\n> + */\n> +\n> +/* \n> + * Copyright (C) 2004, 2005 the Free Software Foundation, Inc.\n> + * \n> + * This file is part of GAWK, the GNU implementation of the\n> + * AWK Programming Language.\n> + * \n> + * GAWK is free software; you can redistribute it and/or modify\n> + * it under the terms of the GNU General Public License as published by\n> + * the Free Software Foundation; either version 3 of the License, or\n> + * (at your option) any later version.\n\nWorrisome.  (Most of git is still GPL-2 only, which would not be\ncompatible.)\n"},{"id":"148221","messageId":"AANLkTikKB6dLF9RVPt7s9KyVdafvOY-i3z+VCMbEwF=m@mail.gmail.com","threadId":"24326","inReplyTo":"20100817033701.GB17840@burratino","subject":"Re: [PATCH/RFC 1/3] compat/regex: use the regex engine from gawk for compat","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T03:50:58Z","receivedAt":"2010-08-17T03:50:58Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"On Tue, Aug 17, 2010 at 03:37, Jonathan Nieder <jrnieder@gmail.com> wrote:\n> Ævar Arnfjörð Bjarmason wrote:\n>\n>> +++ b/compat/regex/mbsupport.h\n>> @@ -0,0 +1,59 @@\n>> +/*\n>> + * mbsupport.h --- Localize determination of whether we have multibyte stuff.\n>> + */\n>> +\n>> +/*\n>> + * Copyright (C) 2004, 2005 the Free Software Foundation, Inc.\n>> + *\n>> + * This file is part of GAWK, the GNU implementation of the\n>> + * AWK Programming Language.\n>> + *\n>> + * GAWK is free software; you can redistribute it and/or modify\n>> + * it under the terms of the GNU General Public License as published by\n>> + * the Free Software Foundation; either version 3 of the License, or\n>> + * (at your option) any later version.\n>\n> Worrisome.  (Most of git is still GPL-2 only, which would not be\n> compatible.)\n\nActually it's LGPL-2.1 (all the copyright headers in the *.[ch] files\nagree), I just copied the wrong license.\n"},{"id":"148222","messageId":"20100817040840.GC17840@burratino","threadId":"24326","inReplyTo":"AANLkTikKB6dLF9RVPt7s9KyVdafvOY-i3z+VCMbEwF=m@mail.gmail.com","subject":"Re: [PATCH/RFC 1/3] compat/regex: use the regex engine from gawk for compat","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-17T04:08:40Z","receivedAt":"2010-08-17T04:08:40Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n> On Tue, Aug 17, 2010 at 03:37, Jonathan Nieder <jrnieder@gmail.com> wrote:\n>> Ævar Arnfjörð Bjarmason wrote:\n\n>>> +++ b/compat/regex/mbsupport.h\n>>> @@ -0,0 +1,59 @@\n>>> +/*\n>>> + * mbsupport.h --- Localize determination of whether we have multibyte stuff.\n>>> + */\n>>> +\n>>> +/*\n>>> + * Copyright (C) 2004, 2005 the Free Software Foundation, Inc.\n>>> + *\n>>> + * This file is part of GAWK, the GNU implementation of the\n>>> + * AWK Programming Language.\n>>> + *\n>>> + * GAWK is free software; you can redistribute it and/or modify\n>>> + * it under the terms of the GNU General Public License as published by\n>>> + * the Free Software Foundation; either version 3 of the License, or\n>>> + * (at your option) any later version.\n>>\n>> Worrisome.  (Most of git is still GPL-2 only, which would not be\n>> compatible.)\n>\n> Actually it's LGPL-2.1 (all the copyright headers in the *.[ch] files\n> agree), I just copied the wrong license.\n\nThanks for checking.  That’s good to hear.\n"},{"id":"148225","messageId":"1282022233-32692-1-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"AANLkTik4FL56EM4HdpfZ7ha8GNkbLsJeb415WFWUh+O_@mail.gmail.com","subject":"[PATCH/RFC v2 0/3] Update compat/regex","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T05:17:10Z","receivedAt":"2010-08-17T05:17:10Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"This has the following changes:\n\n * Supply the custom regex.o flags only to regex.o as suggested by\n   Jonathan Nieder:\n        \n        +ifdef NO_REGEX\n        +compat/regex/regex.o: EXTRA_CPPFLAGS = -DGAWK -DNO_MBSUPPORT\n        +endif\n\n * The code is LGPL-2.1, not GPL-3\n\n * Don't include mbsupport.h, we don't need it, and it can be\n   un-included with a flag.\n\n * Simplify our modifications to regex.h, just include two headers at\n   the very top, don't modify any gawk code.\n\n * Update commit messages\n        \nÆvar Arnfjörð Bjarmason (3):\n  compat/regex: use the regex engine from gawk for compat\n  compat/regex: get the gawk regex engine to compile within git\n  t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND\n\n Makefile                      |    4 +\n compat/regex/regcomp.c        | 3892 ++++++++++++++++++++++++++++++++\n compat/regex/regex.c          | 5003 +----------------------------------------\n compat/regex/regex.h          |  462 +++--\n compat/regex/regex_internal.c | 1744 ++++++++++++++\n compat/regex/regex_internal.h |  810 +++++++\n compat/regex/regexec.c        | 4377 +++++++++++++++++++++++++++++++++++\n t/t7008-grep-binary.sh        |    2 +-\n 8 files changed, 11188 insertions(+), 5106 deletions(-)\n create mode 100644 compat/regex/regcomp.c\n create mode 100644 compat/regex/regex_internal.c\n create mode 100644 compat/regex/regex_internal.h\n create mode 100644 compat/regex/regexec.c\n\n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148226","messageId":"1282022233-32692-3-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"AANLkTik4FL56EM4HdpfZ7ha8GNkbLsJeb415WFWUh+O_@mail.gmail.com","subject":"[PATCH/RFC v2 2/3] compat/regex: get the gawk regex engine to compile within git","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T05:17:12Z","receivedAt":"2010-08-17T05:17:12Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"We need to define -DGAWK -DNO_MBSUPPORT so that the gawk regex engine\nwill compile, and include stdio.h and stddef.h in regex.h. Gawk itself\nincludes these headers before it includes the regex.h header.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n Makefile             |    4 ++++\n compat/regex/regex.h |    3 +++\n 2 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex b4745a5..23a9f0d 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1879,6 +1879,10 @@ ifdef NO_EXPAT\n http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT\n endif\n \n+ifdef NO_REGEX\n+compat/regex/regex.o: EXTRA_CPPFLAGS = -DGAWK -DNO_MBSUPPORT\n+endif\n+\n git-%$X: %.o $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n \ndiff --git a/compat/regex/regex.h b/compat/regex/regex.h\nindex de93327..61c9683 100644\n--- a/compat/regex/regex.h\n+++ b/compat/regex/regex.h\n@@ -1,3 +1,6 @@\n+#include <stdio.h>\n+#include <stddef.h>\n+\n /* Definitions for data structures and routines for the regular\n    expression library.\n    Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005,2006,2008\n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148227","messageId":"1282022233-32692-4-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"AANLkTik4FL56EM4HdpfZ7ha8GNkbLsJeb415WFWUh+O_@mail.gmail.com","subject":"[PATCH/RFC v2 3/3] t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T05:17:13Z","receivedAt":"2010-08-17T05:17:13Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Now that we have a regex engine that supports REG_STARTEND this test\nshould fail if \"git grep\" can't grep NULL characters.\n\nPlatforms that don't have a POSIX regex engine which supports\nREG_STARTEND should always define NO_REGEX=YesPlease when compiling.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n t/t7008-grep-binary.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t7008-grep-binary.sh b/t/t7008-grep-binary.sh\nindex eb8ca88..c0f9f3f 100755\n--- a/t/t7008-grep-binary.sh\n+++ b/t/t7008-grep-binary.sh\n@@ -61,7 +61,7 @@ test_expect_success 'git grep -Fi iLE a' '\n \n # This test actually passes on platforms where regexec() supports the\n # flag REG_STARTEND.\n-test_expect_failure 'git grep ile a' '\n+test_expect_success 'git grep ile a' '\n \tgit grep ile a\n '\n \n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148260","messageId":"20100817080322.GA28476@burratino","threadId":"24326","inReplyTo":"1282022233-32692-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH/RFC v2 0/3] Update compat/regex","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-17T08:03:22Z","receivedAt":"2010-08-17T08:03:22Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Ævar Arnfjörð Bjarmason wrote:\n\n> Ævar Arnfjörð Bjarmason (3):\n>   compat/regex: use the regex engine from gawk for compat\n>   compat/regex: get the gawk regex engine to compile within git\n>   t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND\n\nFor what it’s worth:\n\nAcked-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks.  Here’s a patch to go on top.  I am not sure what platforms\nsupport REG_STARTEND, but we can always update the makefile as reports\ncome in.\n\n-- 8< --\nSubject: autoconf: don't use platform regex if it lacks REG_STARTEND\n\nIf the platform regex cannot match null bytes, we might as well\nuse the glibc version instead.\n\nCc: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\nCc: René Scharfe <rene.scharfe@lsrfire.ath.cx>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n config.mak.in |    1 +\n configure.ac  |   21 +++++++++++++++++++++\n 2 files changed, 22 insertions(+), 0 deletions(-)\n\ndiff --git a/config.mak.in b/config.mak.in\nindex b4e65c3..67dbd3b 100644\n--- a/config.mak.in\n+++ b/config.mak.in\n@@ -58,6 +58,7 @@ NO_INET_NTOP=@NO_INET_NTOP@\n NO_INET_PTON=@NO_INET_PTON@\n NO_ICONV=@NO_ICONV@\n OLD_ICONV=@OLD_ICONV@\n+NO_REGEX=@NO_REGEX@\n NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@\n INLINE=@INLINE@\n SOCKLEN_T=@SOCKLEN_T@\ndiff --git a/configure.ac b/configure.ac\nindex 5601e8b..71ac89f 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -706,6 +706,27 @@ else\n fi\n AC_SUBST(NO_C99_FORMAT)\n #\n+# Define NO_REGEX if you have no or inferior regex support in your C library.\n+AC_CACHE_CHECK([whether the platform regex can handle null bytes],\n+ [ac_cv_c_excellent_regex], [\n+AC_EGREP_CPP(yippeeyeswehaveit,\n+\tAC_LANG_PROGRAM([AC_INCLUDES_DEFAULT\n+#include <regex.h>\n+],\n+[#ifdef REG_STARTEND\n+yippeeyeswehaveit\n+#endif\n+]),\n+\t[ac_cv_c_excellent_regex=yes],\n+\t[ac_cv_c_excellent_regex=yes])\n+])\n+if test $ac_cv_c_excellent_regex = yes; then\n+\tNO_REGEX=\n+else\n+\tNO_REGEX=YesPlease\n+fi\n+AC_SUBST(NO_REGEX)\n+#\n # Define FREAD_READS_DIRECTORIES if your are on a system which succeeds\n # when attempting to read from an fopen'ed directory.\n AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],\n-- \n1.7.2.1.544.ga752d.dirty\n"},{"id":"148265","messageId":"1282037082-12996-1-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"20100817080322.GA28476@burratino","subject":"[PATCH 0/5] Update compat/regex","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T09:24:37Z","receivedAt":"2010-08-17T09:24:37Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Here's a (hopefully) final version of this series. Changes since the\nv2 RFC:\n\n * Re-apply Frank Li's regerror() patch already in Git as\n   v1.6.5-rc2~23. There was no need to apply another msvc fix,\n   v1.7.0-rc0~15, because it had already been fixed upstream.\n\n * Include Jonathan Nieder's autoconf patch and add his Acked-by to\n   the rest, add my Tested-by to his.\n\n * Fix text alignment in one of the commit messages.\n\nNote: This patch is intentionally diff --check unclean so we don't\ndiverge from upstream. This series can also be pulled from\nhttp://github.com/avar/git/tree/update-fallback-regex-engine-v3 if the\nwhitespace causes issues with git-am.\n\nFrank Li (1):\n  Change regerror() declaration from K&R style to ANSI C (C89)\n\nJonathan Nieder (1):\n  autoconf: don't use platform regex if it lacks REG_STARTEND\n\nÆvar Arnfjörð Bjarmason (3):\n  compat/regex: use the regex engine from gawk for compat\n  compat/regex: get the gawk regex engine to compile within git\n  t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND\n\n Makefile                      |    4 +\n compat/regex/regcomp.c        | 3889 ++++++++++++++++++++++++++++++++\n compat/regex/regex.c          | 5003 +----------------------------------------\n compat/regex/regex.h          |  462 +++--\n compat/regex/regex_internal.c | 1744 ++++++++++++++\n compat/regex/regex_internal.h |  810 +++++++\n compat/regex/regexec.c        | 4377 +++++++++++++++++++++++++++++++++++\n config.mak.in                 |    1 +\n configure.ac                  |   21 +\n t/t7008-grep-binary.sh        |    2 +-\n 10 files changed, 11207 insertions(+), 5106 deletions(-)\n create mode 100644 compat/regex/regcomp.c\n create mode 100644 compat/regex/regex_internal.c\n create mode 100644 compat/regex/regex_internal.h\n create mode 100644 compat/regex/regexec.c\n\n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148268","messageId":"1282037082-12996-3-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"20100817080322.GA28476@burratino","subject":"[PATCH 2/5] compat/regex: get the gawk regex engine to compile within git","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T09:24:39Z","receivedAt":"2010-08-17T09:24:39Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"We need to define -DGAWK -DNO_MBSUPPORT so that the gawk regex engine\nwill compile, and include stdio.h and stddef.h in regex.h. Gawk itself\nincludes these headers before it includes the regex.h header.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\nAcked-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n Makefile             |    4 ++++\n compat/regex/regex.h |    3 +++\n 2 files changed, 7 insertions(+), 0 deletions(-)\n\ndiff --git a/Makefile b/Makefile\nindex b4745a5..23a9f0d 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -1879,6 +1879,10 @@ ifdef NO_EXPAT\n http-walker.s http-walker.o: EXTRA_CPPFLAGS = -DNO_EXPAT\n endif\n \n+ifdef NO_REGEX\n+compat/regex/regex.o: EXTRA_CPPFLAGS = -DGAWK -DNO_MBSUPPORT\n+endif\n+\n git-%$X: %.o $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ $(ALL_LDFLAGS) $(filter %.o,$^) $(LIBS)\n \ndiff --git a/compat/regex/regex.h b/compat/regex/regex.h\nindex de93327..61c9683 100644\n--- a/compat/regex/regex.h\n+++ b/compat/regex/regex.h\n@@ -1,3 +1,6 @@\n+#include <stdio.h>\n+#include <stddef.h>\n+\n /* Definitions for data structures and routines for the regular\n    expression library.\n    Copyright (C) 1985,1989-93,1995-98,2000,2001,2002,2003,2005,2006,2008\n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148267","messageId":"1282037082-12996-4-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"20100817080322.GA28476@burratino","subject":"[PATCH 3/5] Change regerror() declaration from K&R style to ANSI C (C89)","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T09:24:40Z","receivedAt":"2010-08-17T09:24:40Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Frank Li <lznuaa@gmail.com>\n\nThe MSVC headers typedef errcode as int, and thus confused the compiler in\nthe K&R style definition. ANSI style deconfuses it.\n\nThis patch was originally applied as v1.6.5-rc2~23 but needs to be\nre-applied since compat/regex was overwritten by Ævar Arnfjörð\nBjarmason with the gawk regex engine.\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\nAcked-by: Johannes Sixt <j6t@kdbg.org>\nSigned-off-by: Junio C Hamano <gitster@pobox.com>\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n compat/regex/regcomp.c |    7 ++-----\n 1 files changed, 2 insertions(+), 5 deletions(-)\n\ndiff --git a/compat/regex/regcomp.c b/compat/regex/regcomp.c\nindex 5115d7a..647c22a 100644\n--- a/compat/regex/regcomp.c\n+++ b/compat/regex/regcomp.c\n@@ -546,11 +546,8 @@ weak_alias (__regcomp, regcomp)\n    from either regcomp or regexec.   We don't use PREG here.  */\n \n size_t\n-regerror (errcode, preg, errbuf, errbuf_size)\n-    int errcode;\n-    const regex_t *__restrict preg;\n-    char *__restrict errbuf;\n-    size_t errbuf_size;\n+regerror(int errcode, const regex_t *__restrict preg,\n+         char *__restrict errbuf, size_t errbuf_size)\n {\n   const char *msg;\n   size_t msg_size;\n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148266","messageId":"1282037082-12996-5-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"20100817080322.GA28476@burratino","subject":"[PATCH 4/5] t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T09:24:41Z","receivedAt":"2010-08-17T09:24:41Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"Now that we have a regex engine that supports REG_STARTEND this test\nshould fail if \"git grep\" can't grep NULL characters.\n\nPlatforms that don't have a POSIX regex engine which supports\nREG_STARTEND should always define NO_REGEX=YesPlease when compiling.\n\nSigned-off-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\nAcked-by: Jonathan Nieder <jrnieder@gmail.com>\n---\n t/t7008-grep-binary.sh |    2 +-\n 1 files changed, 1 insertions(+), 1 deletions(-)\n\ndiff --git a/t/t7008-grep-binary.sh b/t/t7008-grep-binary.sh\nindex eb8ca88..c0f9f3f 100755\n--- a/t/t7008-grep-binary.sh\n+++ b/t/t7008-grep-binary.sh\n@@ -61,7 +61,7 @@ test_expect_success 'git grep -Fi iLE a' '\n \n # This test actually passes on platforms where regexec() supports the\n # flag REG_STARTEND.\n-test_expect_failure 'git grep ile a' '\n+test_expect_success 'git grep ile a' '\n \tgit grep ile a\n '\n \n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148269","messageId":"1282037082-12996-6-git-send-email-avarab@gmail.com","threadId":"24326","inReplyTo":"20100817080322.GA28476@burratino","subject":"[PATCH 5/5] autoconf: don't use platform regex if it lacks REG_STARTEND","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-17T09:24:42Z","receivedAt":"2010-08-17T09:24:42Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"From: Jonathan Nieder <jrnieder@gmail.com>\n\nIf the platform regex cannot match null bytes, we might as well\nuse the glibc version instead.\n\nCc: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\nCc: René Scharfe <rene.scharfe@lsrfire.ath.cx>\nSigned-off-by: Jonathan Nieder <jrnieder@gmail.com>\nTested-by: Ævar Arnfjörð Bjarmason <avarab@gmail.com>\n---\n config.mak.in |    1 +\n configure.ac  |   21 +++++++++++++++++++++\n 2 files changed, 22 insertions(+), 0 deletions(-)\n\ndiff --git a/config.mak.in b/config.mak.in\nindex b4e65c3..67dbd3b 100644\n--- a/config.mak.in\n+++ b/config.mak.in\n@@ -58,6 +58,7 @@ NO_INET_NTOP=@NO_INET_NTOP@\n NO_INET_PTON=@NO_INET_PTON@\n NO_ICONV=@NO_ICONV@\n OLD_ICONV=@OLD_ICONV@\n+NO_REGEX=@NO_REGEX@\n NO_DEFLATE_BOUND=@NO_DEFLATE_BOUND@\n INLINE=@INLINE@\n SOCKLEN_T=@SOCKLEN_T@\ndiff --git a/configure.ac b/configure.ac\nindex 5601e8b..71ac89f 100644\n--- a/configure.ac\n+++ b/configure.ac\n@@ -706,6 +706,27 @@ else\n fi\n AC_SUBST(NO_C99_FORMAT)\n #\n+# Define NO_REGEX if you have no or inferior regex support in your C library.\n+AC_CACHE_CHECK([whether the platform regex can handle null bytes],\n+ [ac_cv_c_excellent_regex], [\n+AC_EGREP_CPP(yippeeyeswehaveit,\n+\tAC_LANG_PROGRAM([AC_INCLUDES_DEFAULT\n+#include <regex.h>\n+],\n+[#ifdef REG_STARTEND\n+yippeeyeswehaveit\n+#endif\n+]),\n+\t[ac_cv_c_excellent_regex=yes],\n+\t[ac_cv_c_excellent_regex=yes])\n+])\n+if test $ac_cv_c_excellent_regex = yes; then\n+\tNO_REGEX=\n+else\n+\tNO_REGEX=YesPlease\n+fi\n+AC_SUBST(NO_REGEX)\n+#\n # Define FREAD_READS_DIRECTORIES if your are on a system which succeeds\n # when attempting to read from an fopen'ed directory.\n AC_CACHE_CHECK([whether system succeeds to read fopen'ed directory],\n-- \n1.7.2.1.389.gc3d0b\n"},{"id":"148274","messageId":"4C6A76AC.4000704@gnu.org","threadId":"24326","inReplyTo":"1282037082-12996-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH 0/5] Update compat/regex","fromName":"Paolo Bonzini","fromEmail":"bonzini@gnu.org","sentAt":"2010-08-17T11:46:52Z","receivedAt":"2010-08-17T11:46:52Z","isPatch":true,"sender":{"key":"bonzini@gnu.org","avatar":"https://avatars.githubusercontent.com/u/42082?v=4"},"body":"On 08/17/2010 11:24 AM, Ævar Arnfjörð Bjarmason wrote:\n>    compat/regex: use the regex engine from gawk for compat\n>    compat/regex: get the gawk regex engine to compile within git\n\nShould these two be squashed to ensure bisectability over a wide range \nof host systems?\n\nPaolo\n"},{"id":"148315","messageId":"7vzkwkaktr.fsf@alter.siamese.dyndns.org","threadId":"24326","inReplyTo":"1282037082-12996-1-git-send-email-avarab@gmail.com","subject":"Re: [PATCH 0/5] Update compat/regex","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2010-08-17T23:19:44Z","receivedAt":"2010-08-17T23:19:44Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Hmm, is there [1/5] in the series?\n"},{"id":"148325","messageId":"20100817235016.GL2221@burratino","threadId":"24326","inReplyTo":"7vzkwkaktr.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 0/5] Update compat/regex","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2010-08-17T23:50:16Z","receivedAt":"2010-08-17T23:50:16Z","isPatch":true,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Junio C Hamano wrote:\n\n> Hmm, is there [1/5] in the series?\n\nYes, but it probably missed the list because of vger's message length\nlimits.\n\nFor convenience, here is the series.  I also think the first two\npatches should be combined, but this does not do so because others\nmight disagree.  Patch 5 (autoconf) is the v2 version.\n\nThe following changes since commit 452c6d506b1a6dcf24d4ceaa592afc39c1c1a60e:\n\n  push: mention \"git pull\" in error message for non-fast forwards (2010-08-12 18:06:07 -0700)\n\nare available in the git repository at:\n  git://repo.or.cz/git/jrn.git ab/compat-regex\n\nFrank Li (1):\n      Change regerror() declaration from K&R style to ANSI C (C89)\n\nJonathan Nieder (1):\n      autoconf: don't use platform regex if it lacks REG_STARTEND\n\nÆvar Arnfjörð Bjarmason (3):\n      compat/regex: use the regex engine from gawk for compat\n      compat/regex: get the gawk regex engine to compile within git\n      t/t7008-grep-binary.sh: un-TODO a test that needs REG_STARTEND\n\n Makefile                      |    4 +\n compat/regex/regcomp.c        | 3889 ++++++++++++++++++++++++++++++++\n compat/regex/regex.c          | 5003 +----------------------------------------\n compat/regex/regex.h          |  462 +++--\n compat/regex/regex_internal.c | 1744 ++++++++++++++\n compat/regex/regex_internal.h |  810 +++++++\n compat/regex/regexec.c        | 4377 +++++++++++++++++++++++++++++++++++\n config.mak.in                 |    1 +\n configure.ac                  |   21 +\n t/t7008-grep-binary.sh        |    2 +-\n 10 files changed, 11207 insertions(+), 5106 deletions(-)\n create mode 100644 compat/regex/regcomp.c\n create mode 100644 compat/regex/regex_internal.c\n create mode 100644 compat/regex/regex_internal.h\n create mode 100644 compat/regex/regexec.c\n"},{"id":"148355","messageId":"AANLkTin6ojQzrPDh0EGVQUGvxtX3OP58nokEUpXw5pEQ@mail.gmail.com","threadId":"24326","inReplyTo":"20100817235016.GL2221@burratino","subject":"Re: [PATCH 0/5] Update compat/regex","fromName":"Ævar Arnfjörð Bjarmason","fromEmail":"avarab@gmail.com","sentAt":"2010-08-18T10:41:09Z","receivedAt":"2010-08-18T10:41:09Z","isPatch":true,"sender":{"key":"avarab@gmail.com","avatar":"https://avatars.githubusercontent.com/u/45301?v=4"},"body":"2010/8/17 Jonathan Nieder <jrnieder@gmail.com>:\n> Junio C Hamano wrote:\n>\n>> Hmm, is there [1/5] in the series?\n>\n> Yes, but it probably missed the list because of vger's message length\n> limits.\n>\n> For convenience, here is the series.  I also think the first two\n> patches should be combined, but this does not do so because others\n> might disagree.  Patch 5 (autoconf) is the v2 version.\n\nPedantic: If there's going to be squashing that should probably\ninclude the regerror change too, otherwise it can't be bisected on\nMSVC either.\n\nPersonally I think nothing should be squashed, because the history of\nhaving 1 commit be the unaltered gawk library and the rest being the\nchanges we need on top of it will help future developers when we need\nto update the regex library again.\n\nAnd since most people hacking git probably do so on GNU or the BSD's\nwhich don't need NO_REGEX=YesPlease the practical downside of doing so\nis *very* little.\n"}]}