[PATCH v2] t7450: inspect the correct path a broken code would write to

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



From: chenjianhu <chenjianh@xxxxxxxxxx>

Prior to 05e9cd64 (config: quote values containing CR character,
2025-05-19), a repository can trick "clone --recurse-submodules"
into running a post-checkout hook shipped with the project.  The
test was written to make sure the trick would no longer run the
hook with the fix in the commit.

However, the test did not check for the path the hook would
create; correct the path to the expected one if the bug were
still with us.

Signed-off-by: chenjianhu <chenjianhu@xxxxxxxxxx>
---
    modify the “foo" file path to "$PWD/bad-clone/sub/foo".
    
    cc: "Kristoffer Haugsbakk" kristofferhaugsbakk@xxxxxxxxxxxx cc: Justin
    Tobler jltobler@xxxxxxxxx

Published-As: https://github.com/gitgitgadget/git/releases/tag/pr-git-2022%2Fcjhxmx%2Fcjhxmx-git-test-v2
Fetch-It-Via: git fetch https://github.com/gitgitgadget/git pr-git-2022/cjhxmx/cjhxmx-git-test-v2
Pull-Request: https://github.com/git/git/pull/2022

Range-diff vs v1:

 1:  c2d1d8fe884 ! 1:  6434587a075 modify the “foo" file path to "$PWD/bad-clone/sub/foo".
     @@
       ## Metadata ##
     -Author: 陈建虎 <chenjianhu@xxxxxxxxxx>
     +Author: chenjianhu <chenjianh@xxxxxxxxxx>
      
       ## Commit message ##
     -    modify the “foo" file path to "$PWD/bad-clone/sub/foo".
     +    t7450: inspect the correct path a broken code would write to
      
     -    In the t7450-bad-git-dotfiles.sh, when post-checkout
     -    is executed, the actual path where the foo file
     -    is created should be "$PWD/bad-clone/sub/foo".
     +    Prior to 05e9cd64 (config: quote values containing CR character,
     +    2025-05-19), a repository can trick "clone --recurse-submodules"
     +    into running a post-checkout hook shipped with the project.  The
     +    test was written to make sure the trick would no longer run the
     +    hook with the fix in the commit.
     +
     +    However, the test did not check for the path the hook would
     +    create; correct the path to the expected one if the bug were
     +    still with us.
      
          Signed-off-by: chenjianhu <chenjianhu@xxxxxxxxxx>
      


 t/t7450-bad-git-dotfiles.sh | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/t/t7450-bad-git-dotfiles.sh b/t/t7450-bad-git-dotfiles.sh
index 14b5743b962..f512eed278c 100755
--- a/t/t7450-bad-git-dotfiles.sh
+++ b/t/t7450-bad-git-dotfiles.sh
@@ -401,7 +401,7 @@ test_expect_success SYMLINKS,!WINDOWS,!MINGW 'submodule must not checkout into d
 	git -C repo commit -m submodule &&
 
 	git -c protocol.file.allow=always clone --recurse-submodules repo bad-clone &&
-	! test -f "$PWD/foo" &&
+	! test -f "$PWD/bad-clone/sub/foo" &&
 	test -f $(printf "bad-clone/sub\r/post-checkout")
 '
 

base-commit: e813a0200a7121b97fec535f0d0b460b0a33356c
-- 
gitgitgadget




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux