unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] CLI: update call to notmuch_help_command for new calling conventions.
@ 2011-11-24 20:02 David Bremner
  2011-11-24 21:20 ` Tomi Ollila
  2011-11-25 18:36 ` [PATCH] test: add simple tests for online help David Bremner
  0 siblings, 2 replies; 4+ messages in thread
From: David Bremner @ 2011-11-24 20:02 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

When I changed the calling convention to pass in all but the zero-th
argument to subcommands, I missed this one call, resulting in a
segmentation fault.
---
 notmuch.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/notmuch.c b/notmuch.c
index 77973f8..d44ce9a 100644
--- a/notmuch.c
+++ b/notmuch.c
@@ -621,7 +621,7 @@ main (int argc, char *argv[])
 	return notmuch (local);
 
     if (STRNCMP_LITERAL (argv[1], "--help") == 0)
-	return notmuch_help_command (NULL, 0, NULL);
+	return notmuch_help_command (NULL, argc - 1, &argv[1]);
 
     if (STRNCMP_LITERAL (argv[1], "--version") == 0) {
 	printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");
-- 
1.7.5.4

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

* Re: [PATCH] CLI: update call to notmuch_help_command for new calling conventions.
  2011-11-24 20:02 [PATCH] CLI: update call to notmuch_help_command for new calling conventions David Bremner
@ 2011-11-24 21:20 ` Tomi Ollila
  2011-11-25 18:36 ` [PATCH] test: add simple tests for online help David Bremner
  1 sibling, 0 replies; 4+ messages in thread
From: Tomi Ollila @ 2011-11-24 21:20 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: David Bremner

On Thu, 24 Nov 2011 16:02:41 -0400, David Bremner <david@tethera.net> wrote:
> From: David Bremner <bremner@debian.org>
> 
> When I changed the calling convention to pass in all but the zero-th
> argument to subcommands, I missed this one call, resulting in a
> segmentation fault.

LGTM, is analogous to other 'argc -1, &argv[1]' uses and seems to work
on top of notmuch 0.10+21~gae7814b

Tomi

> ---
>  notmuch.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/notmuch.c b/notmuch.c
> index 77973f8..d44ce9a 100644
> --- a/notmuch.c
> +++ b/notmuch.c
> @@ -621,7 +621,7 @@ main (int argc, char *argv[])
>  	return notmuch (local);
>  
>      if (STRNCMP_LITERAL (argv[1], "--help") == 0)
> -	return notmuch_help_command (NULL, 0, NULL);
> +	return notmuch_help_command (NULL, argc - 1, &argv[1]);
>  
>      if (STRNCMP_LITERAL (argv[1], "--version") == 0) {
>  	printf ("notmuch " STRINGIFY(NOTMUCH_VERSION) "\n");
> -- 
> 1.7.5.4
> 
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch
> 

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

* [PATCH] test: add simple tests for online help
  2011-11-24 20:02 [PATCH] CLI: update call to notmuch_help_command for new calling conventions David Bremner
  2011-11-24 21:20 ` Tomi Ollila
@ 2011-11-25 18:36 ` David Bremner
  2011-11-26 18:14   ` Jani Nikula
  1 sibling, 1 reply; 4+ messages in thread
From: David Bremner @ 2011-11-25 18:36 UTC (permalink / raw)
  To: notmuch; +Cc: David Bremner

From: David Bremner <bremner@debian.org>

Nothing fancy, but we can at least detect segmentation faults.
---
I think Jani was just making fun of me when he suggested tests for notmuch --help, but I thought, why not.

 test/help-test    |   12 ++++++++++++
 test/notmuch-test |    1 +
 2 files changed, 13 insertions(+), 0 deletions(-)
 create mode 100755 test/help-test

diff --git a/test/help-test b/test/help-test
new file mode 100755
index 0000000..9f4b9c7
--- /dev/null
+++ b/test/help-test
@@ -0,0 +1,12 @@
+#!/usr/bin/env bash
+
+test_description="online help"
+. test-lib.sh
+
+test_expect_success 'notmuch --help' 'notmuch --help'
+test_expect_success 'notmuch --help tag' 'notmuch --help tag'
+test_expect_success 'notmuch help' 'notmuch help'
+test_expect_success 'notmuch help tag' 'notmuch help tag'
+test_expect_success 'notmuch --version' 'notmuch --version'
+
+test_done
diff --git a/test/notmuch-test b/test/notmuch-test
index adfd589..5aced5c 100755
--- a/test/notmuch-test
+++ b/test/notmuch-test
@@ -18,6 +18,7 @@ cd $(dirname "$0")
 
 TESTS="
   basic
+  help-test
   new
   count
   search
-- 
1.7.5.4

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

* Re: [PATCH] test: add simple tests for online help
  2011-11-25 18:36 ` [PATCH] test: add simple tests for online help David Bremner
@ 2011-11-26 18:14   ` Jani Nikula
  0 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2011-11-26 18:14 UTC (permalink / raw)
  To: David Bremner, notmuch; +Cc: David Bremner

On Fri, 25 Nov 2011 13:36:26 -0500, David Bremner <david@tethera.net> wrote:
> I think Jani was just making fun of me when he suggested tests for
> notmuch --help, but I thought, why not.

Heh, I was only half joking - it is certainly good practice to create
tests for any bugs found and fixed. It's a bit embarrassing to have
--help segfault, but even more so to have it reappear in the future!
Good job.

Jani.

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

end of thread, other threads:[~2011-11-26 18:14 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-24 20:02 [PATCH] CLI: update call to notmuch_help_command for new calling conventions David Bremner
2011-11-24 21:20 ` Tomi Ollila
2011-11-25 18:36 ` [PATCH] test: add simple tests for online help David Bremner
2011-11-26 18:14   ` Jani Nikula

Code repositories for project(s) associated with this public inbox

	https://yhetil.org/notmuch.git/

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 read-only IMAP folder(s) and NNTP newsgroup(s).