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

Re: [PATCH] fix hang in git fetch if pointed at a 0 length bundle

From
Johannes Sixt <j6t@kdbg.org>
Date
Jan 3, 2012, 08:35 UTC
Message-ID
<4F02BDEC.9060407@kdbg.org>
In-Reply-To
<20120103011352.GA13825@localhost>
Am 03.01.2012 02:13, schrieb Brian Harring:
> git-repo if interupted at the exact wrong time will generate zero
> length bundles- literal empty files.  git-repo is wrong here, but
> git fetch shouldn't effectively spin loop if pointed at a zero
> length bundle.
Adding a test case is very much appreciated.
> +test_expect_success 'die if bundle file is empty' '
How about 'empty bundle file is rejected'?
> +
> +   echo -n > empty-bundle
'echo -n' is not portable; use simply
	>empty-bundle &&
(note the style: no blank after >). Also chain commands using &&.
> +   timeout 5 git fetch empty-bundle

Yes, there was an infinite loop. But we do not specifically protect our git invocations in the test suite against this sort of failure. Just write

	test_must_fail git fetch empty-bundle
and end the test case here.
Show 5 quoted lines
> +   ret=$?
> +   [ $ret == 128 ] && return 0
> +   return $ret
> +
> +'
Furthermore, indentation should be one tabstop, not blanks.
-- Hannes
Previous: Brian HarringNext: Nguyen Thai Ngoc Duy
Message 2 of 6 in “fix hang in git fetch if pointed at a 0 length bundle”
  1. fix hang in git fetch if pointed at a 0 length bundleBrian Harring, Jan 3, 2012
  2. Johannes SixtJan 3, 2012
  3. Nguyen Thai Ngoc DuyJan 3, 2012
  4. Junio C HamanoJan 3, 2012
  5. fix hang in git fetch if pointed at a 0 length bundleBrian Harring, Jan 3, 2012
  6. Junio C HamanoJan 3, 2012

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.