commit f1aec6edf3cf139d631d740ffc7f9428c913685c from: Stefan Sperling date: Mon Oct 24 15:42:00 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 - 24d916d21f287fd70d7ba70f077a8d84c3fdee7c commit + f1aec6edf3cf139d631d740ffc7f9428c913685c 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 - 91307342c12e2cd7aee08e6b177a89a2ea3f20e2 blob + 719bac3298df1e16197cba688737ead5ea2508cd --- 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 - dd2a0116f4d80b4d2507dd880190f3f355cc3c95 blob + ed1cc69eb0e97b9e276519a28388cd22e2ec82dc --- 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 - 8cf81360cd1e5b35e87f5e5784c0b83a6aa7356b blob + d2688f0de1e8d3514a41b90c5ac5e0af154f5cbe --- 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 - be07e3211fa6b1491159fb5458fdf2f901864d68 blob + 51fe8c9d8176eeaa086aa653071670afd2db3eeb --- 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 - 3ffad0feb0127a8e3deb3766f2d7a9d1a383e35f blob + 70b885ea4ca9f69d8efec236194dd51d5935741e --- 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 - 9f1d03103e3ac9c1cb0474bc04a51cb2ef5e4651 blob + fce60c7f277d948ec481a744ed23e1b55ec128ed --- 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