Re: [PATCH] test: add known_broken test for dumping large stored queries

2020-04-13 Thread Thomas Schneider
David Bremner  writes:

> 'qsx' reported a bug on #notmuch with notmuch-dump and large stored
> queries. This test will pass (on my machine) if the value of `repeat'
> is made smaller.

Feel free to add 'Reported-By: Thomas Schneider ', if
you like.

--Thomas
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: add known_broken test for dumping large stored queries

2020-04-13 Thread Tomi Ollila
On Sun, Apr 12 2020, David Bremner wrote:

> 'qsx' reported a bug on #notmuch with notmuch-dump and large stored
> queries. This test will pass (on my machine) if the value of `repeat'
> is made smaller.
> ---
>  test/T240-dump-restore.sh | 13 +
>  1 file changed, 13 insertions(+)
>
> diff --git a/test/T240-dump-restore.sh b/test/T240-dump-restore.sh
> index 0870ff92..374db5c2 100755
> --- a/test/T240-dump-restore.sh
> +++ b/test/T240-dump-restore.sh
> @@ -322,6 +322,19 @@ EOF
>  
>  test_expect_equal_file EXPECTED OUTPUT
>  
> +test_begin_subtest 'dumping large queries'
> +test_subtest_known_broken
> +# This value repeat was found experimentally by binary search. The
> +# config value after URL encoding is exactly 4096 bytes, which
> +# suggests a buffer size bug.
> +repeat=1329
> +notmuch config set query.big "$(seq -s' ' $repeat)"
> +notmuch dump --include=config > OUTPUT
> +notmuch config set query.big ''
> +printf "#notmuch-dump batch-tag:3 config\n#@ query.big " > EXPECTED

> +seq -s'%20'  $repeat >> EXPECTED

Extra space, otherwise tolerable =D

Tomi

> +test_expect_equal_file EXPECTED OUTPUT
> +
>  test_begin_subtest 'roundtripping random message-ids and tags'
>  
>  ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG} \
> -- 
> 2.25.1
___
notmuch mailing list
notmuch@notmuchmail.org
https://notmuchmail.org/mailman/listinfo/notmuch


Re: [PATCH] test: add known_broken test for dumping large stored queries

2020-04-12 Thread David Bremner
David Bremner  writes:

> 'qsx' reported a bug on #notmuch with notmuch-dump and large stored
> queries. This test will pass (on my machine) if the value of `repeat'
> is made smaller.

I believe the underlying problem is explained by this comment in zlib.h

   The number of uncompressed bytes written is limited to 8191, or
   one less than the buffer size given to gzbuffer().  The caller should assure
   that this limit is not exceeded.  If it is exceeded, then gzprintf() will
   return an error (0) with nothing written.

So calling gzbuffer can increase this limit, but you still have to guess
before writing for the first time.

One way of interpreting this is that we should avoid using gzprintf
where we cannot predict the output size.

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


[PATCH] test: add known_broken test for dumping large stored queries

2020-04-12 Thread David Bremner
'qsx' reported a bug on #notmuch with notmuch-dump and large stored
queries. This test will pass (on my machine) if the value of `repeat'
is made smaller.
---
 test/T240-dump-restore.sh | 13 +
 1 file changed, 13 insertions(+)

diff --git a/test/T240-dump-restore.sh b/test/T240-dump-restore.sh
index 0870ff92..374db5c2 100755
--- a/test/T240-dump-restore.sh
+++ b/test/T240-dump-restore.sh
@@ -322,6 +322,19 @@ EOF
 
 test_expect_equal_file EXPECTED OUTPUT
 
+test_begin_subtest 'dumping large queries'
+test_subtest_known_broken
+# This value repeat was found experimentally by binary search. The
+# config value after URL encoding is exactly 4096 bytes, which
+# suggests a buffer size bug.
+repeat=1329
+notmuch config set query.big "$(seq -s' ' $repeat)"
+notmuch dump --include=config > OUTPUT
+notmuch config set query.big ''
+printf "#notmuch-dump batch-tag:3 config\n#@ query.big " > EXPECTED
+seq -s'%20'  $repeat >> EXPECTED
+test_expect_equal_file EXPECTED OUTPUT
+
 test_begin_subtest 'roundtripping random message-ids and tags'
 
 ${TEST_DIRECTORY}/random-corpus --config-path=${NOTMUCH_CONFIG} \
-- 
2.25.1

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