commit bf3ab20628c2f092c3ddea4787a49621986abd07 from: Stefan Sperling via: Thomas Adam date: Mon Oct 24 16:35:53 2022 UTC fix regression test failures with Git 3.30.5 / 2.38.1 or later installed The fix for CVE-2022-39253 in Git made our regression tests fail since creating submodules from local clones is no longer allowed by default. Add an override to our invocations of "git submodule add", the same which was added to Git's regression test suite as part of their fix. This CVE doesn't otherwise affect us. We do not implement submodules. Our use of them in regression tests exists only to ensure that Got does not freak out when it sees one. Precisely because automated support for nested repositories and/or working copies (as in Git Submodules, or Subversion Externals, etc.) have been an endless source of security problems in other systems. sudden test failures pointed out by naddy@ commit - 2424a69df90c2e63ec0640ae982b316106698760 commit + bf3ab20628c2f092c3ddea4787a49621986abd07 blob - 3b683b736207663881b76ad7dc8fe66657258335 blob + 41fa5ae45bcc23ddd3f6c20844b2b898a7901bbf --- regress/cmdline/add.sh +++ regress/cmdline/add.sh @@ -266,7 +266,8 @@ test_add_clashes_with_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') got checkout $testroot/repo $testroot/wt > /dev/null blob - f7e5a31ee56ac3317eb9169b6df6ccb743c92591 blob + 3d48fd3967ec94a3096d042e38e36f52a695c6a0 --- regress/cmdline/blame.sh +++ regress/cmdline/blame.sh @@ -738,7 +738,8 @@ test_blame_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') # Attempt a (nonsensical) blame of a submodule. blob - 60e1f0fac6ad4a1710f1b237ccc1120775fab326 blob + 2e37e870ce0e06673c3f701e940ebdd2438b8c38 --- regress/cmdline/cat.sh +++ regress/cmdline/cat.sh @@ -207,7 +207,8 @@ test_cat_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') got cat -r $testroot/repo repo2 > $testroot/stdout \ @@ -237,7 +238,8 @@ test_cat_submodule_of_same_repo() { local gmtoff=`date +%z` (cd $testroot && git clone -q repo repo2 >/dev/null) - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') # 'got cat' shows the commit object which the submodule points to blob - d5f017d307e68809b88a4ef9d579902a290129ef blob + fa55d96f05c0ea98d084505524dc36353abc0120 --- regress/cmdline/checkout.sh +++ regress/cmdline/checkout.sh @@ -278,7 +278,8 @@ test_checkout_ignores_submodules() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') local commit_id=`git_show_head $testroot/repo` blob - 1b6225239a7ffad05a3a5d7307cdf6927fb2cc5c blob + 8e515695e66fe8502ee5328569beffeec45ae61c --- regress/cmdline/cherrypick.sh +++ regress/cmdline/cherrypick.sh @@ -330,7 +330,8 @@ test_cherrypick_modified_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') got checkout $testroot/repo $testroot/wt > /dev/null @@ -367,7 +368,8 @@ test_cherrypick_added_submodule() { # Add the repo/repo2 submodule on newbranch (cd $testroot/repo && git checkout -q -b newbranch) - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') local commit_id=`git_show_head $testroot/repo` @@ -403,7 +405,8 @@ test_cherrypick_conflict_wt_file_vs_repo_submodule() { # Add the repo/repo2 submodule on newbranch (cd $testroot/repo && git checkout -q -b newbranch) - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') local commit_id=`git_show_head $testroot/repo` blob - bd9a3682082a9cea59639f31caa0666db9c823f0 blob + a62a12556a4f4fd09459de4290d9f368de04dcab --- regress/cmdline/commit.sh +++ regress/cmdline/commit.sh @@ -1109,7 +1109,8 @@ test_commit_with_unrelated_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') got checkout $testroot/repo $testroot/wt > /dev/null blob - 84e63ab3e0ed94eb29e2fcdd5b9e529332c4f093 blob + b7220ca0b593cd415bbc281886ff62921be0acdc --- regress/cmdline/diff.sh +++ regress/cmdline/diff.sh @@ -678,7 +678,8 @@ test_diff_submodule_of_same_repo() { local testroot=`test_init diff_submodule_of_same_repo` (cd $testroot && git clone -q repo repo2 >/dev/null) - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') epsilon_id=$(got tree -r $testroot/repo -i | grep 'epsilon/$' | \ blob - 57b5461e1fbccf0b140efa562c91834f7f3db187 blob + 9210413ada76ebe36264f3770c28732157edfe99 --- regress/cmdline/log.sh +++ regress/cmdline/log.sh @@ -774,7 +774,8 @@ test_log_submodule() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') local head_commit=`git_show_head $testroot/repo` blob - 75ae4d9639f4152935424d22a9cd67bb41ebacf1 blob + 5499391aa37047d50dfd1ab7501e0772654e8b4f --- regress/cmdline/tree.sh +++ regress/cmdline/tree.sh @@ -81,7 +81,8 @@ test_tree_submodule() { local testroot=`test_init tree_submodule` make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') local submodule_id=$(got tree -r $testroot/repo -i | \ @@ -112,7 +113,8 @@ test_tree_submodule_of_same_repo() { local testroot=`test_init tree_submodule_of_same_repo` (cd $testroot && git clone -q repo repo2 >/dev/null) - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') # Currently fails with "bad object data" blob - a949436c0074202971cdc185337b3631820467f9 blob + 78efb6baf1ef1a675d0eda18bf4d4f2156f1814d --- regress/cmdline/update.sh +++ regress/cmdline/update.sh @@ -1725,7 +1725,8 @@ test_update_modified_submodules() { make_single_file_repo $testroot/repo2 foo - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') got checkout $testroot/repo $testroot/wt > /dev/null @@ -1764,7 +1765,8 @@ test_update_adds_submodule() { echo "modified foo" > $testroot/repo2/foo (cd $testroot/repo2 && git commit -q -a -m 'modified a submodule') - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') echo "A .gitmodules" > $testroot/stdout.expected @@ -1800,7 +1802,8 @@ test_update_conflict_wt_file_vs_repo_submodule() { return 1 fi - (cd $testroot/repo && git submodule -q add ../repo2) + (cd $testroot/repo && git -c protocol.file.allow=always \ + submodule -q add ../repo2) (cd $testroot/repo && git commit -q -m 'adding submodule') # Modify the clashing file such that any modifications brought