unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH 1/2] tag: Disallow adding malformed tags to messages
@ 2012-10-26 20:54 Austin Clements
  2012-10-26 20:54 ` [PATCH 2/2] News for restrictions on tag names Austin Clements
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Austin Clements @ 2012-10-26 20:54 UTC (permalink / raw)
  To: notmuch

This disallows adding empty tags, since nothing but confusion follows
in their wake, and disallows adding tags that begin with "-" because
they are also confusing, the tag "-" is impossible to remove using the
CLI, and because the syntax for removing such tags conflicts with long
argument syntax.

This does not place any restrictions on what tags can be removed, as
that would make it difficult for people who have the misfortune of
already having malformed tags to remove these tags.
---
 notmuch-tag.c |   11 +++++++++++
 test/tagging  |    4 ++++
 2 files changed, 15 insertions(+)

diff --git a/notmuch-tag.c b/notmuch-tag.c
index 7d18639..d15f1ed 100644
--- a/notmuch-tag.c
+++ b/notmuch-tag.c
@@ -203,6 +203,17 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])
 	    break;
 	}
 	if (argv[i][0] == '+' || argv[i][0] == '-') {
+	    if (argv[i][0] == '+' && argv[i][1] == '\0') {
+		fprintf(stderr, "Error: tag names cannot be empty.\n");
+		return 1;
+	    }
+	    if (argv[i][0] == '+' && argv[i][1] == '-') {
+		/* This disallows adding the non-removable tag "-" and
+		 * enables notmuch tag to take long options in the
+		 * future. */
+		fprintf(stderr, "Error: tag names must not start with '-'.\n");
+		return 1;
+	    }
 	    tag_ops[tag_ops_count].tag = argv[i] + 1;
 	    tag_ops[tag_ops_count].remove = (argv[i][0] == '-');
 	    tag_ops_count++;
diff --git a/test/tagging b/test/tagging
index e4782ed..980ff92 100755
--- a/test/tagging
+++ b/test/tagging
@@ -46,4 +46,8 @@ test_expect_equal "$output" "\
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (:\"  inbox tag1 unread)
 thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)"
 
+test_expect_code 1 "Empty tag names" 'notmuch tag + One'
+
+test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
+
 test_done
-- 
1.7.10

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

* [PATCH 2/2] News for restrictions on tag names
  2012-10-26 20:54 [PATCH 1/2] tag: Disallow adding malformed tags to messages Austin Clements
@ 2012-10-26 20:54 ` Austin Clements
  2012-10-26 21:17 ` [PATCH 1/2] tag: Disallow adding malformed tags to messages Tomi Ollila
  2012-10-27 12:45 ` David Bremner
  2 siblings, 0 replies; 5+ messages in thread
From: Austin Clements @ 2012-10-26 20:54 UTC (permalink / raw)
  To: notmuch

---
 NEWS |   14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/NEWS b/NEWS
index 2b50ba3..ebd5c1e 100644
--- a/NEWS
+++ b/NEWS
@@ -1,3 +1,17 @@
+Notmuch 0.15 (YYYY-MM-DD)
+=========================
+
+Command-Line Interface
+----------------------
+
+Empty tag names and tags beginning with "-" are deprecated
+
+  Such tags have been a frequent source of confusion and cause
+  (sometimes unresolvable) conflicts with other syntax.  notmuch tag
+  no longer allows such tags to be added to messages.  Removing such
+  tags continues to be supported to allow cleanup of existing tags,
+  but may be removed in a future release.
+
 Notmuch 0.14 (2012-08-20)
 =========================
 
-- 
1.7.10

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

* Re: [PATCH 1/2] tag: Disallow adding malformed tags to messages
  2012-10-26 20:54 [PATCH 1/2] tag: Disallow adding malformed tags to messages Austin Clements
  2012-10-26 20:54 ` [PATCH 2/2] News for restrictions on tag names Austin Clements
@ 2012-10-26 21:17 ` Tomi Ollila
  2012-10-27  5:16   ` Ethan Glasser-Camp
  2012-10-27 12:45 ` David Bremner
  2 siblings, 1 reply; 5+ messages in thread
From: Tomi Ollila @ 2012-10-26 21:17 UTC (permalink / raw)
  To: Austin Clements, notmuch

On Fri, Oct 26 2012, Austin Clements wrote:

> This disallows adding empty tags, since nothing but confusion follows
> in their wake, and disallows adding tags that begin with "-" because
> they are also confusing, the tag "-" is impossible to remove using the
> CLI, and because the syntax for removing such tags conflicts with long
> argument syntax.
>
> This does not place any restrictions on what tags can be removed, as
> that would make it difficult for people who have the misfortune of
> already having malformed tags to remove these tags.
> ---

LGTM (NEWS too)

Tomi


>  notmuch-tag.c |   11 +++++++++++
>  test/tagging  |    4 ++++
>  2 files changed, 15 insertions(+)
>
> diff --git a/notmuch-tag.c b/notmuch-tag.c
> index 7d18639..d15f1ed 100644
> --- a/notmuch-tag.c
> +++ b/notmuch-tag.c
> @@ -203,6 +203,17 @@ notmuch_tag_command (void *ctx, int argc, char *argv[])
>  	    break;
>  	}
>  	if (argv[i][0] == '+' || argv[i][0] == '-') {
> +	    if (argv[i][0] == '+' && argv[i][1] == '\0') {
> +		fprintf(stderr, "Error: tag names cannot be empty.\n");
> +		return 1;
> +	    }
> +	    if (argv[i][0] == '+' && argv[i][1] == '-') {
> +		/* This disallows adding the non-removable tag "-" and
> +		 * enables notmuch tag to take long options in the
> +		 * future. */
> +		fprintf(stderr, "Error: tag names must not start with '-'.\n");
> +		return 1;
> +	    }
>  	    tag_ops[tag_ops_count].tag = argv[i] + 1;
>  	    tag_ops[tag_ops_count].remove = (argv[i][0] == '-');
>  	    tag_ops_count++;
> diff --git a/test/tagging b/test/tagging
> index e4782ed..980ff92 100755
> --- a/test/tagging
> +++ b/test/tagging
> @@ -46,4 +46,8 @@ test_expect_equal "$output" "\
>  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; One (:\"  inbox tag1 unread)
>  thread:XXX   2001-01-05 [1/1] Notmuch Test Suite; Two (inbox tag1 tag4 unread)"
>  
> +test_expect_code 1 "Empty tag names" 'notmuch tag + One'
> +
> +test_expect_code 1 "Tag name beginning with -" 'notmuch tag +- One'
> +
>  test_done
> -- 
> 1.7.10
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH 1/2] tag: Disallow adding malformed tags to messages
  2012-10-26 21:17 ` [PATCH 1/2] tag: Disallow adding malformed tags to messages Tomi Ollila
@ 2012-10-27  5:16   ` Ethan Glasser-Camp
  0 siblings, 0 replies; 5+ messages in thread
From: Ethan Glasser-Camp @ 2012-10-27  5:16 UTC (permalink / raw)
  To: Tomi Ollila, Austin Clements, notmuch

Tomi Ollila <tomi.ollila@iki.fi> writes:

> LGTM (NEWS too)

Yep! Removing needs-review.

Ethan

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

* Re: [PATCH 1/2] tag: Disallow adding malformed tags to messages
  2012-10-26 20:54 [PATCH 1/2] tag: Disallow adding malformed tags to messages Austin Clements
  2012-10-26 20:54 ` [PATCH 2/2] News for restrictions on tag names Austin Clements
  2012-10-26 21:17 ` [PATCH 1/2] tag: Disallow adding malformed tags to messages Tomi Ollila
@ 2012-10-27 12:45 ` David Bremner
  2 siblings, 0 replies; 5+ messages in thread
From: David Bremner @ 2012-10-27 12:45 UTC (permalink / raw)
  To: Austin Clements, notmuch

Austin Clements <amdragon@MIT.EDU> writes:

> This disallows adding empty tags, since nothing but confusion follows
> in their wake, and disallows adding tags that begin with "-" because
> they are also confusing, the tag "-" is impossible to remove using the
> CLI, and because the syntax for removing such tags conflicts with long
> argument syntax.

Pushed both,

d

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

end of thread, other threads:[~2012-10-27 12:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-10-26 20:54 [PATCH 1/2] tag: Disallow adding malformed tags to messages Austin Clements
2012-10-26 20:54 ` [PATCH 2/2] News for restrictions on tag names Austin Clements
2012-10-26 21:17 ` [PATCH 1/2] tag: Disallow adding malformed tags to messages Tomi Ollila
2012-10-27  5:16   ` Ethan Glasser-Camp
2012-10-27 12:45 ` David Bremner

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