unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] lib: drop the deprecation message for single-message mbox files
@ 2014-11-23 11:15 Jani Nikula
  2014-11-23 11:42 ` Tomi Ollila
  2015-01-01 15:53 ` David Bremner
  0 siblings, 2 replies; 3+ messages in thread
From: Jani Nikula @ 2014-11-23 11:15 UTC (permalink / raw)
  To: notmuch

We generally do not support mbox files, but for historical reasons
we've supported single-message mbox files, with a deprecation
message. We've tried dropping the support altogether, but backed out
of it because we'd need to stop indexing them, while keeping support
for previously indexed files. This would be more complicated than
simply supporting single-message mbox files. Therefore, drop the
deprecation message, and just silently accept single-message mboxes.
---
 lib/message-file.c | 21 ++++-----------------
 test/T050-new.sh   |  6 +-----
 2 files changed, 5 insertions(+), 22 deletions(-)

diff --git a/lib/message-file.c b/lib/message-file.c
index eda1b748e202..a41d9ad2a719 100644
--- a/lib/message-file.c
+++ b/lib/message-file.c
@@ -170,25 +170,12 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
 	goto DONE;
     }
 
-    if (is_mbox) {
-	if (! g_mime_parser_eos (parser)) {
-	    /* This is a multi-message mbox. */
-	    status = NOTMUCH_STATUS_FILE_NOT_EMAIL;
-	    goto DONE;
-	}
+    if (is_mbox && ! g_mime_parser_eos (parser)) {
 	/*
-	 * For historical reasons, we support single-message mboxes,
-	 * but this behavior is likely to change in the future, so
-	 * warn.
+	 * This is a multi-message mbox. (For historical reasons, we
+	 * do support single-message mboxes.)
 	 */
-	static notmuch_bool_t mbox_warning = FALSE;
-	if (! mbox_warning) {
-	    mbox_warning = TRUE;
-	    fprintf (stderr, "\
-Warning: %s is an mbox containing a single message,\n\
-likely caused by misconfigured mail delivery.  Support for single-message\n\
-mboxes is deprecated and may be removed in the future.\n", message->filename);
-	}
+	status = NOTMUCH_STATUS_FILE_NOT_EMAIL;
     }
 
   DONE:
diff --git a/test/T050-new.sh b/test/T050-new.sh
index ad46ee6d51b6..7119356fc9fe 100755
--- a/test/T050-new.sh
+++ b/test/T050-new.sh
@@ -173,11 +173,7 @@ Subject: Test mbox message 1
 Body.
 EOF
 output=$(NOTMUCH_NEW 2>&1)
-test_expect_equal "$output" \
-"Warning: ${MAIL_DIR}/mbox_file1 is an mbox containing a single message,
-likely caused by misconfigured mail delivery.  Support for single-message
-mboxes is deprecated and may be removed in the future.
-Added 1 new message to the database."
+test_expect_equal "$output" "Added 1 new message to the database."
 
 # This test requires that notmuch new has been run at least once.
 test_begin_subtest "Skip and report non-mail files"
-- 
2.1.3

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

* Re: [PATCH] lib: drop the deprecation message for single-message mbox files
  2014-11-23 11:15 [PATCH] lib: drop the deprecation message for single-message mbox files Jani Nikula
@ 2014-11-23 11:42 ` Tomi Ollila
  2015-01-01 15:53 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: Tomi Ollila @ 2014-11-23 11:42 UTC (permalink / raw)
  To: Jani Nikula, notmuch

On Sun, Nov 23 2014, Jani Nikula wrote:

> We generally do not support mbox files, but for historical reasons
> we've supported single-message mbox files, with a deprecation
> message. We've tried dropping the support altogether, but backed out
> of it because we'd need to stop indexing them, while keeping support
> for previously indexed files. This would be more complicated than
> simply supporting single-message mbox files. Therefore, drop the
> deprecation message, and just silently accept single-message mboxes.
> ---

LGTM. Tests pass. +1

Tomi

>  lib/message-file.c | 21 ++++-----------------
>  test/T050-new.sh   |  6 +-----
>  2 files changed, 5 insertions(+), 22 deletions(-)
>
> diff --git a/lib/message-file.c b/lib/message-file.c
> index eda1b748e202..a41d9ad2a719 100644
> --- a/lib/message-file.c
> +++ b/lib/message-file.c
> @@ -170,25 +170,12 @@ _notmuch_message_file_parse (notmuch_message_file_t *message)
>  	goto DONE;
>      }
>  
> -    if (is_mbox) {
> -	if (! g_mime_parser_eos (parser)) {
> -	    /* This is a multi-message mbox. */
> -	    status = NOTMUCH_STATUS_FILE_NOT_EMAIL;
> -	    goto DONE;
> -	}
> +    if (is_mbox && ! g_mime_parser_eos (parser)) {
>  	/*
> -	 * For historical reasons, we support single-message mboxes,
> -	 * but this behavior is likely to change in the future, so
> -	 * warn.
> +	 * This is a multi-message mbox. (For historical reasons, we
> +	 * do support single-message mboxes.)
>  	 */
> -	static notmuch_bool_t mbox_warning = FALSE;
> -	if (! mbox_warning) {
> -	    mbox_warning = TRUE;
> -	    fprintf (stderr, "\
> -Warning: %s is an mbox containing a single message,\n\
> -likely caused by misconfigured mail delivery.  Support for single-message\n\
> -mboxes is deprecated and may be removed in the future.\n", message->filename);
> -	}
> +	status = NOTMUCH_STATUS_FILE_NOT_EMAIL;
>      }
>  
>    DONE:
> diff --git a/test/T050-new.sh b/test/T050-new.sh
> index ad46ee6d51b6..7119356fc9fe 100755
> --- a/test/T050-new.sh
> +++ b/test/T050-new.sh
> @@ -173,11 +173,7 @@ Subject: Test mbox message 1
>  Body.
>  EOF
>  output=$(NOTMUCH_NEW 2>&1)
> -test_expect_equal "$output" \
> -"Warning: ${MAIL_DIR}/mbox_file1 is an mbox containing a single message,
> -likely caused by misconfigured mail delivery.  Support for single-message
> -mboxes is deprecated and may be removed in the future.
> -Added 1 new message to the database."
> +test_expect_equal "$output" "Added 1 new message to the database."
>  
>  # This test requires that notmuch new has been run at least once.
>  test_begin_subtest "Skip and report non-mail files"
> -- 
> 2.1.3
>
> _______________________________________________
> notmuch mailing list
> notmuch@notmuchmail.org
> http://notmuchmail.org/mailman/listinfo/notmuch

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

* Re: [PATCH] lib: drop the deprecation message for single-message mbox files
  2014-11-23 11:15 [PATCH] lib: drop the deprecation message for single-message mbox files Jani Nikula
  2014-11-23 11:42 ` Tomi Ollila
@ 2015-01-01 15:53 ` David Bremner
  1 sibling, 0 replies; 3+ messages in thread
From: David Bremner @ 2015-01-01 15:53 UTC (permalink / raw)
  To: Jani Nikula, notmuch

Jani Nikula <jani@nikula.org> writes:

> We generally do not support mbox files, but for historical reasons
> we've supported single-message mbox files, with a deprecation
> message. We've tried dropping the support altogether, but backed out
> of it because we'd need to stop indexing them, while keeping support
> for previously indexed files. This would be more complicated than
> simply supporting single-message mbox files. Therefore, drop the
> deprecation message, and just silently accept single-message mboxes.

Pushed. At some point we should add a NEWS item.

d

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

end of thread, other threads:[~2015-01-01 15:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-11-23 11:15 [PATCH] lib: drop the deprecation message for single-message mbox files Jani Nikula
2014-11-23 11:42 ` Tomi Ollila
2015-01-01 15:53 ` 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).