[PATCH] zlib-related bugs

2020-04-12 Thread Olivier Taïbi
the following diff addresses 3 zlib-related bugs in notmuch. 1) the second argument of gzerror() cannot be NULL, so replace it by a dummy 2) gzerror() cannot be closed after gzclosed(), so just print the error value instead. 3) in gz_getline(), if gz_error sets its second argument to

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

[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

[PATCH 1/5] util/zlib-extra.c: don't pass NULL to gzerror.

2020-04-12 Thread David Bremner
Although (as of 1.2.11) zlib checks this parameter before writing to it, the docs don't promise to keep doing so, so be safe. --- util/zlib-extra.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/util/zlib-extra.c b/util/zlib-extra.c index f691cccf..e17a9731 100644 ---

[PATCH 2/5] status: add print_status_gzbytes

2020-04-12 Thread David Bremner
This is in the client code, rather than libnotmuch_util, because it prints to stderr. Also it in pretends to generate notmuch status codes. --- notmuch-client.h | 8 +++- status.c | 14 ++ 2 files changed, 21 insertions(+), 1 deletion(-) diff --git a/notmuch-client.h

[PATCH 3/5] cli/dump: define GZPRINTF macro and use it in place of gzprintf

2020-04-12 Thread David Bremner
This will at least catch errors, and can be replaced with more sophisticated error handling where appropriate. --- notmuch-client.h | 3 +++ notmuch-dump.c | 24 2 files changed, 15 insertions(+), 12 deletions(-) diff --git a/notmuch-client.h b/notmuch-client.h index

[PATCH 4/5] cli/dump: define GZPUTS and use it in notmuch-dump

2020-04-12 Thread David Bremner
Similarly to GZPRINTF, this is a drop in replacement that can be improved where needd. --- notmuch-client.h | 1 + notmuch-dump.c | 10 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/notmuch-client.h b/notmuch-client.h index 55d4d526..7efcb06f 100644 ---

[PATCH 5/5] cli/dump: replace use of gzprintf with gzputs for config values

2020-04-12 Thread David Bremner
These can be large, and hit buffer limitations of gzprintf. --- notmuch-dump.c| 4 +++- test/T240-dump-restore.sh | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/notmuch-dump.c b/notmuch-dump.c index fb322237..23d7d20a 100644 --- a/notmuch-dump.c +++

[no subject]

2020-04-12 Thread David Bremner
Here's a not too ambitious attempt to clean up the error handling on zlib output. It's bit gross to treat any error reported by zlib as fatal, but it's a step up from ignoring them, and it's in the client code, not in the library. The first patch splits out the first fix of