Skip to content

Commit b537af7

Browse files
pks-tgitster
authored andcommitted
t0060: fix EBUSY in MinGW when setting up runtime prefix
Two of our tests in t0060 verify that the runtime prefix functionality works as expected by creating a separate directory hierarchy, copying the Git executable in there and then creating scripts relative to that executable. These tests fail quite regularly in GitLab CI with the following error: expecting success of 0060.218 '%(prefix)/ works': mkdir -p pretend/bin && cp "$GIT_EXEC_PATH"/git$X pretend/bin/ && git config yes.path "%(prefix)/yes" && GIT_EXEC_PATH= ./pretend/bin/git config --path yes.path >actual && echo "$(pwd)/pretend/yes" >expect && test_cmp expect actual ++ mkdir -p pretend/bin ++ cp /c/GitLab-Runner/builds/gitlab-org/git/git.exe pretend/bin/ cp: cannot create regular file 'pretend/bin/git.exe': Device or resource busy error: last command exited with $?=1 not ok 218 - %(prefix)/ works Seemingly, the "git.exe" binary we are trying to overwrite is still being held open. It is somewhat puzzling why exactly that is: while the preceding test _does_ write to and execute the same path, it should have exited and shouldn't keep any backgrounded processes around. So it must be held open by something else, either in MinGW or in Windows itself. While the root cause is puzzling, the workaround is trivial enough: instead of writing the file twice we simply pull the common setup into a separate test case so that we won't observe EBUSY in the first place. Signed-off-by: Patrick Steinhardt <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 1b4e9a5 commit b537af7

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

t/t0060-path-utils.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -592,17 +592,19 @@ test_lazy_prereq CAN_EXEC_IN_PWD '
592592
./git rev-parse
593593
'
594594

595+
test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'setup runtime prefix' '
596+
mkdir -p pretend/bin &&
597+
cp "$GIT_EXEC_PATH"/git$X pretend/bin/
598+
'
599+
595600
test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD 'RUNTIME_PREFIX works' '
596-
mkdir -p pretend/bin pretend/libexec/git-core &&
601+
mkdir -p pretend/libexec/git-core &&
597602
echo "echo HERE" | write_script pretend/libexec/git-core/git-here &&
598-
cp "$GIT_EXEC_PATH"/git$X pretend/bin/ &&
599603
GIT_EXEC_PATH= ./pretend/bin/git here >actual &&
600604
echo HERE >expect &&
601605
test_cmp expect actual'
602606

603607
test_expect_success !VALGRIND,RUNTIME_PREFIX,CAN_EXEC_IN_PWD '%(prefix)/ works' '
604-
mkdir -p pretend/bin &&
605-
cp "$GIT_EXEC_PATH"/git$X pretend/bin/ &&
606608
git config yes.path "%(prefix)/yes" &&
607609
GIT_EXEC_PATH= ./pretend/bin/git config --path yes.path >actual &&
608610
echo "$(pwd)/pretend/yes" >expect &&

0 commit comments

Comments
 (0)