unofficial mirror of notmuch@notmuchmail.org
 help / color / mirror / code / Atom feed
* [PATCH] gzclose_r() and gzclose_w() are not available in older versions of zlib such as the version on Ubuntu LTS 12.04. Changing to gzclose() allows notmuch to work on older versions as well
@ 2016-11-20 11:15 Ico Doornekamp
  2016-11-21 18:28 ` David Bremner
  0 siblings, 1 reply; 4+ messages in thread
From: Ico Doornekamp @ 2016-11-20 11:15 UTC (permalink / raw)
  To: notmuch; +Cc: Ico Doornekamp

---
 configure         |    4 ++--
 notmuch-dump.c    |    4 ++--
 notmuch-restore.c |    2 +-
 3 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index f0fc466..dc3256b 100755
--- a/configure
+++ b/configure
@@ -491,9 +491,9 @@ if ! pkg-config --exists zlib; then
   rm -f compat/gen_zlib_pc
 fi
 
-printf "Checking for zlib (>= 1.2.5.2)... "
+printf "Checking for zlib (>= 1.2.3.4)... "
 have_zlib=0
-if pkg-config --atleast-version=1.2.5.2 zlib; then
+if pkg-config --atleast-version=1.2.3.4 zlib; then
     printf "Yes.\n"
     have_zlib=1
     zlib_cflags=$(pkg-config --cflags zlib)
diff --git a/notmuch-dump.c b/notmuch-dump.c
index e7965ce..637d93f 100644
--- a/notmuch-dump.c
+++ b/notmuch-dump.c
@@ -328,7 +328,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
 	}
     }
 
-    if (gzclose_w (output) != Z_OK) {
+    if (gzclose (output) != Z_OK) {
 	fprintf (stderr, "Error closing %s: %s\n", name_for_error,
 		 gzerror (output, NULL));
 	ret = EXIT_FAILURE;
@@ -347,7 +347,7 @@ notmuch_database_dump (notmuch_database_t *notmuch,
     }
  DONE:
     if (ret != EXIT_SUCCESS && output)
-	(void) gzclose_w (output);
+	(void) gzclose (output);
 
     if (ret != EXIT_SUCCESS && output_file_name)
 	(void) unlink (tempname);
diff --git a/notmuch-restore.c b/notmuch-restore.c
index d6429ef..b37cfe2 100644
--- a/notmuch-restore.c
+++ b/notmuch-restore.c
@@ -449,7 +449,7 @@ notmuch_restore_command (notmuch_config_t *config, int argc, char *argv[])
     if (notmuch)
 	notmuch_database_destroy (notmuch);
 
-    if (input && gzclose_r (input)) {
+    if (input && gzclose (input)) {
 	fprintf (stderr, "Error closing %s: %s\n",
 		 name_for_error, gzerror (input, NULL));
 	ret = EXIT_FAILURE;
-- 
1.7.9.5

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gzclose_r() and gzclose_w() are not available in older versions of zlib such as the version on Ubuntu LTS 12.04. Changing to gzclose() allows notmuch to work on older versions as well
  2016-11-20 11:15 [PATCH] gzclose_r() and gzclose_w() are not available in older versions of zlib such as the version on Ubuntu LTS 12.04. Changing to gzclose() allows notmuch to work on older versions as well Ico Doornekamp
@ 2016-11-21 18:28 ` David Bremner
  2016-11-21 19:34   ` [PATCH] gzclose_r() and gzclose_w() are not available in older Tomi Ollila
  0 siblings, 1 reply; 4+ messages in thread
From: David Bremner @ 2016-11-21 18:28 UTC (permalink / raw)
  To: Ico Doornekamp, notmuch; +Cc: Ico Doornekamp

Ico Doornekamp <ico@pruts.nl> writes:

> ---
>  configure         |    4 ++--
>  notmuch-dump.c    |    4 ++--
>  notmuch-restore.c |    2 +-
>  3 files changed, 5 insertions(+), 5 deletions(-)

Looking at the docs, this looks sensible.

,----
| Same as gzclose(), but gzclose_r() is only for use when reading, and
| gzclose_w() is only for use when writing or appending. The advantage to
| using these instead of gzclose() is that they avoid linking in zlib
| compression or decompression code that is not used when only reading or
| only writing respectively. If gzclose() is used, then both compression
| and decompression code will be included the application when linking to
| a static zlib library.
`----

Probably the commit message could include a paraphrase/quote of the
above.

I take the submitters word for the first version supporting gzclose

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gzclose_r() and gzclose_w() are not available in older...
  2016-11-21 18:28 ` David Bremner
@ 2016-11-21 19:34   ` Tomi Ollila
  2016-11-21 20:24     ` Jani Nikula
  0 siblings, 1 reply; 4+ messages in thread
From: Tomi Ollila @ 2016-11-21 19:34 UTC (permalink / raw)
  To: David Bremner, Ico Doornekamp, notmuch

On Mon, Nov 21 2016, David Bremner <david@tethera.net> wrote:

> I take the submitters word for the first version supporting gzclose

I tried this patch on Scientific Linux 6.2 -- after applied it I changed
the check to >= 1.2.3 (to the one used in sl62).

This compiles fine but tests fails miserably.

According to http://packages.ubuntu.com/hu/source/precise/zlib
it uses zlib 1.2.3.4...

... I created container based on ubuntu:12.04

... and ... the tests fail there as bad as with 1.2.3.


SO, it looks to me that (unfortunately) just doing this is not enough
(knowing that one needs to test dump/restore for this patch to be feasible
may not be obvious to everyone ;/).

My supportive patch: id:1397809386-23356-1-git-send-email-tomi.ollila@iki.fi
-- http://article.gmane.org/gmane.mail.notmuch.general/17916
still applies to many systems with older zlib versions; probably to precise
as well.


test output examples:

Warning: cannot parse query: EqÀ2ýA1?çr"9h nV)VC[æ'c¤LÔs£eM NJV>.<C0e
(skipping)
Error reading (gzipped) input: out of memory
^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c^[[?1;2c


./T600-named-queries.sh: line 49: 10825 Segmentation fault      (core
dumped) notmuch restore < BEFORE

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gzclose_r() and gzclose_w() are not available in older...
  2016-11-21 19:34   ` [PATCH] gzclose_r() and gzclose_w() are not available in older Tomi Ollila
@ 2016-11-21 20:24     ` Jani Nikula
  0 siblings, 0 replies; 4+ messages in thread
From: Jani Nikula @ 2016-11-21 20:24 UTC (permalink / raw)
  To: Tomi Ollila, David Bremner, Ico Doornekamp, notmuch

On Mon, 21 Nov 2016, Tomi Ollila <tomi.ollila@iki.fi> wrote:
> On Mon, Nov 21 2016, David Bremner <david@tethera.net> wrote:
>
>> I take the submitters word for the first version supporting gzclose
>
> I tried this patch on Scientific Linux 6.2 -- after applied it I changed
> the check to >= 1.2.3 (to the one used in sl62).
>
> This compiles fine but tests fails miserably.

zlib 1.2.5.2 (the version we currently require) was released
2011-12-17. I wouldn't put any effort into supporting an even older
version of zlib. We've dropped support for newer stuff (and we're still
pretty conservative).

BR,
Jani.

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-21 20:26 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-11-20 11:15 [PATCH] gzclose_r() and gzclose_w() are not available in older versions of zlib such as the version on Ubuntu LTS 12.04. Changing to gzclose() allows notmuch to work on older versions as well Ico Doornekamp
2016-11-21 18:28 ` David Bremner
2016-11-21 19:34   ` [PATCH] gzclose_r() and gzclose_w() are not available in older Tomi Ollila
2016-11-21 20:24     ` Jani Nikula

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).