git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Johannes Sixt <j6t@kdbg.org>
To: Brian Harring <ferringb@gmail.com>
Cc: git@vger.kernel.org, spearce@spearce.org
Subject: Re: [PATCH] fix hang in git fetch if pointed at a 0 length bundle
Date: Tue, 03 Jan 2012 09:35:56 +0100	[thread overview]
Message-ID: <4F02BDEC.9060407@kdbg.org> (raw)
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.

> +   ret=$?
> +   [ $ret == 128 ] && return 0
> +   return $ret
> +
> +'

Furthermore, indentation should be one tabstop, not blanks.

-- Hannes

  reply	other threads:[~2012-01-03  8:36 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-03  1:13 [PATCH] fix hang in git fetch if pointed at a 0 length bundle Brian Harring
2012-01-03  8:35 ` Johannes Sixt [this message]
2012-01-03 12:07 ` Nguyen Thai Ngoc Duy
2012-01-03 20:11   ` Junio C Hamano
2012-01-03 13:46 ` Brian Harring
2012-01-03 20:13   ` Junio C Hamano

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F02BDEC.9060407@kdbg.org \
    --to=j6t@kdbg.org \
    --cc=ferringb@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=spearce@spearce.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).