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

Re: [PATCH 4/4] upload-pack: only accept packfile-uris if we advertised it

From
Jeff King <peff@peff.net>
Date
Feb 29, 2024, 05:42 UTC
Message-ID
<20240229054239.GA1669526@coredump.intra.peff.net>
In-Reply-To
<20240228225050.GA1159078@coredump.intra.peff.net>
On Wed, Feb 28, 2024 at 05:50:50PM -0500, Jeff King wrote:
Show 25 quoted lines
> diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
> index 6ef4971845..902e42c1c0 100755
> --- a/t/t5702-protocol-v2.sh
> +++ b/t/t5702-protocol-v2.sh
> @@ -778,6 +778,24 @@ test_expect_success 'archive with custom path does not request v2' '
>  	! grep ^GIT_PROTOCOL env.trace
>  '
>  
> +test_expect_success 'reject client packfile-uris if not advertised' '
> +	{
> +		packetize command=fetch &&
> +		printf 0001 &&
> +		packetize packfile-uris https &&
> +		packetize done &&
> +		printf 0000
> +	} >input &&
> +	test_must_fail env GIT_PROTOCOL=version=2 \
> +		git upload-pack client <input &&
> +	test_must_fail env GIT_PROTOCOL=version=2 \
> +		git -c uploadpack.blobpackfileuri \
> +		upload-pack client <input &&
> +	GIT_PROTOCOL=version=2 \
> +		git -c uploadpack.blobpackfileuri=anything \
> +		upload-pack client <input
> +'
Sorry, this needs one tweak to pass under the sha256 CI job:
diff --git a/t/t5702-protocol-v2.sh b/t/t5702-protocol-v2.sh
index 902e42c1c0..1ef540f73d 100755
--- a/t/t5702-protocol-v2.sh
+++ b/t/t5702-protocol-v2.sh
@@ -781,6 +781,7 @@ test_expect_success 'archive with custom path does not request v2' '
 test_expect_success 'reject client packfile-uris if not advertised' '
 	{
 		packetize command=fetch &&
+		packetize object-format=$(test_oid algo) &&
 		printf 0001 &&
 		packetize packfile-uris https &&
 		packetize done &&

Otherwise the server complains that the other side did not respect its
advertised object-format (I sure am glad to have included the final
"hey, this input works, right?" test there, as that is what caught it).

-Peff
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 15 in “some v2 capability advertisement cleanups”
  1. 0/4 some v2 capability advertisement cleanupsJeff King, Feb 28, 2024
  2. 1/4 upload-pack: use repository struct to get configJeff King, Feb 28, 2024
  3. Patrick SteinhardtMar 4, 2024
  4. 2/4 upload-pack: centralize setup of sideband-all configJeff King, Feb 28, 2024
  5. 3/4 upload-pack: use existing config mechanism for advertisementJeff King, Feb 28, 2024
  6. 4/4 upload-pack: only accept packfile-uris if we advertised itJeff King, Feb 28, 2024
  7. Junio C HamanoFeb 28, 2024
  8. Jeff KingFeb 29, 2024
  9. Junio C HamanoFeb 29, 2024
  10. Jeff KingMar 1, 2024
  11. Patrick SteinhardtMar 4, 2024
  12. Junio C HamanoFeb 28, 2024
  13. Jeff KingFeb 29, 2024
  14. Patrick SteinhardtMar 4, 2024
  15. Jeff KingMar 4, 2024

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.