Re: [notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-04-13 Thread Carl Worth
On Tue, 30 Mar 2010 10:23:23 +0200, Michal Sojka  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.
> 
> It happened at least once to me.
> 
> Signed-off-by: Michal Sojka 

Thanks so much, Michal!

This was a very bad bug that I'm sure I introduced myself when
implementing rename support.

Thanks to Sebastian for reminding me to pick this up for the 0.2
release.

And, everyone, if I'm behind on patches, (which has always been the case
so far with this project...), please feel free to make plenty of noise
when there are known fixes for data-loss bugs. We really shouldn't let
those sit for a couple of weeks!

-Carl


pgpv1jX4K9zi0.pgp
Description: PGP signature
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-04-13 Thread Carl Worth
On Tue, 30 Mar 2010 10:23:23 +0200, Michal Sojka  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.
> 
> It happened at least once to me.
> 
> Signed-off-by: Michal Sojka 

Thanks so much, Michal!

This was a very bad bug that I'm sure I introduced myself when
implementing rename support.

Thanks to Sebastian for reminding me to pick this up for the 0.2
release.

And, everyone, if I'm behind on patches, (which has always been the case
so far with this project...), please feel free to make plenty of noise
when there are known fixes for data-loss bugs. We really shouldn't let
those sit for a couple of weeks!

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-30 Thread Michal Sojka
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 
---
 notmuch-new.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 44b50aa..5ade168 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



[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-30 Thread Michal Sojka
On Mon, 29 Mar 2010, spaetz wrote:
> 
> hehe, this version compiles but has the logic inverted. Removing the ! from
> your patch makes it actually work as intended :--).

Right! I should definitely be more careful even for such a trivial
patches :) It's interesting, that in my branch, I have no negation.

I send the patch once again.

Michal


[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-30 Thread Michal Sojka
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 
---
 notmuch-new.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 44b50aa..5ade168 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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-30 Thread Michal Sojka
On Mon, 29 Mar 2010, spaetz wrote:
> 
> hehe, this version compiles but has the logic inverted. Removing the ! from
> your patch makes it actually work as intended :--).

Right! I should definitely be more careful even for such a trivial
patches :) It's interesting, that in my branch, I have no negation.

I send the patch once again.

Michal
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-29 Thread spaetz

hehe, this version compiles but has the logic inverted. Removing the ! from
your patch makes it actually work as intended :--).
-- 
View this message in context: 
http://n3.nabble.com/PATCH-Prevent-data-loss-caused-by-SIGINT-during-notmuch-new-tp677501p684691.html
Sent from the notmuch mailing list archive at Nabble.com.
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-29 Thread spaetz

hehe, this version compiles but has the logic inverted. Removing the ! from
your patch makes it actually work as intended :--).
-- 
View this message in context: 
http://n3.nabble.com/PATCH-Prevent-data-loss-caused-by-SIGINT-during-notmuch-new-tp677501p684691.html
Sent from the notmuch mailing list archive at Nabble.com.


[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-29 Thread Sebastian Spaeth
> Oh, sorry. I thought it is so trivial, that I didn't even compile it for
> master. The right version is here:

Thanks, that worked fine now. I pushed it to my branch.

Sebastian


Re: [notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-29 Thread Sebastian Spaeth
> Oh, sorry. I thought it is so trivial, that I didn't even compile it for
> master. The right version is here:

Thanks, that worked fine now. I pushed it to my branch.

Sebastian
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-28 Thread Michal Sojka
On Sun, 28 Mar 2010, Sebastian Spaeth wrote:
> On Sun, 28 Mar 2010 00:37:00 +0100, "Sebastian Spaeth"  SSpaeth.de> wrote:
> > On Fri, 26 Mar 2010 22:18:13 +0100, Michal Sojka  
> > 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 -O2notmuch-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 
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 
---
 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


[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-28 Thread Sebastian Spaeth
On Sun, 28 Mar 2010 00:37:00 +0100, "Sebastian Spaeth"  wrote:
> On Fri, 26 Mar 2010 22:18:13 +0100, Michal Sojka  
> 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.

Sebastian


[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-28 Thread Sebastian Spaeth
On Fri, 26 Mar 2010 22:18:13 +0100, Michal Sojka  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.

Thanks, applied in my feature-all branch.

Sebastian


Re: [notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-27 Thread Michal Sojka
On Sun, 28 Mar 2010, Sebastian Spaeth wrote:
> On Sun, 28 Mar 2010 00:37:00 +0100, "Sebastian Spaeth"  
> wrote:
> > On Fri, 26 Mar 2010 22:18:13 +0100, Michal Sojka  
> > 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 -O2notmuch-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 
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 
---
 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
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-27 Thread Sebastian Spaeth
On Sun, 28 Mar 2010 00:37:00 +0100, "Sebastian Spaeth"  
wrote:
> On Fri, 26 Mar 2010 22:18:13 +0100, Michal Sojka  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.

Sebastian
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


Re: [notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-27 Thread Sebastian Spaeth
On Fri, 26 Mar 2010 22:18:13 +0100, Michal Sojka  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.

Thanks, applied in my feature-all branch.

Sebastian
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch


[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-26 Thread Michal Sojka
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 
---
 notmuch-new.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 44b50aa..ae89654 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -454,6 +454,9 @@ add_files_recursive (notmuch_database_t *notmuch,
next = NULL;
 }

+if (state->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



[notmuch] [PATCH] Prevent data loss caused by SIGINT during notmuch new

2010-03-26 Thread Michal Sojka
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 
---
 notmuch-new.c |3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/notmuch-new.c b/notmuch-new.c
index 44b50aa..ae89654 100644
--- a/notmuch-new.c
+++ b/notmuch-new.c
@@ -454,6 +454,9 @@ add_files_recursive (notmuch_database_t *notmuch,
next = NULL;
 }
 
+if (state->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

___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch