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

Re: [RFC PATCH 2/2] object-file API: have unpack_loose_header() return "int" again

From
Junio C Hamano <gitster@pobox.com>
Date
May 20, 2022, 04:27 UTC
Message-ID
<xmqq35h4ltfz.fsf@gitster.g>
In-Reply-To
<RFC-patch-2.2-af0dfd017af-20220519T195055Z-avarab@gmail.com>
Ævar Arnfjörð Bjarmason  <avarab@gmail.com> writes:
> +int unpack_loose_header(git_zstream *stream, unsigned char *map,
> +			unsigned long mapsize, void *buffer,
> +			unsigned long bufsiz, struct strbuf *header);
Simpler is better as long as we don't make it too simple ;-)
>  	if (!header)
> -		return ULHR_TOO_LONG;
> +		return error(_("header too long, exceeds %d bytes"),
> +			     MAX_HEADER_LEN);
OK.
> -	return ULHR_BAD;
> +	return error(_("could not find end of corrupt long header"));
>  }
OK.
Show 21 quoted lines
> diff --git a/t/t1006-cat-file.sh b/t/t1006-cat-file.sh
> index dadf3b14583..d742697d3bf 100755
> --- a/t/t1006-cat-file.sh
> +++ b/t/t1006-cat-file.sh
> @@ -536,12 +536,14 @@ do
>  			if test "$arg2" = "-p"
>  			then
>  				cat >expect <<-EOF
> -				error: header for $bogus_long_sha1 too long, exceeds 32 bytes
> +				error: header too long, exceeds 32 bytes
> +				error: unable to unpack $bogus_long_sha1 header
>  				fatal: Not a valid object name $bogus_long_sha1
>  				EOF
>  			else
>  				cat >expect <<-EOF
> -				error: header for $bogus_long_sha1 too long, exceeds 32 bytes
> +				error: header too long, exceeds 32 bytes
> +				error: unable to unpack $bogus_long_sha1 header
>  				fatal: git cat-file: could not get object info
>  				EOF
>  			fi &&
Looking good.
Previous: Ævar Arnfjörð BjarmasonNext: Junio C Hamano
Message 19 of 20 in “Fix issues and a regression noted by valgrind”
  1. 0/4 Fix issues and a regression noted by valgrindÆvar Arnfjörð Bjarmason, Apr 21, 2022
  2. 1/4 tests: make RUNTIME_PREFIX compatible with --valgrindÆvar Arnfjörð Bjarmason, Apr 21, 2022
  3. Junio C HamanoApr 21, 2022
  4. 2/4 log test: skip a failing mkstemp() test under valgrindÆvar Arnfjörð Bjarmason, Apr 21, 2022
  5. 3/4 commit-graph.c: don't assume that stat() succeedsÆvar Arnfjörð Bjarmason, Apr 21, 2022
  6. Junio C HamanoApr 21, 2022
  7. 4/4 object-file: fix a unpack_loose_header() regression in 3b6a8db3b03Ævar Arnfjörð Bjarmason, Apr 21, 2022
  8. Junio C HamanoApr 21, 2022
  9. Ævar Arnfjörð BjarmasonApr 22, 2022
  10. 0/4 test fixes around valgrindJunio C Hamano, May 12, 2022
  11. 1/4 tests: using custom GIT_EXEC_PATH breaks --valgrind testsJunio C Hamano, May 12, 2022
  12. 2/4 log test: skip a failing mkstemp() test under valgrindJunio C Hamano, May 12, 2022
  13. 4/4 object-file: fix a unpack_loose_header() regression in 3b6a8db3b03Junio C Hamano, May 12, 2022
  14. Junio C HamanoMay 12, 2022
  15. Derrick StoleeMay 16, 2022
  16. 0/2 Alternate ab/valgrind-fixes fix-upÆvar Arnfjörð Bjarmason, May 19, 2022
  17. 1/2 object-file API: fix obscure unpack_loose_header() returnÆvar Arnfjörð Bjarmason, May 19, 2022
  18. 2/2 object-file API: have unpack_loose_header() return "int" againÆvar Arnfjörð Bjarmason, May 19, 2022
  19. Junio C HamanoMay 20, 2022
  20. 3/4 commit-graph.c: don't assume that stat() succeedsJunio C Hamano, May 12, 2022

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.