{"thread":{"id":"61506","subject":"[PATCH] Switch grep from non-portable BRE to portable ERE","startedAt":"2024-05-17T17:10:23Z","lastAt":"2024-05-17T19:02:44Z","messageCount":4,"participants":["Marcel Telka","Junio C Hamano"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"494987","messageId":"ZkePejx-eRNrspZ2@telcontar","threadId":"61506","inReplyTo":null,"subject":"[PATCH] Switch grep from non-portable BRE to portable ERE","fromName":"Marcel Telka","fromEmail":"marcel@telka.sk","sentAt":"2024-05-17T17:10:18Z","receivedAt":"2024-05-17T17:10:23Z","isPatch":true,"sender":{"key":"marcel@telka.sk","avatar":"https://avatars.githubusercontent.com/u/3000173?v=4"},"body":"This makes the grep usage fully POSIX compliant.\n\nSigned-off-by: Marcel Telka <marcel@telka.sk>\n---\n mergetools/vimdiff           | 2 +-\n t/t1404-update-ref-errors.sh | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/mergetools/vimdiff b/mergetools/vimdiff\nindex 734d15a03b..f8ad6b35d4 100644\n--- a/mergetools/vimdiff\n+++ b/mergetools/vimdiff\n@@ -325,7 +325,7 @@ gen_cmd () {\n \t\tfi\n \n \t\t# If this is a single window diff with all the buffers\n-\t\tif ! echo \"$tab\" | grep \",\\|/\" >/dev/null\n+\t\tif ! echo \"$tab\" | grep -E \",|/\" >/dev/null\n \t\tthen\n \t\t\tCMD=\"$CMD | silent execute 'bufdo diffthis'\"\n \t\tfi\ndiff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh\nindex 98e9158bd2..67ebd81a4c 100755\n--- a/t/t1404-update-ref-errors.sh\n+++ b/t/t1404-update-ref-errors.sh\n@@ -100,7 +100,7 @@ df_test() {\n \t\tprintf \"%s\\n\" \"delete $delname\" \"create $addname $D\"\n \tfi >commands &&\n \ttest_must_fail git update-ref --stdin <commands 2>output.err &&\n-\tgrep \"fatal:\\( cannot lock ref $SQ$addname$SQ:\\)\\? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ\" output.err &&\n+\tgrep -E \"fatal:( cannot lock ref $SQ$addname$SQ:)? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ\" output.err &&\n \tprintf \"%s\\n\" \"$C $delref\" >expected-refs &&\n \tgit for-each-ref --format=\"%(objectname) %(refname)\" $prefix/r >actual-refs &&\n \ttest_cmp expected-refs actual-refs\n"},{"id":"494994","messageId":"xmqq7cfsiaff.fsf@gitster.g","threadId":"61506","inReplyTo":"ZkePejx-eRNrspZ2@telcontar","subject":"Re: [PATCH] Switch grep from non-portable BRE to portable ERE","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2024-05-17T18:02:28Z","receivedAt":"2024-05-17T18:02:30Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marcel Telka <marcel@telka.sk> writes:\n\n> Subject: Re: [PATCH] Switch grep from non-portable BRE to portable ERE\n>\n> This makes the grep usage fully POSIX compliant.\n\nMay want to mention that using backslash to invoke ERE feature in\nBRE is a GNU extension?\n\nThanks for this and other portability patches.  You are porting to a\nnew platform, I presume, where either nobody else ported to before\nor those who ported did not bother reporting test breakages to us?\n\n> Signed-off-by: Marcel Telka <marcel@telka.sk>\n> ---\n>  mergetools/vimdiff           | 2 +-\n>  t/t1404-update-ref-errors.sh | 2 +-\n>  2 files changed, 2 insertions(+), 2 deletions(-)\n>\n> diff --git a/mergetools/vimdiff b/mergetools/vimdiff\n> index 734d15a03b..f8ad6b35d4 100644\n> --- a/mergetools/vimdiff\n> +++ b/mergetools/vimdiff\n> @@ -325,7 +325,7 @@ gen_cmd () {\n>  \t\tfi\n>  \n>  \t\t# If this is a single window diff with all the buffers\n> -\t\tif ! echo \"$tab\" | grep \",\\|/\" >/dev/null\n> +\t\tif ! echo \"$tab\" | grep -E \",|/\" >/dev/null\n>  \t\tthen\n>  \t\t\tCMD=\"$CMD | silent execute 'bufdo diffthis'\"\n>  \t\tfi\n> diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh\n> index 98e9158bd2..67ebd81a4c 100755\n> --- a/t/t1404-update-ref-errors.sh\n> +++ b/t/t1404-update-ref-errors.sh\n> @@ -100,7 +100,7 @@ df_test() {\n>  \t\tprintf \"%s\\n\" \"delete $delname\" \"create $addname $D\"\n>  \tfi >commands &&\n>  \ttest_must_fail git update-ref --stdin <commands 2>output.err &&\n> -\tgrep \"fatal:\\( cannot lock ref $SQ$addname$SQ:\\)\\? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ\" output.err &&\n> +\tgrep -E \"fatal:( cannot lock ref $SQ$addname$SQ:)? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ\" output.err &&\n>  \tprintf \"%s\\n\" \"$C $delref\" >expected-refs &&\n>  \tgit for-each-ref --format=\"%(objectname) %(refname)\" $prefix/r >actual-refs &&\n>  \ttest_cmp expected-refs actual-refs\n"},{"id":"494995","messageId":"Zkem21e_kdVfZsVV@telcontar","threadId":"61506","inReplyTo":"xmqq7cfsiaff.fsf@gitster.g","subject":"Re: [PATCH] Switch grep from non-portable BRE to portable ERE","fromName":"Marcel Telka","fromEmail":"marcel@telka.sk","sentAt":"2024-05-17T18:50:03Z","receivedAt":"2024-05-17T18:50:06Z","isPatch":true,"sender":{"key":"marcel@telka.sk","avatar":"https://avatars.githubusercontent.com/u/3000173?v=4"},"body":"On Fri, May 17, 2024 at 11:02:28AM -0700, Junio C Hamano wrote:\n> Thanks for this and other portability patches.  You are porting to a\n> new platform, I presume, where either nobody else ported to before\n> or those who ported did not bother reporting test breakages to us?\n\nUnfortunately, the latter is the case.  I'm doing this for OpenIndiana\n(an illumos distro, Solaris descendant) and the testing status before I\nstarted the work was:\n\nfailed test(s): t0211 t0600 t1404 t1700 t2501 t3404 t4150 t4202 t7609 t9001 t9118 t9210 t9902\n\nfixed   1\nsuccess 29241\nfailed  38\nbroken  269\ntotal   30158\n\n\nNow all tests pass.\n\nThe work uncovered few bugs in illumos as well.  For example, this one\nhelped to find issues with grep's null RE cases in git tests:\nhttps://www.illumos.org/issues/16561\n\n\nThank you.\n\n-- \n+-------------------------------------------+\n| Marcel Telka   e-mail:   marcel@telka.sk  |\n|                homepage: http://telka.sk/ |\n+-------------------------------------------+\n"},{"id":"494997","messageId":"Zkep0JWyh_7KlTy4@telcontar","threadId":"61506","inReplyTo":"xmqq7cfsiaff.fsf@gitster.g","subject":"Re: [PATCH] Switch grep from non-portable BRE to portable ERE","fromName":"Marcel Telka","fromEmail":"marcel@telka.sk","sentAt":"2024-05-17T19:02:40Z","receivedAt":"2024-05-17T19:02:44Z","isPatch":true,"sender":{"key":"marcel@telka.sk","avatar":"https://avatars.githubusercontent.com/u/3000173?v=4"},"body":"On Fri, May 17, 2024 at 11:02:28AM -0700, Junio C Hamano wrote:\n> Marcel Telka <marcel@telka.sk> writes:\n> > Subject: Re: [PATCH] Switch grep from non-portable BRE to portable ERE\n> >\n> > This makes the grep usage fully POSIX compliant.\n> \n> May want to mention that using backslash to invoke ERE feature in\n> BRE is a GNU extension?\n\nv2 is flying...\n\n-- \n+-------------------------------------------+\n| Marcel Telka   e-mail:   marcel@telka.sk  |\n|                homepage: http://telka.sk/ |\n+-------------------------------------------+\n"}]}