git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[PATCH v2] t1301-shared-repo: Fix forced modes test, but it still shows a flaw

From
Johannes Sixt <j6t@kdbg.org>
Date
Apr 12, 2009, 19:22 UTC
Message-ID
<200904122122.03040.j6t@kdbg.org>
In-Reply-To
<49E10C55.1050005@kdbg.org>

This test was added recently (5a688fe, "core.sharedrepository = 0mode" should set, not loosen; 2009-03-28). It checked the result of a sed invocation for emptyness, but in some cases it forgot to print anything at all, so that those checks would never be false.

Due to this mistake, it went unnoticed that the files in objects/info are not necessarily 0440, but can also be 0640. This directory is now exempt from the check.

Moreover, COMMIT_EDITMSG is still world-readable. This is either a bug in git, or a flaw in the test (the first sed expression). This patch does not disambiguate these two cases, but only declares the test case as an expected failure.

Finally, this test cannot be run on Windows (requires POSIXPERM).
Signed-off-by: Johannes Sixt <j6t@kdbg.org>
---
Sorry, the first round was whitespace damaged for some reason.

I could now test the result on Linux, and, lo and behold, it shows a bug: Either in git, or in the test: COMMIT_EDITMSG is still world-readable, as is shown by the first sed expression that was fixed (2nd hunk).

-- Hannes
 t/t1301-shared-repo.sh |    8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/t/t1301-shared-repo.sh b/t/t1301-shared-repo.sh
index 750fbb3..71be308 100755
--- a/t/t1301-shared-repo.sh
+++ b/t/t1301-shared-repo.sh
@@ -126,7 +126,7 @@ test_expect_success POSIXPERM 'git reflog expire honors 
core.sharedRepository' '
 	esac
 '
 
-test_expect_success 'forced modes' '
+test_expect_failure POSIXPERM 'forced modes' '
 	mkdir -p templates/hooks &&
 	echo update-server-info >templates/hooks/post-update &&
 	chmod +x templates/hooks/post-update &&
@@ -145,7 +145,7 @@ test_expect_success 'forced modes' '
 	xargs ls -ld >actual &&
 
 	# Everything must be unaccessible to others
-	test -z "$(sed -n -e "/^.......---/d" actual)" &&
+	test -z "$(sed -e "/^.......---/d" actual)" &&
 
 	# All directories must have either 2770 or 770
 	test -z "$(sed -n -e "/^drwxrw[sx]---/d" -e "/^d/p" actual)" &&
@@ -156,10 +156,12 @@ test_expect_success 'forced modes' '
 		p
 	}" actual)" &&
 
-	# All files inside objects must be 0440
+	# All files inside objects (except objects/info) must be 0440
 	test -z "$(sed -n -e "/objects\//{
 		/^d/d
+		/info/d
 		/^-r--r-----/d
+		p
 	}" actual)"
 '
 
-- 
1.6.2.1.224.g2225f
Previous: Johannes SixtNext: Junio C Hamano
Message 2 of 3 in “t1301-shared-repo: Fix forced modes test”
  1. t1301-shared-repo: Fix forced modes testJohannes Sixt, Apr 11, 2009
  2. t1301-shared-repo: Fix forced modes test, but it still shows a flawJohannes Sixt, Apr 12, 2009
  3. Junio C HamanoApr 13, 2009

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.