From 0f063b6c766fc98124f60b6b0f8424142641ff88 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Fri, 17 May 2024 21:01:49 +0200 Subject: [PATCH 1/7] Switch grep from non-portable BRE to portable ERE This makes the grep usage fully POSIX compliant. The ability to enable ERE features in BRE using backslash is a GNU extension. Signed-off-by: Marcel Telka Signed-off-by: Junio C Hamano --- mergetools/vimdiff | 2 +- t/t1404-update-ref-errors.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/mergetools/vimdiff b/mergetools/vimdiff index 734d15a03b025e..f8ad6b35d4dbde 100644 --- a/mergetools/vimdiff +++ b/mergetools/vimdiff @@ -325,7 +325,7 @@ gen_cmd () { fi # If this is a single window diff with all the buffers - if ! echo "$tab" | grep ",\|/" >/dev/null + if ! echo "$tab" | grep -E ",|/" >/dev/null then CMD="$CMD | silent execute 'bufdo diffthis'" fi diff --git a/t/t1404-update-ref-errors.sh b/t/t1404-update-ref-errors.sh index 98e9158bd2ab41..67ebd81a4c7621 100755 --- a/t/t1404-update-ref-errors.sh +++ b/t/t1404-update-ref-errors.sh @@ -100,7 +100,7 @@ df_test() { printf "%s\n" "delete $delname" "create $addname $D" fi >commands && test_must_fail git update-ref --stdin output.err && - grep "fatal:\( cannot lock ref $SQ$addname$SQ:\)\? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err && + grep -E "fatal:( cannot lock ref $SQ$addname$SQ:)? $SQ$delref$SQ exists; cannot create $SQ$addref$SQ" output.err && printf "%s\n" "$C $delref" >expected-refs && git for-each-ref --format="%(objectname) %(refname)" $prefix/r >actual-refs && test_cmp expected-refs actual-refs From ba1dec3257c5c8eb7edb71a16e5f642bf51d895d Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Fri, 17 May 2024 16:08:45 +0200 Subject: [PATCH 2/7] t/t9902-completion.sh: backslashes in echo The usage of backslashes in echo is not portable. Since some tests tries to output strings containing '\b' it is safer to use printf here. The usage of printf instead of echo is also preferred by POSIX. Signed-off-by: Marcel Telka Signed-off-by: Junio C Hamano --- t/t9902-completion.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t9902-completion.sh b/t/t9902-completion.sh index 963f865f27ed05..ed3d03367ec6c2 100755 --- a/t/t9902-completion.sh +++ b/t/t9902-completion.sh @@ -73,7 +73,7 @@ _get_comp_words_by_ref () print_comp () { local IFS=$'\n' - echo "${COMPREPLY[*]}" > out + printf '%s\n' "${COMPREPLY[*]}" > out } run_completion () From ce09c692cd32ac3bd82d7f3bd323420077ed23e7 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Fri, 17 May 2024 15:19:00 +0200 Subject: [PATCH 3/7] t/t0600-reffiles-backend.sh: rm -v is not portable The -v option for rm is not specified by POSIX. The illumos implementation of rm does not support -v. Since we do not need the verbose rm output we just drop -v for rm. Signed-off-by: Marcel Telka Signed-off-by: Junio C Hamano --- t/t0600-reffiles-backend.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t0600-reffiles-backend.sh b/t/t0600-reffiles-backend.sh index a390cffc800c62..92f570313d433a 100755 --- a/t/t0600-reffiles-backend.sh +++ b/t/t0600-reffiles-backend.sh @@ -424,7 +424,7 @@ test_expect_success SYMLINKS 'git branch -m with symlinked .git/refs' ' test_when_finished "rm -rf subdir" && git init --bare subdir && - rm -rfv subdir/refs subdir/objects subdir/packed-refs && + rm -rf subdir/refs subdir/objects subdir/packed-refs && ln -s ../.git/refs subdir/refs && ln -s ../.git/objects subdir/objects && ln -s ../.git/packed-refs subdir/packed-refs && From 05e5ff035f12811ca07271104fe4c99c8abceee6 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Fri, 17 May 2024 15:40:00 +0200 Subject: [PATCH 4/7] t/t4202-log.sh: fix misspelled variable The GPGSSH_GOOD_SIGNATURE_TRUSTED variable was spelled as GOOD_SIGNATURE_TRUSTED and so the grep was used the null RE that matches everything. Signed-off-by: Marcel Telka Signed-off-by: Junio C Hamano --- t/t4202-log.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t4202-log.sh b/t/t4202-log.sh index 60fe60d7610e2a..86c695eb0aef8d 100755 --- a/t/t4202-log.sh +++ b/t/t4202-log.sh @@ -2022,7 +2022,7 @@ test_expect_success GPGSM 'log --graph --show-signature x509' ' test_expect_success GPGSSH 'log --graph --show-signature ssh' ' test_config gpg.ssh.allowedSignersFile "${GPGSSH_ALLOWED_SIGNERS}" && git log --graph --show-signature -n1 signed-ssh >actual && - grep "${GOOD_SIGNATURE_TRUSTED}" actual + grep "${GPGSSH_GOOD_SIGNATURE_TRUSTED}" actual ' test_expect_success GPGSSH,GPGSSH_VERIFYTIME 'log shows failure on expired signature key' ' From 50acb483599501124770f25f70d99ce3dc67c842 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Fri, 17 May 2024 17:27:41 +0200 Subject: [PATCH 5/7] t/t1700-split-index.sh: mv -v is not portable The -v option for mv is not specified by POSIX. The illumos implementation of mv does not support -v. Since we do not need the verbose mv output we just drop -v for mv. Signed-off-by: Marcel Telka Signed-off-by: Junio C Hamano --- t/t1700-split-index.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t1700-split-index.sh b/t/t1700-split-index.sh index a7b7263b35d1d8..ac4a5b2734c078 100755 --- a/t/t1700-split-index.sh +++ b/t/t1700-split-index.sh @@ -527,7 +527,7 @@ test_expect_success 'reading split index at alternate location' ' # ... and, for backwards compatibility, in the current GIT_DIR # as well. - mv -v ./reading-alternate-location/.git/sharedindex.* .git && + mv ./reading-alternate-location/.git/sharedindex.* .git && GIT_INDEX_FILE=./reading-alternate-location/.git/index \ git ls-files --cached >actual && test_cmp expect actual From 22c22d30d3f5f7f8f50bc3e43147a2a5ebc6a601 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Fri, 17 May 2024 17:39:28 +0200 Subject: [PATCH 6/7] t/t9118-git-svn-funky-branch-names.sh: sed needs semicolon POSIX specifies that all editing commands between braces shall be terminated by a or . Signed-off-by: Marcel Telka Signed-off-by: Junio C Hamano --- t/t9118-git-svn-funky-branch-names.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t9118-git-svn-funky-branch-names.sh b/t/t9118-git-svn-funky-branch-names.sh index d3261e35b81840..a34fd46ecc5a39 100755 --- a/t/t9118-git-svn-funky-branch-names.sh +++ b/t/t9118-git-svn-funky-branch-names.sh @@ -38,7 +38,7 @@ test_expect_success 'setup svnrepo' ' # SVN 1.7 will truncate "not-a%40{0]" to just "not-a". # Look at what SVN wound up naming the branch and use that. # Be sure to escape the @ if it shows up. -non_reflog=$(svn_cmd ls "$svnrepo/pr ject/branches" | sed -ne '/not-a/ { s/\///; s/@/%40/; p }') +non_reflog=$(svn_cmd ls "$svnrepo/pr ject/branches" | sed -ne '/not-a/ { s/\///; s/@/%40/; p; }') test_expect_success 'test clone with funky branch names' ' git svn clone -s "$svnrepo/pr ject" project && From bac28a942a08d8812a89649c1198ae7abd539ec1 Mon Sep 17 00:00:00 2001 From: Marcel Telka Date: Fri, 17 May 2024 18:57:46 +0200 Subject: [PATCH 7/7] t/t9001-send-email.sh: sed - remove the i flag for s The 'i' flag for the 's' command of sed is not specified by POSIX so it is not portable. Replace its usage by different and portable syntax. Signed-off-by: Marcel Telka Signed-off-by: Junio C Hamano --- t/t9001-send-email.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/t/t9001-send-email.sh b/t/t9001-send-email.sh index 5a771000c9ca0d..58699f8e4eedd6 100755 --- a/t/t9001-send-email.sh +++ b/t/t9001-send-email.sh @@ -2526,7 +2526,7 @@ test_expect_success $PREREQ 'test forbidSendmailVariables behavior override' ' test_expect_success $PREREQ '--compose handles lowercase headers' ' write_script fake-editor <<-\EOF && - sed "s/^From:.*/from: edited-from@example.com/i" "$1" >"$1.tmp" && + sed "s/^[Ff][Rr][Oo][Mm]:.*/from: edited-from@example.com/" "$1" >"$1.tmp" && mv "$1.tmp" "$1" EOF clean_fake_sendmail &&