Skip to content

Commit 5610e3b

Browse files
committed
Fix testcase failure when extended attributes are in use
06cbe85 (Make core.sharedRepository more generic, 2008-04-16) made several testcases in t1301-shared-repo.sh which fail if on a system which creates files with extended attributes (e.g. SELinux), since ls appends a '+' sign to the permission set in such cases. In fact, POSIX.1 allows ls to add a single printable character after the usual 3x3 permission bits to show that an optional alternate/additional access method is associated with the path. This fixes the testcase to strip any such sign prior to verifying the permission set. Signed-off-by: Junio C Hamano <[email protected]> Tested-by: Deskin Miller <[email protected]>
1 parent 09cff06 commit 5610e3b

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

t/t1301-shared-repo.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,10 @@ test_expect_success 'shared = 0400 (faulty permission u-w)' '
2020
test $ret != "0"
2121
'
2222

23+
modebits () {
24+
ls -l "$1" | sed -e 's|^\(..........\).*|\1|'
25+
}
26+
2327
for u in 002 022
2428
do
2529
test_expect_success "shared=1 does not clear bits preset by umask $u" '
@@ -85,8 +89,7 @@ do
8589
8690
rm -f .git/info/refs &&
8791
git update-server-info &&
88-
actual="$(ls -l .git/info/refs)" &&
89-
actual=${actual%% *} &&
92+
actual="$(modebits .git/info/refs)" &&
9093
test "x$actual" = "x-$y" || {
9194
ls -lt .git/info
9295
false
@@ -98,8 +101,7 @@ do
98101
99102
rm -f .git/info/refs &&
100103
git update-server-info &&
101-
actual="$(ls -l .git/info/refs)" &&
102-
actual=${actual%% *} &&
104+
actual="$(modebits .git/info/refs)" &&
103105
test "x$actual" = "x-$x" || {
104106
ls -lt .git/info
105107
false

0 commit comments

Comments
 (0)