Skip to content

Commit 9024b10

Browse files
vangdfangdscho
authored andcommitted
pack-objects (mingw): demonstrate a segmentation fault with large deltas
There is a problem in the way 9ac3f0e (pack-objects: fix performance issues on packing large deltas, 2018-07-22) initializes that mutex in the `packing_data` struct. The problem manifests in a segmentation fault on Windows, when a mutex (AKA critical section) is accessed without being initialized. (With pthreads, you apparently do not really have to initialize them?) This was reported in #1839. Signed-off-by: Doug Kelly <[email protected]> Signed-off-by: Johannes Schindelin <[email protected]>
1 parent a12f7e2 commit 9024b10

File tree

1 file changed

+105
-0
lines changed

1 file changed

+105
-0
lines changed

t/t7422-submodule-long-path.sh

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,105 @@
1+
#!/bin/sh
2+
#
3+
# Copyright (c) 2013 Doug Kelly
4+
#
5+
6+
test_description='Test submodules with a path near PATH_MAX
7+
8+
This test verifies that "git submodule" initialization, update and clones work, including with recursive submodules and paths approaching PATH_MAX (260 characters on Windows)
9+
'
10+
11+
TEST_NO_CREATE_REPO=1
12+
. ./test-lib.sh
13+
14+
longpath=""
15+
for (( i=0; i<4; i++ )); do
16+
longpath="0123456789abcdefghijklmnopqrstuvwxyz$longpath"
17+
done
18+
# Pick a substring maximum of 90 characters
19+
# This should be good, since we'll add on a lot for temp directories
20+
longpath=${longpath:0:90}; export longpath
21+
22+
test_expect_failure 'submodule with a long path' '
23+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
24+
git -c init.defaultBranch=long init --bare remote &&
25+
test_create_repo bundle1 &&
26+
(
27+
cd bundle1 &&
28+
test_commit "shoot" &&
29+
git rev-parse --verify HEAD >../expect
30+
) &&
31+
mkdir home &&
32+
(
33+
cd home &&
34+
git clone ../remote test &&
35+
cd test &&
36+
git checkout -B long &&
37+
git submodule add ../bundle1 $longpath &&
38+
test_commit "sogood" &&
39+
(
40+
cd $longpath &&
41+
git rev-parse --verify HEAD >actual &&
42+
test_cmp ../../../expect actual
43+
) &&
44+
git push origin long
45+
) &&
46+
mkdir home2 &&
47+
(
48+
cd home2 &&
49+
git clone ../remote test &&
50+
cd test &&
51+
git checkout long &&
52+
git submodule update --init &&
53+
(
54+
cd $longpath &&
55+
git rev-parse --verify HEAD >actual &&
56+
test_cmp ../../../expect actual
57+
)
58+
)
59+
'
60+
61+
test_expect_failure 'recursive submodule with a long path' '
62+
GIT_TEST_DEFAULT_INITIAL_BRANCH_NAME= \
63+
git -c init.defaultBranch=long init --bare super &&
64+
test_create_repo child &&
65+
(
66+
cd child &&
67+
test_commit "shoot" &&
68+
git rev-parse --verify HEAD >../expect
69+
) &&
70+
test_create_repo parent &&
71+
(
72+
cd parent &&
73+
git submodule add ../child $longpath &&
74+
test_commit "aim"
75+
) &&
76+
mkdir home3 &&
77+
(
78+
cd home3 &&
79+
git clone ../super test &&
80+
cd test &&
81+
git checkout -B long &&
82+
git submodule add ../parent foo &&
83+
git submodule update --init --recursive &&
84+
test_commit "sogood" &&
85+
(
86+
cd foo/$longpath &&
87+
git rev-parse --verify HEAD >actual &&
88+
test_cmp ../../../../expect actual
89+
) &&
90+
git push origin long
91+
) &&
92+
mkdir home4 &&
93+
(
94+
cd home4 &&
95+
git clone ../super test --recursive &&
96+
(
97+
cd test/foo/$longpath &&
98+
git rev-parse --verify HEAD >actual &&
99+
test_cmp ../../../../expect actual
100+
)
101+
)
102+
'
103+
unset longpath
104+
105+
test_done

0 commit comments

Comments
 (0)