[PATCH] Repeatability when copying a whole directory into a new one.

Tomi Ollila tomi.ollila at iki.fi
Sun Dec 18 05:08:47 PST 2011


On Fri, 30 Sep 2011 01:26:46 +0200, Thomas Schwinge <thomas at schwinge.name> wrote:
> This new test currently fails -- but it shouldn't.
> ---
> 
> Hi!
> 
> I found this while manually copying directories and running notmuch new.
> 
> Am I just too sleepy at this time, or is it another DB vs. directory
> mtime issue?

I played a bit with this... making directories early and touching and...

... and always got the same output as below.

>      BROKEN Repeatability when copying a whole directory into a new one
>             --- new.18.expected     2011-09-29 23:23:39.000000000 +0000
>             +++ new.18.output       2011-09-29 23:23:39.000000000 +0000
>             @@ -1,2 +1 @@
>             -Processed 51 total files in almost no time.
>              No new mail.

Then, finally, the following line changes

+output1=$(notmuch new; notmuch search --format=files '*')
...
+output2=$(notmuch new; notmuch search --format=files '*')

we see this

 BROKEN Repeatability when copying a whole directory into a new one
        --- new.18.expected     2011-12-18 13:01:47.000000000 +0000
        +++ new.18.output       2011-12-18 13:01:47.000000000 +0000
        @@ -1,104 +1,52 @@
        -Processed 51 total files in almost no time.
         No new mail.
         /home/too/vc/ext/notmuch/test/tmp.new/mail/cur/50:2,
        -/home/too/vc/ext/notmuch/test/tmp.new/mail/2nd/cur/50:2,
         /home/too/vc/ext/notmuch/test/tmp.new/mail/cur/49:2,
        -/home/too/vc/ext/notmuch/test/tmp.new/mail/2nd/cur/49:2,
         /home/too/vc/ext/notmuch/test/tmp.new/mail/cur/48:2,
        -/home/too/vc/ext/notmuch/test/tmp.new/mail/2nd/cur/48:2,
...


We see that after second time the files are not added to the message
(again). 

I cannot see that the issue is with directory mtimes, but perhaps that
the directory .../2nd/... is not forgotten...

... but whatever the reason will eventually be I suggest to make
this change to the test -- it provides more concrete information
to anyone who will be looking fix for this case.

> 
> 
> Grüße,
>  Thomas

Tomi

> 
> ---
>  test/new |   21 +++++++++++++++++++++
>  1 files changed, 21 insertions(+), 0 deletions(-)
> 
> diff --git a/test/new b/test/new
> index 49f390d..0afb04c 100755
> --- a/test/new
> +++ b/test/new
> @@ -153,4 +153,25 @@ rm -rf "${MAIL_DIR}"/two
>  output=$(NOTMUCH_NEW)
>  test_expect_equal "$output" "No new mail. Removed 3 messages."
>  
> +
> +test_begin_subtest 'Repeatability when copying a whole directory into a new one'
> +
> +add_email_corpus
> +
> +mkdir "$MAIL_DIR"/2nd
> +cp -a "$MAIL_DIR"/cur "$MAIL_DIR"/2nd/
> +output1=$(notmuch new)
> +
> +rm -rf "$MAIL_DIR"/2nd
> +notmuch new > /dev/null
> +
> +# This was quite enjoyable.  Let's do it again.
> +mkdir "$MAIL_DIR"/2nd
> +cp -a "$MAIL_DIR"/cur "$MAIL_DIR"/2nd/
> +output2=$(notmuch new)
> +
> +test_subtest_known_broken
> +test_expect_equal "$output2" "$output1"
> +
> +
>  test_done
> -- 
> 1.7.5.4
> 


More information about the notmuch mailing list