{"thread":{"id":"58479","subject":"[PATCH v2 0/4] allow \"grep -E\", remove {e,f}grep usage","startedAt":"2022-09-21T13:02:58Z","lastAt":"2022-09-21T18:07:07Z","messageCount":6,"participants":["Đoàn Trần Công Danh","Junio C Hamano"],"isPatch":true,"patchVersion":2,"patchTotal":4},"messages":[{"id":"463362","messageId":"cover.1663765176.git.congdanhqx@gmail.com","threadId":"58479","inReplyTo":null,"subject":"[PATCH v2 0/4] allow \"grep -E\", remove {e,f}grep usage","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2022-09-21T13:02:28Z","receivedAt":"2022-09-21T13:02:58Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Our CodingGuidelines says that we should avoid \"grep -E\" and/or \n\"grep \\{m,n\\}\". However they're still in use and noone has\ncomplained, yet.\n\nIn addition, GNU grep 3.8 started to warn about the continuation\nof deprecation process for egrep and fgrep.\n\nThis series aim to allow \"grep -E\" and replace {e,f}grep usage with\n\"grep -{E,F}\"\n\nWhile there're idea to lift the restriction for \\{m,n\\}, too.\nTheir usage are limited and could be replaced with other alternatives.\nLet's skip them for now.\n\nChange from v1:\n- Change wording in 2/4\n- Change regex in 2/4 to be more readable\n- Remove '-F' from some regex in 4/4 when the regex doesn't have any special\n  characters\n\nĐoàn Trần Công Danh (4):\n  CodingGuidelines: allow grep -E\n  t: remove \\{m,n\\} from BRE grep usage\n  t: convert egrep usage to \"grep -E\"\n  t: convert fgrep usage to \"grep -F\"\n\n Documentation/CodingGuidelines       |  2 --\n t/perf/run                           |  4 ++--\n t/t1304-default-acl.sh               |  4 ++--\n t/t3200-branch.sh                    |  4 ++--\n t/t3305-notes-fanout.sh              |  2 +-\n t/t3404-rebase-interactive.sh        |  6 +++---\n t/t3700-add.sh                       |  2 +-\n t/t3702-add-edit.sh                  |  2 +-\n t/t4014-format-patch.sh              |  8 ++++----\n t/t5320-delta-islands.sh             |  2 +-\n t/t5550-http-fetch-dumb.sh           |  2 +-\n t/t5702-protocol-v2.sh               |  2 +-\n t/t7003-filter-branch.sh             |  4 ++--\n t/t7527-builtin-fsmonitor.sh         | 18 +++++++++---------\n t/t7701-repack-unpack-unreachable.sh |  4 ++--\n t/t9001-send-email.sh                |  8 ++++----\n t/t9133-git-svn-nested-git-repo.sh   |  6 +++---\n t/t9134-git-svn-ignore-paths.sh      |  8 ++++----\n t/t9140-git-svn-reset.sh             |  4 ++--\n t/t9147-git-svn-include-paths.sh     |  8 ++++----\n t/t9814-git-p4-rename.sh             |  2 +-\n t/t9815-git-p4-submit-fail.sh        |  4 ++--\n t/test-lib-functions.sh              |  2 +-\n 23 files changed, 53 insertions(+), 55 deletions(-)\n\nRange-diff against v1:\n1:  a8dadaf2d1 = 1:  4ad1ac9d9b CodingGuidelines: allow grep -E\n2:  9d5fcda278 ! 2:  ebaf6cec07 t: remove \\{m,n\\} from BRE grep usage\n    @@ Metadata\n      ## Commit message ##\n         t: remove \\{m,n\\} from BRE grep usage\n     \n    -    \\{m,n\\} is a GNU extension to BRE, and it's forbidden by our\n    -    CodingGuidelines.\n    +    The CodingGuidelines says we should avoid \\{m,n\\} in BRE usage.\n    +    And their usages in our code base is limited, and subjectively\n    +    hard to read.\n     \n    -    Change to fixed strings or ERE.\n    +    Replace them with ERE.\n    +\n    +    Except for \"0\\{40\\}\" which would be changed to \"$ZERO_OID\",\n    +    which is a better value for testing with:\n    +    GIT_TEST_DEFAULT_HASH=sha256\n     \n         Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n     \n    @@ t/t3200-branch.sh: test_expect_success 'git branch -M baz bam should succeed whe\n      \tmsg=\"Branch: renamed refs/heads/baz to refs/heads/bam\" &&\n     -\tgrep \" 0\\{40\\}.*$msg$\" .git/logs/HEAD &&\n     -\tgrep \"^0\\{40\\}.*$msg$\" .git/logs/HEAD\n    -+\tzero=\"00000000\" &&\n    -+\tzero=\"$zero$zero$zero$zero$zero\" &&\n    -+\tgrep \" $zero.*$msg$\" .git/logs/HEAD &&\n    -+\tgrep \"^$zero.*$msg$\" .git/logs/HEAD\n    ++\tgrep \" $ZERO_OID.*$msg$\" .git/logs/HEAD &&\n    ++\tgrep \"^$ZERO_OID.*$msg$\" .git/logs/HEAD\n      '\n      \n      test_expect_success 'git branch -M should leave orphaned HEAD alone' '\n    @@ t/t3305-notes-fanout.sh: path_has_fanout() {\n      \tfanout=$2 &&\n      \tafter_last_slash=$(($(test_oid hexsz) - $fanout * 2)) &&\n     -\techo $path | grep -q \"^\\([0-9a-f]\\{2\\}/\\)\\{$fanout\\}[0-9a-f]\\{$after_last_slash\\}$\"\n    -+\techo $path | grep -q -E \"^([0-9a-f][0-9a-f]/){$fanout}[0-9a-f]{$after_last_slash}$\"\n    ++\techo $path | grep -q -E \"^([0-9a-f]{2}/){$fanout}[0-9a-f]{$after_last_slash}$\"\n      }\n      \n      touched_one_note_with_fanout() {\n3:  a131160033 = 3:  b7c0629603 t: convert egrep usage to \"grep -E\"\n4:  50d009b368 ! 4:  b65a3d7749 t: convert fgrep usage to \"grep -F\"\n    @@ t/t7003-filter-branch.sh: test_expect_success 'result is really identical' '\n      \t(git config core.bare true && cd .git &&\n      \t git filter-branch branch > filter-output 2>&1 &&\n     -\t! fgrep fatal filter-output)\n    -+\t! grep -F fatal filter-output)\n    ++\t! grep fatal filter-output)\n      '\n      git config core.bare false\n      test_expect_success 'result is really identical' '\n    @@ t/t7003-filter-branch.sh: test_expect_success 'rewrite repository including refs\n      \tgit reset --hard HEAD &&\n      \tgit filter-branch -f -- --all >filter-output 2>&1 &&\n     -\t! fgrep fatal filter-output\n    -+\t! grep -F fatal filter-output\n    ++\t! grep fatal filter-output\n      '\n      \n      test_expect_success 'filter-branch handles ref deletion' '\n    @@ t/t9134-git-svn-ignore-paths.sh: test_expect_success 'init+fetch an SVN reposito\n      \t(\n      \t    cd g &&\n     -\t    git config --get svn-remote.svn.ignore-paths | fgrep \"www\"\n    -+\t    git config --get svn-remote.svn.ignore-paths | grep -F \"www\"\n    ++\t    git config --get svn-remote.svn.ignore-paths | grep www\n      \t)\n      '\n      \n    @@ t/t9134-git-svn-ignore-paths.sh: test_expect_success 'SVN-side change outside of\n      \t\tsvn_cmd commit -m \"SVN-side change outside of www\" &&\n      \t\tsvn_cmd up &&\n     -\t\tsvn_cmd log -v | fgrep \"SVN-side change outside of www\"\n    -+\t\tsvn_cmd log -v | grep -F \"SVN-side change outside of www\"\n    ++\t\tsvn_cmd log -v | grep \"SVN-side change outside of www\"\n      \t)\n      '\n      \n    @@ t/t9134-git-svn-ignore-paths.sh: test_expect_success 'SVN-side change in and out\n      \t\tsvn_cmd commit -m \"SVN-side change in and out of ignored www\" &&\n      \t\tsvn_cmd up &&\n     -\t\tsvn_cmd log -v | fgrep \"SVN-side change in and out of ignored www\"\n    -+\t\tsvn_cmd log -v | grep -F \"SVN-side change in and out of ignored www\"\n    ++\t\tsvn_cmd log -v | grep \"SVN-side change in and out of ignored www\"\n      \t)\n      '\n      \n    @@ t/t9140-git-svn-reset.sh: test_expect_success 'fetch fails on modified hidden fi\n      \t  test_must_fail git svn fetch 2> ../errors &&\n      \t  git svn find-rev refs/remotes/git-svn > ../expect2 ) &&\n     -\tfgrep \"not found in commit\" errors &&\n    -+\tgrep -F \"not found in commit\" errors &&\n    ++\tgrep \"not found in commit\" errors &&\n      \ttest_cmp expect expect2\n      '\n      \n    @@ t/t9140-git-svn-reset.sh: test_expect_success 'refetch succeeds not ignoring any\n      \t  git svn fetch &&\n      \t  git svn rebase &&\n     -\t  fgrep \"mod hidden\" hid/hid.txt\n    -+\t  grep -F \"mod hidden\" hid/hid.txt\n    ++\t  grep \"mod hidden\" hid/hid.txt\n      \t)\n      '\n      \n    @@ t/t9147-git-svn-include-paths.sh: test_expect_success 'init+fetch an SVN reposit\n      \t(\n      \t    cd g &&\n     -\t    git config --get svn-remote.svn.include-paths | fgrep \"qqq\"\n    -+\t    git config --get svn-remote.svn.include-paths | grep -F \"qqq\"\n    ++\t    git config --get svn-remote.svn.include-paths | grep qqq\n      \t)\n      '\n      \n    @@ t/t9147-git-svn-include-paths.sh: test_expect_success 'SVN-side change outside o\n      \t\tsvn_cmd commit -m \"SVN-side change outside of www\" &&\n      \t\tsvn_cmd up &&\n     -\t\tsvn_cmd log -v | fgrep \"SVN-side change outside of www\"\n    -+\t\tsvn_cmd log -v | grep -F \"SVN-side change outside of www\"\n    ++\t\tsvn_cmd log -v | grep \"SVN-side change outside of www\"\n      \t)\n      '\n      \n    @@ t/t9147-git-svn-include-paths.sh: test_expect_success 'SVN-side change inside of\n      \t\tsvn_cmd commit -m \"SVN-side change inside of www/test_www.txt\" &&\n      \t\tsvn_cmd up &&\n     -\t\tsvn_cmd log -v | fgrep \"SVN-side change inside of www/test_www.txt\"\n    -+\t\tsvn_cmd log -v | grep -F \"SVN-side change inside of www/test_www.txt\"\n    ++\t\tsvn_cmd log -v | grep \"SVN-side change inside of www/test_www.txt\"\n      \t)\n      '\n      \n    @@ t/t9147-git-svn-include-paths.sh: test_expect_success 'SVN-side change in and ou\n      \t\tsvn_cmd commit -m \"SVN-side change in and out of ignored www\" &&\n      \t\tsvn_cmd up &&\n     -\t\tsvn_cmd log -v | fgrep \"SVN-side change in and out of ignored www\"\n    -+\t\tsvn_cmd log -v | grep -F \"SVN-side change in and out of ignored www\"\n    ++\t\tsvn_cmd log -v | grep \"SVN-side change in and out of ignored www\"\n      \t)\n      '\n      \n-- \n2.38.0.rc0\n\n"},{"id":"463363","messageId":"4ad1ac9d9b25f2fc5a2ada28cae0413c04b07e21.1663765176.git.congdanhqx@gmail.com","threadId":"58479","inReplyTo":"cover.1663765176.git.congdanhqx@gmail.com","subject":"[PATCH v2 1/4] CodingGuidelines: allow grep -E","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2022-09-21T13:02:29Z","receivedAt":"2022-09-21T13:03:06Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Despite forbidden by CodingGuidelines, our usage of 'grep -E' has been\nincreased over the years, and noone has come and complained.\n\nLet's lift the restriction.\n\nSigned-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n Documentation/CodingGuidelines | 2 --\n 1 file changed, 2 deletions(-)\n\ndiff --git a/Documentation/CodingGuidelines b/Documentation/CodingGuidelines\nindex 9fca21cc5f..cb7a367ea0 100644\n--- a/Documentation/CodingGuidelines\n+++ b/Documentation/CodingGuidelines\n@@ -162,8 +162,6 @@ For shell scripts specifically (not exhaustive):\n \n    - We do not use \\{m,n\\};\n \n-   - We do not use -E;\n-\n    - We do not use ? or + (which are \\{0,1\\} and \\{1,\\}\n      respectively in BRE) but that goes without saying as these\n      are ERE elements not BRE (note that \\? and \\+ are not even part\n-- \n2.38.0.rc0\n\n"},{"id":"463364","messageId":"ebaf6cec07e3a07c969c456e93aa9d4464f75548.1663765176.git.congdanhqx@gmail.com","threadId":"58479","inReplyTo":"cover.1663765176.git.congdanhqx@gmail.com","subject":"[PATCH v2 2/4] t: remove \\{m,n\\} from BRE grep usage","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2022-09-21T13:02:30Z","receivedAt":"2022-09-21T13:03:07Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"The CodingGuidelines says we should avoid \\{m,n\\} in BRE usage.\nAnd their usages in our code base is limited, and subjectively\nhard to read.\n\nReplace them with ERE.\n\nExcept for \"0\\{40\\}\" which would be changed to \"$ZERO_OID\",\nwhich is a better value for testing with:\nGIT_TEST_DEFAULT_HASH=sha256\n\nSigned-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n\n Phillip Wood said:\n > \\{m,n\\} is valid in a posix BRE[1]. If we're already using it without\n > anyone\n > complaining I think it would be better to update CodingGuidlines to allow\n > it.\n\n Yes, I agree. However, I think our usage of \\{m,n\\} is limited.\n Let's skip the lifting for now.\n\n t/t3200-branch.sh             | 4 ++--\n t/t3305-notes-fanout.sh       | 2 +-\n t/t3404-rebase-interactive.sh | 6 +++---\n t/t5550-http-fetch-dumb.sh    | 2 +-\n t/t5702-protocol-v2.sh        | 2 +-\n 5 files changed, 8 insertions(+), 8 deletions(-)\n\ndiff --git a/t/t3200-branch.sh b/t/t3200-branch.sh\nindex 9723c2827c..b82cffc0b3 100755\n--- a/t/t3200-branch.sh\n+++ b/t/t3200-branch.sh\n@@ -201,8 +201,8 @@ test_expect_success 'git branch -M baz bam should succeed when baz is checked ou\n \n test_expect_success 'git branch -M baz bam should add entries to .git/logs/HEAD' '\n \tmsg=\"Branch: renamed refs/heads/baz to refs/heads/bam\" &&\n-\tgrep \" 0\\{40\\}.*$msg$\" .git/logs/HEAD &&\n-\tgrep \"^0\\{40\\}.*$msg$\" .git/logs/HEAD\n+\tgrep \" $ZERO_OID.*$msg$\" .git/logs/HEAD &&\n+\tgrep \"^$ZERO_OID.*$msg$\" .git/logs/HEAD\n '\n \n test_expect_success 'git branch -M should leave orphaned HEAD alone' '\ndiff --git a/t/t3305-notes-fanout.sh b/t/t3305-notes-fanout.sh\nindex 22ffe5bcb9..1ec1fb6715 100755\n--- a/t/t3305-notes-fanout.sh\n+++ b/t/t3305-notes-fanout.sh\n@@ -9,7 +9,7 @@ path_has_fanout() {\n \tpath=$1 &&\n \tfanout=$2 &&\n \tafter_last_slash=$(($(test_oid hexsz) - $fanout * 2)) &&\n-\techo $path | grep -q \"^\\([0-9a-f]\\{2\\}/\\)\\{$fanout\\}[0-9a-f]\\{$after_last_slash\\}$\"\n+\techo $path | grep -q -E \"^([0-9a-f]{2}/){$fanout}[0-9a-f]{$after_last_slash}$\"\n }\n \n touched_one_note_with_fanout() {\ndiff --git a/t/t3404-rebase-interactive.sh b/t/t3404-rebase-interactive.sh\nindex 688b01e3eb..4f5abb5ad2 100755\n--- a/t/t3404-rebase-interactive.sh\n+++ b/t/t3404-rebase-interactive.sh\n@@ -1244,9 +1244,9 @@ test_expect_success 'short commit ID collide' '\n \t\ttest $colliding_id = \"$(git rev-parse HEAD | cut -c 1-4)\" &&\n \t\tgrep \"^pick $colliding_id \" \\\n \t\t\t.git/rebase-merge/git-rebase-todo.tmp &&\n-\t\tgrep \"^pick [0-9a-f]\\{$hexsz\\}\" \\\n+\t\tgrep -E \"^pick [0-9a-f]{$hexsz}\" \\\n \t\t\t.git/rebase-merge/git-rebase-todo &&\n-\t\tgrep \"^pick [0-9a-f]\\{$hexsz\\}\" \\\n+\t\tgrep -E \"^pick [0-9a-f]{$hexsz}\" \\\n \t\t\t.git/rebase-merge/git-rebase-todo.backup &&\n \t\tgit rebase --continue\n \t) &&\n@@ -1261,7 +1261,7 @@ test_expect_success 'respect core.abbrev' '\n \t\tset_cat_todo_editor &&\n \t\ttest_must_fail git rebase -i HEAD~4 >todo-list\n \t) &&\n-\ttest 4 = $(grep -c \"pick [0-9a-f]\\{12,\\}\" todo-list)\n+\ttest 4 = $(grep -c -E \"pick [0-9a-f]{12,}\" todo-list)\n '\n \n test_expect_success 'todo count' '\ndiff --git a/t/t5550-http-fetch-dumb.sh b/t/t5550-http-fetch-dumb.sh\nindex d7cf85ffea..8f182a3cbf 100755\n--- a/t/t5550-http-fetch-dumb.sh\n+++ b/t/t5550-http-fetch-dumb.sh\n@@ -234,7 +234,7 @@ test_expect_success 'http-fetch --packfile' '\n \t\t--index-pack-arg=--keep \\\n \t\t\"$HTTPD_URL\"/dumb/repo_pack.git/$p >out &&\n \n-\tgrep \"^keep.[0-9a-f]\\{16,\\}$\" out &&\n+\tgrep -E \"^keep.[0-9a-f]{16,}$\" out &&\n \tcut -c6- out >packhash &&\n \n \t# Ensure that the expected files are generated\ndiff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh\nindex 5d42a355a8..b33cd4afca 100755\n--- a/t/t5702-protocol-v2.sh\n+++ b/t/t5702-protocol-v2.sh\n@@ -1001,7 +1001,7 @@ test_expect_success 'part of packfile response provided as URI' '\n \tdo\n \t\tgit verify-pack --object-format=$(test_oid algo) --verbose $idx >out &&\n \t\t{\n-\t\t\tgrep \"^[0-9a-f]\\{16,\\} \" out || :\n+\t\t\tgrep -E \"^[0-9a-f]{16,} \" out || :\n \t\t} >out.objectlist &&\n \t\tif test_line_count = 1 out.objectlist\n \t\tthen\n-- \n2.38.0.rc0\n\n"},{"id":"463365","messageId":"b7c062960335d337ddce9be50d57aae1db03ca81.1663765176.git.congdanhqx@gmail.com","threadId":"58479","inReplyTo":"cover.1663765176.git.congdanhqx@gmail.com","subject":"[PATCH v2 3/4] t: convert egrep usage to \"grep -E\"","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2022-09-21T13:02:31Z","receivedAt":"2022-09-21T13:03:15Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Despite POSIX states that:\n\n> The old egrep and fgrep commands are likely to be supported for many\n> years to come as implementation extensions, allowing historical\n> applications to operate unmodified.\n\nGNU grep 3.8 started to warn[1]:\n\n> The egrep and fgrep commands, which have been deprecated since\n> release 2.5.3 (2007), now warn that they are obsolescent and should\n> be replaced by grep -E and grep -F.\n\nPrepare for their removal in the future.\n\n[1]: https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00001.html\n\nSigned-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n t/perf/run                           |  4 ++--\n t/t1304-default-acl.sh               |  4 ++--\n t/t3702-add-edit.sh                  |  2 +-\n t/t4014-format-patch.sh              |  8 ++++----\n t/t5320-delta-islands.sh             |  2 +-\n t/t7527-builtin-fsmonitor.sh         | 18 +++++++++---------\n t/t7701-repack-unpack-unreachable.sh |  4 ++--\n t/t9001-send-email.sh                |  8 ++++----\n t/t9814-git-p4-rename.sh             |  2 +-\n t/t9815-git-p4-submit-fail.sh        |  4 ++--\n t/test-lib-functions.sh              |  2 +-\n 11 files changed, 29 insertions(+), 29 deletions(-)\n\ndiff --git a/t/perf/run b/t/perf/run\nindex 33da4d2aba..34115edec3 100755\n--- a/t/perf/run\n+++ b/t/perf/run\n@@ -232,10 +232,10 @@ then\n \t)\n elif test -n \"$GIT_PERF_SUBSECTION\"\n then\n-\tegrep \"^$GIT_PERF_SUBSECTION\\$\" \"$TEST_RESULTS_DIR\"/run_subsections.names >/dev/null ||\n+\tgrep -E \"^$GIT_PERF_SUBSECTION\\$\" \"$TEST_RESULTS_DIR\"/run_subsections.names >/dev/null ||\n \t\tdie \"subsection '$GIT_PERF_SUBSECTION' not found in '$GIT_PERF_CONFIG_FILE'\"\n \n-\tegrep \"^$GIT_PERF_SUBSECTION\\$\" \"$TEST_RESULTS_DIR\"/run_subsections.names | while read -r subsec\n+\tgrep -E \"^$GIT_PERF_SUBSECTION\\$\" \"$TEST_RESULTS_DIR\"/run_subsections.names | while read -r subsec\n \tdo\n \t\t(\n \t\t\tGIT_PERF_SUBSECTION=\"$subsec\"\ndiff --git a/t/t1304-default-acl.sh b/t/t1304-default-acl.sh\nindex 335d3f3211..c69ae41306 100755\n--- a/t/t1304-default-acl.sh\n+++ b/t/t1304-default-acl.sh\n@@ -18,7 +18,7 @@ test_expect_success 'checking for a working acl setup' '\n \tif setfacl -m d:m:rwx -m u:root:rwx . &&\n \t   getfacl . | grep user:root:rwx &&\n \t   touch should-have-readable-acl &&\n-\t   getfacl should-have-readable-acl | egrep \"mask::?rw-\"\n+\t   getfacl should-have-readable-acl | grep -E \"mask::?rw-\"\n \tthen\n \t\ttest_set_prereq SETFACL\n \tfi\n@@ -34,7 +34,7 @@ check_perms_and_acl () {\n \tgetfacl \"$1\" > actual &&\n \tgrep -q \"user:root:rwx\" actual &&\n \tgrep -q \"user:${LOGNAME}:rwx\" actual &&\n-\tegrep \"mask::?r--\" actual > /dev/null 2>&1 &&\n+\tgrep -E \"mask::?r--\" actual > /dev/null 2>&1 &&\n \tgrep -q \"group::---\" actual || false\n }\n \ndiff --git a/t/t3702-add-edit.sh b/t/t3702-add-edit.sh\nindex a1801a8cbd..82bfb2fd2a 100755\n--- a/t/t3702-add-edit.sh\n+++ b/t/t3702-add-edit.sh\n@@ -100,7 +100,7 @@ EOF\n \n echo \"#!$SHELL_PATH\" >fake-editor.sh\n cat >> fake-editor.sh <<\\EOF\n-egrep -v '^index' \"$1\" >orig-patch &&\n+grep -E -v '^index' \"$1\" >orig-patch &&\n mv -f patch \"$1\"\n EOF\n \ndiff --git a/t/t4014-format-patch.sh b/t/t4014-format-patch.sh\nindex ad5c029279..de1da4673d 100755\n--- a/t/t4014-format-patch.sh\n+++ b/t/t4014-format-patch.sh\n@@ -1457,7 +1457,7 @@ append_signoff()\n \tC=$(git commit-tree HEAD^^{tree} -p HEAD) &&\n \tgit format-patch --stdout --signoff $C^..$C >append_signoff.patch &&\n \tsed -n -e \"1,/^---$/p\" append_signoff.patch |\n-\t\tegrep -n \"^Subject|Sign|^$\"\n+\t\tgrep -E -n \"^Subject|Sign|^$\"\n }\n \n test_expect_success 'signoff: commit with no body' '\n@@ -2274,10 +2274,10 @@ test_expect_success 'format-patch --base with --attach' '\n test_expect_success 'format-patch --attach cover-letter only is non-multipart' '\n \ttest_when_finished \"rm -fr patches\" &&\n \tgit format-patch -o patches --cover-letter --attach=mimemime --base=HEAD~ -1 &&\n-\t! egrep \"^--+mimemime\" patches/0000*.patch &&\n-\tegrep \"^--+mimemime$\" patches/0001*.patch >output &&\n+\t! grep -E \"^--+mimemime\" patches/0000*.patch &&\n+\tgrep -E \"^--+mimemime$\" patches/0001*.patch >output &&\n \ttest_line_count = 2 output &&\n-\tegrep \"^--+mimemime--$\" patches/0001*.patch >output &&\n+\tgrep -E \"^--+mimemime--$\" patches/0001*.patch >output &&\n \ttest_line_count = 1 output\n '\n \ndiff --git a/t/t5320-delta-islands.sh b/t/t5320-delta-islands.sh\nindex 124d47603d..406363381f 100755\n--- a/t/t5320-delta-islands.sh\n+++ b/t/t5320-delta-islands.sh\n@@ -134,7 +134,7 @@ test_expect_success 'island core places core objects first' '\n \t    repack -adfi &&\n \tgit verify-pack -v .git/objects/pack/*.pack |\n \tcut -d\" \" -f1 |\n-\tegrep \"$root|$two\" >actual &&\n+\tgrep -E \"$root|$two\" >actual &&\n \ttest_cmp expect actual\n '\n \ndiff --git a/t/t7527-builtin-fsmonitor.sh b/t/t7527-builtin-fsmonitor.sh\nindex 56c0dfffea..1746d30cf6 100755\n--- a/t/t7527-builtin-fsmonitor.sh\n+++ b/t/t7527-builtin-fsmonitor.sh\n@@ -939,9 +939,9 @@ test_expect_success CASE_INSENSITIVE_FS 'case insensitive+preserving' '\n \t# directories and files that we touched.  We may or may not get a\n \t# trailing slash on modified directories.\n \t#\n-\tegrep \"^event: abc/?$\"       ./insensitive.trace &&\n-\tegrep \"^event: abc/def/?$\"   ./insensitive.trace &&\n-\tegrep \"^event: abc/def/xyz$\" ./insensitive.trace\n+\tgrep -E \"^event: abc/?$\"       ./insensitive.trace &&\n+\tgrep -E \"^event: abc/def/?$\"   ./insensitive.trace &&\n+\tgrep -E \"^event: abc/def/xyz$\" ./insensitive.trace\n '\n \n # The variable \"unicode_debug\" is defined in the following library\n@@ -983,20 +983,20 @@ test_expect_success !UNICODE_COMPOSITION_SENSITIVE 'Unicode nfc/nfd' '\n \tthen\n \t\t# We should have seen NFC event from OS.\n \t\t# We should not have synthesized an NFD event.\n-\t\tegrep    \"^event: nfc/c_${utf8_nfc}/?$\" ./unicode.trace &&\n-\t\tegrep -v \"^event: nfc/c_${utf8_nfd}/?$\" ./unicode.trace\n+\t\tgrep -E    \"^event: nfc/c_${utf8_nfc}/?$\" ./unicode.trace &&\n+\t\tgrep -E -v \"^event: nfc/c_${utf8_nfd}/?$\" ./unicode.trace\n \telse\n \t\t# We should have seen NFD event from OS.\n \t\t# We should have synthesized an NFC event.\n-\t\tegrep \"^event: nfc/c_${utf8_nfd}/?$\" ./unicode.trace &&\n-\t\tegrep \"^event: nfc/c_${utf8_nfc}/?$\" ./unicode.trace\n+\t\tgrep -E \"^event: nfc/c_${utf8_nfd}/?$\" ./unicode.trace &&\n+\t\tgrep -E \"^event: nfc/c_${utf8_nfc}/?$\" ./unicode.trace\n \tfi &&\n \n \t# We assume UNICODE_NFD_PRESERVED.\n \t# We should have seen explicit NFD from OS.\n \t# We should have synthesized an NFC event.\n-\tegrep \"^event: nfd/d_${utf8_nfd}/?$\" ./unicode.trace &&\n-\tegrep \"^event: nfd/d_${utf8_nfc}/?$\" ./unicode.trace\n+\tgrep -E \"^event: nfd/d_${utf8_nfd}/?$\" ./unicode.trace &&\n+\tgrep -E \"^event: nfd/d_${utf8_nfc}/?$\" ./unicode.trace\n '\n \n test_done\ndiff --git a/t/t7701-repack-unpack-unreachable.sh b/t/t7701-repack-unpack-unreachable.sh\nindex 937f89ee8c..b7ac4f598a 100755\n--- a/t/t7701-repack-unpack-unreachable.sh\n+++ b/t/t7701-repack-unpack-unreachable.sh\n@@ -35,7 +35,7 @@ test_expect_success '-A with -d option leaves unreachable objects unpacked' '\n \tgit repack -A -d -l &&\n \t# verify objects are packed in repository\n \ttest 3 = $(git verify-pack -v -- .git/objects/pack/*.idx |\n-\t\t   egrep \"^($fsha1|$csha1|$tsha1) \" |\n+\t\t   grep -E \"^($fsha1|$csha1|$tsha1) \" |\n \t\t   sort | uniq | wc -l) &&\n \tgit show $fsha1 &&\n \tgit show $csha1 &&\n@@ -49,7 +49,7 @@ test_expect_success '-A with -d option leaves unreachable objects unpacked' '\n \tgit repack -A -d -l &&\n \t# verify objects are retained unpacked\n \ttest 0 = $(git verify-pack -v -- .git/objects/pack/*.idx |\n-\t\t   egrep \"^($fsha1|$csha1|$tsha1) \" |\n+\t\t   grep -E \"^($fsha1|$csha1|$tsha1) \" |\n \t\t   sort | uniq | wc -l) &&\n \tgit show $fsha1 &&\n \tgit show $csha1 &&\ndiff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh\nindex 01c74b8b07..1130ef21b3 100755\n--- a/t/t9001-send-email.sh\n+++ b/t/t9001-send-email.sh\n@@ -1519,7 +1519,7 @@ test_expect_success $PREREQ 'asks about and fixes 8bit encodings' '\n \tgrep \"do not declare a Content-Transfer-Encoding\" stdout &&\n \tgrep email-using-8bit stdout &&\n \tgrep \"Which 8bit encoding\" stdout &&\n-\tegrep \"Content|MIME\" msgtxt1 >actual &&\n+\tgrep -E \"Content|MIME\" msgtxt1 >actual &&\n \ttest_cmp content-type-decl actual\n '\n \n@@ -1530,7 +1530,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding works' '\n \tgit send-email --from=author@example.com --to=nobody@example.com \\\n \t\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n \t\t\temail-using-8bit >stdout &&\n-\tegrep \"Content|MIME\" msgtxt1 >actual &&\n+\tgrep -E \"Content|MIME\" msgtxt1 >actual &&\n \ttest_cmp content-type-decl actual\n '\n \n@@ -1545,7 +1545,7 @@ test_expect_success $PREREQ 'sendemail.8bitEncoding in .git/config overrides --g\n \tgit send-email --from=author@example.com --to=nobody@example.com \\\n \t\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n \t\t\temail-using-8bit >stdout &&\n-\tegrep \"Content|MIME\" msgtxt1 >actual &&\n+\tgrep -E \"Content|MIME\" msgtxt1 >actual &&\n \ttest_cmp content-type-decl actual\n '\n \n@@ -1557,7 +1557,7 @@ test_expect_success $PREREQ '--8bit-encoding overrides sendemail.8bitEncoding' '\n \t\t\t--smtp-server=\"$(pwd)/fake.sendmail\" \\\n \t\t\t--8bit-encoding=UTF-8 \\\n \t\t\temail-using-8bit >stdout &&\n-\tegrep \"Content|MIME\" msgtxt1 >actual &&\n+\tgrep -E \"Content|MIME\" msgtxt1 >actual &&\n \ttest_cmp content-type-decl actual\n '\n \ndiff --git a/t/t9814-git-p4-rename.sh b/t/t9814-git-p4-rename.sh\nindex 468767cbf4..2a9838f37f 100755\n--- a/t/t9814-git-p4-rename.sh\n+++ b/t/t9814-git-p4-rename.sh\n@@ -216,7 +216,7 @@ test_expect_success 'detect copies' '\n # variable exists, which allows admins to disable the \"p4 move\" command.\n test_lazy_prereq P4D_HAVE_CONFIGURABLE_RUN_MOVE_ALLOW '\n \tp4 configure show run.move.allow >out &&\n-\tegrep ^run.move.allow: out\n+\tgrep -E ^run.move.allow: out\n '\n \n # If move can be disabled, turn it off and test p4 move handling\ndiff --git a/t/t9815-git-p4-submit-fail.sh b/t/t9815-git-p4-submit-fail.sh\nindex 9779dc0d11..0ca9937de6 100755\n--- a/t/t9815-git-p4-submit-fail.sh\n+++ b/t/t9815-git-p4-submit-fail.sh\n@@ -417,8 +417,8 @@ test_expect_success 'cleanup chmod after submit cancel' '\n \t\t! p4 fstat -T action text &&\n \t\ttest_path_is_file text+x &&\n \t\t! p4 fstat -T action text+x &&\n-\t\tls -l text | egrep ^-r-- &&\n-\t\tls -l text+x | egrep ^-r-x\n+\t\tls -l text | grep -E ^-r-- &&\n+\t\tls -l text+x | grep -E ^-r-x\n \t)\n '\n \ndiff --git a/t/test-lib-functions.sh b/t/test-lib-functions.sh\nindex c6479f24eb..527a714500 100644\n--- a/t/test-lib-functions.sh\n+++ b/t/test-lib-functions.sh\n@@ -897,7 +897,7 @@ test_path_is_symlink () {\n test_dir_is_empty () {\n \ttest \"$#\" -ne 1 && BUG \"1 param\"\n \ttest_path_is_dir \"$1\" &&\n-\tif test -n \"$(ls -a1 \"$1\" | egrep -v '^\\.\\.?$')\"\n+\tif test -n \"$(ls -a1 \"$1\" | grep -E -v '^\\.\\.?$')\"\n \tthen\n \t\techo \"Directory '$1' is not empty, it contains:\"\n \t\tls -la \"$1\"\n-- \n2.38.0.rc0\n\n"},{"id":"463366","messageId":"b65a3d7749dbe77bc57c0245b5c0752c923b6714.1663765176.git.congdanhqx@gmail.com","threadId":"58479","inReplyTo":"cover.1663765176.git.congdanhqx@gmail.com","subject":"[PATCH v2 4/4] t: convert fgrep usage to \"grep -F\"","fromName":"Đoàn Trần Công Danh","fromEmail":"congdanhqx@gmail.com","sentAt":"2022-09-21T13:02:32Z","receivedAt":"2022-09-21T13:03:24Z","isPatch":true,"sender":{"key":"congdanhqx@gmail.com","avatar":"https://avatars.githubusercontent.com/u/42673067?v=4"},"body":"Despite POSIX states that:\n\n> The old egrep and fgrep commands are likely to be supported for many\n> years to come as implementation extensions, allowing historical\n> applications to operate unmodified.\n\nGNU grep 3.8 started to warn[1]:\n\n> The egrep and fgrep commands, which have been deprecated since\n> release 2.5.3 (2007), now warn that they are obsolescent and should\n> be replaced by grep -E and grep -F.\n\nPrepare for their removal in the future.\n\n[1]: https://lists.gnu.org/archive/html/info-gnu/2022-09/msg00001.html\n\nSigned-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n---\n t/t3700-add.sh                     | 2 +-\n t/t7003-filter-branch.sh           | 4 ++--\n t/t9133-git-svn-nested-git-repo.sh | 6 +++---\n t/t9134-git-svn-ignore-paths.sh    | 8 ++++----\n t/t9140-git-svn-reset.sh           | 4 ++--\n t/t9147-git-svn-include-paths.sh   | 8 ++++----\n 6 files changed, 16 insertions(+), 16 deletions(-)\n\ndiff --git a/t/t3700-add.sh b/t/t3700-add.sh\nindex 8689b48589..51afbd7b24 100755\n--- a/t/t3700-add.sh\n+++ b/t/t3700-add.sh\n@@ -291,7 +291,7 @@ test_expect_success BSLASHPSPEC \"git add 'fo\\\\[ou\\\\]bar' ignores foobar\" '\n \tgit reset --hard &&\n \ttouch fo\\[ou\\]bar foobar &&\n \tgit add '\\''fo\\[ou\\]bar'\\'' &&\n-\tgit ls-files fo\\[ou\\]bar | fgrep fo\\[ou\\]bar &&\n+\tgit ls-files fo\\[ou\\]bar | grep -F fo\\[ou\\]bar &&\n \t! ( git ls-files foobar | grep foobar )\n '\n \ndiff --git a/t/t7003-filter-branch.sh b/t/t7003-filter-branch.sh\nindex e18a218952..f6aebe92ff 100755\n--- a/t/t7003-filter-branch.sh\n+++ b/t/t7003-filter-branch.sh\n@@ -49,7 +49,7 @@ test_expect_success 'result is really identical' '\n test_expect_success 'rewrite bare repository identically' '\n \t(git config core.bare true && cd .git &&\n \t git filter-branch branch > filter-output 2>&1 &&\n-\t! fgrep fatal filter-output)\n+\t! grep fatal filter-output)\n '\n git config core.bare false\n test_expect_success 'result is really identical' '\n@@ -506,7 +506,7 @@ test_expect_success 'rewrite repository including refs that point at non-commit\n \tgit tag -a -m \"tag to a tree\" treetag $new_tree &&\n \tgit reset --hard HEAD &&\n \tgit filter-branch -f -- --all >filter-output 2>&1 &&\n-\t! fgrep fatal filter-output\n+\t! grep fatal filter-output\n '\n \n test_expect_success 'filter-branch handles ref deletion' '\ndiff --git a/t/t9133-git-svn-nested-git-repo.sh b/t/t9133-git-svn-nested-git-repo.sh\nindex f894860867..d8d536269c 100755\n--- a/t/t9133-git-svn-nested-git-repo.sh\n+++ b/t/t9133-git-svn-nested-git-repo.sh\n@@ -35,7 +35,7 @@ test_expect_success 'SVN-side change outside of .git' '\n \t\techo b >> a &&\n \t\tsvn_cmd commit -m \"SVN-side change outside of .git\" &&\n \t\tsvn_cmd up &&\n-\t\tsvn_cmd log -v | fgrep \"SVN-side change outside of .git\"\n+\t\tsvn_cmd log -v | grep -F \"SVN-side change outside of .git\"\n \t)\n '\n \n@@ -59,7 +59,7 @@ test_expect_success 'SVN-side change inside of .git' '\n \t\tsvn_cmd add --force .git &&\n \t\tsvn_cmd commit -m \"SVN-side change inside of .git\" &&\n \t\tsvn_cmd up &&\n-\t\tsvn_cmd log -v | fgrep \"SVN-side change inside of .git\"\n+\t\tsvn_cmd log -v | grep -F \"SVN-side change inside of .git\"\n \t)\n '\n \n@@ -82,7 +82,7 @@ test_expect_success 'SVN-side change in and out of .git' '\n \t\tgit commit -m \"add a inside an SVN repo\" &&\n \t\tsvn_cmd commit -m \"SVN-side change in and out of .git\" &&\n \t\tsvn_cmd up &&\n-\t\tsvn_cmd log -v | fgrep \"SVN-side change in and out of .git\"\n+\t\tsvn_cmd log -v | grep -F \"SVN-side change in and out of .git\"\n \t)\n '\n \ndiff --git a/t/t9134-git-svn-ignore-paths.sh b/t/t9134-git-svn-ignore-paths.sh\nindex 4a77eb9f60..3188400226 100755\n--- a/t/t9134-git-svn-ignore-paths.sh\n+++ b/t/t9134-git-svn-ignore-paths.sh\n@@ -43,7 +43,7 @@ test_expect_success 'init+fetch an SVN repository with ignored www directory' '\n test_expect_success 'verify ignore-paths config saved by clone' '\n \t(\n \t    cd g &&\n-\t    git config --get svn-remote.svn.ignore-paths | fgrep \"www\"\n+\t    git config --get svn-remote.svn.ignore-paths | grep www\n \t)\n '\n \n@@ -53,7 +53,7 @@ test_expect_success 'SVN-side change outside of www' '\n \t\techo b >> qqq/test_qqq.txt &&\n \t\tsvn_cmd commit -m \"SVN-side change outside of www\" &&\n \t\tsvn_cmd up &&\n-\t\tsvn_cmd log -v | fgrep \"SVN-side change outside of www\"\n+\t\tsvn_cmd log -v | grep \"SVN-side change outside of www\"\n \t)\n '\n \n@@ -85,7 +85,7 @@ test_expect_success 'SVN-side change inside of ignored www' '\n \t\techo zaq >> www/test_www.txt &&\n \t\tsvn_cmd commit -m \"SVN-side change inside of www/test_www.txt\" &&\n \t\tsvn_cmd up &&\n-\t\tsvn_cmd log -v | fgrep \"SVN-side change inside of www/test_www.txt\"\n+\t\tsvn_cmd log -v | grep -F \"SVN-side change inside of www/test_www.txt\"\n \t)\n '\n \n@@ -118,7 +118,7 @@ test_expect_success 'SVN-side change in and out of ignored www' '\n \t\techo ygg >> qqq/test_qqq.txt &&\n \t\tsvn_cmd commit -m \"SVN-side change in and out of ignored www\" &&\n \t\tsvn_cmd up &&\n-\t\tsvn_cmd log -v | fgrep \"SVN-side change in and out of ignored www\"\n+\t\tsvn_cmd log -v | grep \"SVN-side change in and out of ignored www\"\n \t)\n '\n \ndiff --git a/t/t9140-git-svn-reset.sh b/t/t9140-git-svn-reset.sh\nindex e855904629..a420b2a87a 100755\n--- a/t/t9140-git-svn-reset.sh\n+++ b/t/t9140-git-svn-reset.sh\n@@ -43,7 +43,7 @@ test_expect_success 'fetch fails on modified hidden file' '\n \t  git svn find-rev refs/remotes/git-svn > ../expect &&\n \t  test_must_fail git svn fetch 2> ../errors &&\n \t  git svn find-rev refs/remotes/git-svn > ../expect2 ) &&\n-\tfgrep \"not found in commit\" errors &&\n+\tgrep \"not found in commit\" errors &&\n \ttest_cmp expect expect2\n '\n \n@@ -59,7 +59,7 @@ test_expect_success 'refetch succeeds not ignoring any files' '\n \t( cd g &&\n \t  git svn fetch &&\n \t  git svn rebase &&\n-\t  fgrep \"mod hidden\" hid/hid.txt\n+\t  grep \"mod hidden\" hid/hid.txt\n \t)\n '\n \ndiff --git a/t/t9147-git-svn-include-paths.sh b/t/t9147-git-svn-include-paths.sh\nindex 257fc8f2f8..63fa0b6732 100755\n--- a/t/t9147-git-svn-include-paths.sh\n+++ b/t/t9147-git-svn-include-paths.sh\n@@ -45,7 +45,7 @@ test_expect_success 'init+fetch an SVN repository with included qqq directory' '\n test_expect_success 'verify include-paths config saved by clone' '\n \t(\n \t    cd g &&\n-\t    git config --get svn-remote.svn.include-paths | fgrep \"qqq\"\n+\t    git config --get svn-remote.svn.include-paths | grep qqq\n \t)\n '\n \n@@ -55,7 +55,7 @@ test_expect_success 'SVN-side change outside of www' '\n \t\techo b >> qqq/test_qqq.txt &&\n \t\tsvn_cmd commit -m \"SVN-side change outside of www\" &&\n \t\tsvn_cmd up &&\n-\t\tsvn_cmd log -v | fgrep \"SVN-side change outside of www\"\n+\t\tsvn_cmd log -v | grep \"SVN-side change outside of www\"\n \t)\n '\n \n@@ -87,7 +87,7 @@ test_expect_success 'SVN-side change inside of ignored www' '\n \t\techo zaq >> www/test_www.txt &&\n \t\tsvn_cmd commit -m \"SVN-side change inside of www/test_www.txt\" &&\n \t\tsvn_cmd up &&\n-\t\tsvn_cmd log -v | fgrep \"SVN-side change inside of www/test_www.txt\"\n+\t\tsvn_cmd log -v | grep \"SVN-side change inside of www/test_www.txt\"\n \t)\n '\n \n@@ -120,7 +120,7 @@ test_expect_success 'SVN-side change in and out of included qqq' '\n \t\techo ygg >> qqq/test_qqq.txt &&\n \t\tsvn_cmd commit -m \"SVN-side change in and out of ignored www\" &&\n \t\tsvn_cmd up &&\n-\t\tsvn_cmd log -v | fgrep \"SVN-side change in and out of ignored www\"\n+\t\tsvn_cmd log -v | grep \"SVN-side change in and out of ignored www\"\n \t)\n '\n \n-- \n2.38.0.rc0\n\n"},{"id":"463381","messageId":"xmqqpmfo38lb.fsf@gitster.g","threadId":"58479","inReplyTo":"ebaf6cec07e3a07c969c456e93aa9d4464f75548.1663765176.git.congdanhqx@gmail.com","subject":"Re: [PATCH v2 2/4] t: remove \\{m,n\\} from BRE grep usage","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2022-09-21T18:06:56Z","receivedAt":"2022-09-21T18:07:07Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Đoàn Trần Công Danh  <congdanhqx@gmail.com> writes:\n\n> The CodingGuidelines says we should avoid \\{m,n\\} in BRE usage.\n> And their usages in our code base is limited, and subjectively\n> hard to read.\n>\n> Replace them with ERE.\n\nOK.  I do not personally mind allowing \\{0,1\\} in BRE (which would\ngive us a portable way to express '?'), but we are not forbidding\nERE in any way, so I am OK with the direction.\n\n> Except for \"0\\{40\\}\" which would be changed to \"$ZERO_OID\",\n> which is a better value for testing with:\n> GIT_TEST_DEFAULT_HASH=sha256\n\nAbsolutely.  This alone is a change worth doing regardless of the\nportability issues.\n\n> Signed-off-by: Đoàn Trần Công Danh <congdanhqx@gmail.com>\n> ---\n>\n>  Phillip Wood said:\n>  > \\{m,n\\} is valid in a posix BRE[1]. If we're already using it without\n>  > anyone\n>  > complaining I think it would be better to update CodingGuidlines to allow\n>  > it.\n>\n>  Yes, I agree. However, I think our usage of \\{m,n\\} is limited.\n>  Let's skip the lifting for now.\n\nOK.\n"}]}