git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Add known breakage for 'git notes copy'
@ 2010-06-28  7:01 Bert Wesarg
  2010-06-28  8:59 ` Jeff King
  0 siblings, 1 reply; 5+ messages in thread
From: Bert Wesarg @ 2010-06-28  7:01 UTC (permalink / raw)
  To: Johan Herland; +Cc: Junio C Hamano, git, Bert Wesarg

'git notes copy' dumps core when no arguments are given.

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
 t/t3301-notes.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index 64f32ad..67b0cc2 100755 t/t3301-notes.sh
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -1044,4 +1044,9 @@ test_expect_success 'GIT_NOTES_REWRITE_REF overrides config' '
 	git log -1 > output &&
 	test_cmp expect output
 '
+
+test_expect_failure 'git notes copy segfaults' '
+	git notes copy
+'
+
 test_done
-- 
1.7.1.1067.g5aeb7

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add known breakage for 'git notes copy'
  2010-06-28  7:01 [PATCH] Add known breakage for 'git notes copy' Bert Wesarg
@ 2010-06-28  8:59 ` Jeff King
  2010-06-28  9:12   ` Bert Wesarg
  0 siblings, 1 reply; 5+ messages in thread
From: Jeff King @ 2010-06-28  8:59 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Johan Herland, Junio C Hamano, git

On Mon, Jun 28, 2010 at 09:01:57AM +0200, Bert Wesarg wrote:

> 'git notes copy' dumps core when no arguments are given.

How about:

-- >8 --
Subject: [PATCH] notes: check number of parameters to "git notes copy"

Otherwise we may segfault with too few parameters.

Signed-off-by: Jeff King <peff@peff.net>
---
 builtin/notes.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/builtin/notes.c b/builtin/notes.c
index f1f53a8..190005f 100644
--- a/builtin/notes.c
+++ b/builtin/notes.c
@@ -613,8 +613,12 @@ static int copy(int argc, const char **argv, const char *prefix)
 			return notes_copy_from_stdin(force, rewrite_cmd);
 		}
 	}
 
+	if (argc < 2) {
+		error("too few parameters");
+		usage_with_options(git_notes_copy_usage, options);
+	}
 	if (2 < argc) {
 		error("too many parameters");
 		usage_with_options(git_notes_copy_usage, options);
 	}
-- 
1.7.1.777.gd07fd

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add known breakage for 'git notes copy'
  2010-06-28  8:59 ` Jeff King
@ 2010-06-28  9:12   ` Bert Wesarg
  2010-06-28 15:44     ` Jacob Helwig
  2010-06-28 22:48     ` Johan Herland
  0 siblings, 2 replies; 5+ messages in thread
From: Bert Wesarg @ 2010-06-28  9:12 UTC (permalink / raw)
  To: Jeff King; +Cc: Johan Herland, Junio C Hamano, git

On Mon, Jun 28, 2010 at 10:59, Jeff King <peff@peff.net> wrote:
> On Mon, Jun 28, 2010 at 09:01:57AM +0200, Bert Wesarg wrote:
>
>> 'git notes copy' dumps core when no arguments are given.
>
> How about:

Thanks.

Tested-by: Bert Wesarg <Bert.Wesarg@googlemail.com>

FWIW, here is the correct and updated test for this:

-- >8 --
Subject: [PATCH] notes: add test for git-notes copy with too few arguments

Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
---
 t/t3301-notes.sh |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
index 64f32ad..dcd962a 100755 t/t3301-notes.sh
--- a/t/t3301-notes.sh
+++ b/t/t3301-notes.sh
@@ -1044,4 +1044,9 @@ test_expect_success 'GIT_NOTES_REWRITE_REF
overrides config' '
 	git log -1 > output &&
 	test_cmp expect output
 '
+
+test_expect_success 'git notes copy does not segfaults with too few
arguments' '
+	test_must_fail git notes copy
+'
+
 test_done

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add known breakage for 'git notes copy'
  2010-06-28  9:12   ` Bert Wesarg
@ 2010-06-28 15:44     ` Jacob Helwig
  2010-06-28 22:48     ` Johan Herland
  1 sibling, 0 replies; 5+ messages in thread
From: Jacob Helwig @ 2010-06-28 15:44 UTC (permalink / raw)
  To: Bert Wesarg; +Cc: Jeff King, Johan Herland, Junio C Hamano, git

On Mon, Jun 28, 2010 at 02:12, Bert Wesarg <bert.wesarg@googlemail.com> wrote:
> On Mon, Jun 28, 2010 at 10:59, Jeff King <peff@peff.net> wrote:
>> On Mon, Jun 28, 2010 at 09:01:57AM +0200, Bert Wesarg wrote:
>>
>>> 'git notes copy' dumps core when no arguments are given.
>>
>> How about:
>
> Thanks.
>
> Tested-by: Bert Wesarg <Bert.Wesarg@googlemail.com>
>
> FWIW, here is the correct and updated test for this:
>
> -- >8 --
> Subject: [PATCH] notes: add test for git-notes copy with too few arguments
>
> Signed-off-by: Bert Wesarg <bert.wesarg@googlemail.com>
> ---
>  t/t3301-notes.sh |    5 +++++
>  1 files changed, 5 insertions(+), 0 deletions(-)
>
> diff --git a/t/t3301-notes.sh b/t/t3301-notes.sh
> index 64f32ad..dcd962a 100755 t/t3301-notes.sh
> --- a/t/t3301-notes.sh
> +++ b/t/t3301-notes.sh
> @@ -1044,4 +1044,9 @@ test_expect_success 'GIT_NOTES_REWRITE_REF
> overrides config' '
>        git log -1 > output &&
>        test_cmp expect output
>  '
> +
> +test_expect_success 'git notes copy does not segfaults with too few
> arguments' '
> +       test_must_fail git notes copy
> +'
> +
>  test_done
>

Minor nit: s/does not segfaults/does not segfault/

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Add known breakage for 'git notes copy'
  2010-06-28  9:12   ` Bert Wesarg
  2010-06-28 15:44     ` Jacob Helwig
@ 2010-06-28 22:48     ` Johan Herland
  1 sibling, 0 replies; 5+ messages in thread
From: Johan Herland @ 2010-06-28 22:48 UTC (permalink / raw)
  To: git; +Cc: Bert Wesarg, Jeff King, Junio C Hamano

On Monday 28 June 2010, Bert Wesarg wrote:
> On Mon, Jun 28, 2010 at 10:59, Jeff King <peff@peff.net> wrote:
> > On Mon, Jun 28, 2010 at 09:01:57AM +0200, Bert Wesarg wrote:
> >> 'git notes copy' dumps core when no arguments are given.
> > 
> > How about:
> Thanks.
> 
> Tested-by: Bert Wesarg <Bert.Wesarg@googlemail.com>
> 
> FWIW, here is the correct and updated test for this:

ACK on both patches.


...Johan

-- 
Johan Herland, <johan@herland.net>
www.herland.net

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2010-06-28 22:49 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-28  7:01 [PATCH] Add known breakage for 'git notes copy' Bert Wesarg
2010-06-28  8:59 ` Jeff King
2010-06-28  9:12   ` Bert Wesarg
2010-06-28 15:44     ` Jacob Helwig
2010-06-28 22:48     ` Johan Herland

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).