From: Michal Sojka <sojkam1@fel.cvut.cz>
To: Sebastian Spaeth <Sebastian@SSpaeth.de>, notmuch@notmuchmail.org
Subject: Re: [PATCH] Prevent data loss caused by SIGINT during notmuch new
Date: Sun, 28 Mar 2010 06:28:03 +0200 [thread overview]
Message-ID: <87zl1tgje4.fsf@steelpick.2x.cz> (raw)
In-Reply-To: <878w9d2ovw.fsf@SSpaeth.de>
On Sun, 28 Mar 2010, Sebastian Spaeth wrote:
> On Sun, 28 Mar 2010 00:37:00 +0100, "Sebastian Spaeth" <Sebastian@SSpaeth.de> wrote:
> > On Fri, 26 Mar 2010 22:18:13 +0100, Michal Sojka <sojkam1@fel.cvut.cz> wrote:
> > > When Ctrl-C is pressed in a wrong time during notmuch new, it can lead
> > > to removal of messages from the database even if the files were not
> > > removed.
>
> CC -O2 notmuch-new.o
> notmuch-new.c: In function 'add_files_recursive':
> notmuch-new.c:519: error: 'add_files_state_t' has no member named 'interrupted'
> make: *** [notmuch-new.o] Error 1
>
> I have not checked the code yet, but simply applying this patch make the
> compile fail.
Oh, sorry. I thought it is so trivial, that I didn't even compile it for
master. The right version is here:
--8<---------------cut here---------------start------------->8---
From 117de1fcc316a4792244a36b68e38215ff2a5bdc Mon Sep 17 00:00:00 2001
From: Michal Sojka <sojkam1@fel.cvut.cz>
Date: Fri, 26 Mar 2010 22:16:26 +0100
Subject: [PATCH v2] Prevent data loss caused by SIGINT during notmuch new
When Ctrl-C is pressed in a wrong time during notmuch new, it can lead
to removal of messages from the database even if the files were not
removed.
It happened at least once to me.
Signed-off-by: Michal Sojka <sojkam1@fel.cvut.cz>
---
notmuch-new.c | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/notmuch-new.c b/notmuch-new.c
index 44b50aa..109bef2 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -454,6 +454,9 @@ add_files_recursive (notmuch_database_t *notmuch,
next = NULL;
}
+ if (! interrupted)
+ goto DONE;
+
/* Now that we've walked the whole filesystem list, anything left
* over in the database lists has been deleted. */
while (notmuch_filenames_valid (db_files))
--
1.7.0.2
next prev parent reply other threads:[~2010-03-28 4:28 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-26 21:18 [PATCH] Prevent data loss caused by SIGINT during notmuch new Michal Sojka
2010-03-27 23:37 ` Sebastian Spaeth
2010-03-28 1:53 ` Sebastian Spaeth
2010-03-28 4:28 ` Michal Sojka [this message]
2010-03-29 7:16 ` Sebastian Spaeth
2010-03-29 23:20 ` spaetz
2010-03-30 8:22 ` Michal Sojka
2010-03-30 8:23 ` Michal Sojka
2010-04-13 15:47 ` Carl Worth
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
List information: https://notmuchmail.org/
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87zl1tgje4.fsf@steelpick.2x.cz \
--to=sojkam1@fel.cvut.cz \
--cc=Sebastian@SSpaeth.de \
--cc=notmuch@notmuchmail.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.
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).