You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Michael Spang <sp...@google.com> on 2010/08/06 19:06:40 UTC
[PATCH] Revert to using zlib-provided compress bound
We have a local definition of zlib's compressBound which is not in
sync with recent versions of zlib. This may cause a "Compression of
svndiff data failed" message from the Subversion server when the
buffer provided to zlib is not large enough.
This reverts to using the zlib-provided version, since the old version
of zlib that was missing this function should be quite rare these
days.
---
subversion/libsvn_delta/svndiff.c | 7 +------
1 files changed, 1 insertions(+), 6 deletions(-)
diff --git a/subversion/libsvn_delta/svndiff.c b/subversion/libsvn_delta/svndiff.c
index bf6afa9..c0187b5 100644
--- a/subversion/libsvn_delta/svndiff.c
+++ b/subversion/libsvn_delta/svndiff.c
@@ -31,11 +31,6 @@
#include "svn_private_config.h"
#include <zlib.h>
-/* This macro is taken from zlib, and was originally the function
- compressBound. It shouldn't ever change, but once every millenium,
- it may be useful for someone to make sure. */
-#define svnCompressBound(LEN) ((LEN) + ((LEN) >> 12) + ((LEN) >> 14) + 11)
-
/* For svndiff1, address/instruction/new data under this size will not
be compressed using zlib as a secondary compressor. */
#define MIN_COMPRESS_SIZE 512
@@ -152,7 +147,7 @@ zlib_encode(const char *data, apr_size_t len, svn_stringbuf_t *out)
}
else
{
- svn_stringbuf_ensure(out, svnCompressBound(len) + intlen);
+ svn_stringbuf_ensure(out, compressBound(len) + intlen);
endlen = out->blocksize;
if (compress2((unsigned char *)out->data + intlen, &endlen,
--
1.7.1
Re: [PATCH] Revert to using zlib-provided compress bound
Posted by "Hyrum K. Wright" <hy...@mail.utexas.edu>.
On Fri, Aug 6, 2010 at 3:51 PM, Peter Samuelson <pe...@p12n.org> wrote:
>
> [Michael Spang]
>> This reverts to using the zlib-provided version, since the old version
>> of zlib that was missing this function should be quite rare these
>> days.
>
> Maybe I'm just old ... but I bet there's still some zlib 1.1.4
> out there. Maybe do the following instead? (Untested.)
You're not old...you just run Debian. ;)
/me ducks.
>
> [[[
> * subversion/libsvn_delta/svndiff.c
> (svnCompressBound): Use zlib compressBound() if available.
> ]]]
>
> Index: libsvn_delta/svndiff.c
> ===================================================================
> --- subversion/libsvn_delta/svndiff.c (revisione 980368)
> +++ subversion/libsvn_delta/svndiff.c (copia locale)
> @@ -31,10 +31,12 @@
> #include "svn_private_config.h"
> #include <zlib.h>
>
> -/* This macro is taken from zlib, and was originally the function
> - compressBound. It shouldn't ever change, but once every millenium,
> - it may be useful for someone to make sure. */
> +/* The zlib compressBound function was not exported until 1.2.0. */
> +#if ZLIB_VERNUM >= 0x1200
> +#define svnCompressBound(LEN) compressBound(LEN)
> +#else
> #define svnCompressBound(LEN) ((LEN) + ((LEN) >> 12) + ((LEN) >> 14) + 11)
> +#endif
>
> /* For svndiff1, address/instruction/new data under this size will not
> be compressed using zlib as a secondary compressor. */
>
Re: [PATCH] Revert to using zlib-provided compress bound
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Welcome back Gavin :-)
Gavin Beau Baumanis wrote on Fri, Aug 13, 2010 at 00:12:53 +1000:
> Hi Michael,
>
> Just thought I would follow up your last email and see if you're still working on this patch?
> There's no rush... I just like to bring patch submissions back to the top of the mailing list after about 7 days or so - just to remind everyone.
>
>
> Gavin.
>
Re: [PATCH] Revert to using zlib-provided compress bound
Posted by Peter Samuelson <pe...@p12n.org>.
[Gavin Beau Baumanis]
> Just thought I would follow up your last email and see if you're
> still working on this patch?
r984911.
Thanks for the reminder,
Peter
Re: [PATCH] Revert to using zlib-provided compress bound
Posted by Gavin Beau Baumanis <ga...@thespidernet.com>.
Hi Michael,
Just thought I would follow up your last email and see if you're still working on this patch?
There's no rush... I just like to bring patch submissions back to the top of the mailing list after about 7 days or so - just to remind everyone.
Gavin.
On 07/08/2010, at 8:11 AM, Michael Spang wrote:
> On Fri, Aug 6, 2010 at 1:51 PM, Peter Samuelson <pe...@p12n.org> wrote:
>>
>> [Michael Spang]
>>> This reverts to using the zlib-provided version, since the old version
>>> of zlib that was missing this function should be quite rare these
>>> days.
>>
>> Maybe I'm just old ... but I bet there's still some zlib 1.1.4
>> out there. Maybe do the following instead? (Untested.)
>
> Yeah that does seem better.
>
> Michael
Re: [PATCH] Revert to using zlib-provided compress bound
Posted by Michael Spang <sp...@google.com>.
On Fri, Aug 6, 2010 at 1:51 PM, Peter Samuelson <pe...@p12n.org> wrote:
>
> [Michael Spang]
>> This reverts to using the zlib-provided version, since the old version
>> of zlib that was missing this function should be quite rare these
>> days.
>
> Maybe I'm just old ... but I bet there's still some zlib 1.1.4
> out there. Maybe do the following instead? (Untested.)
Yeah that does seem better.
Michael
Re: [PATCH] Revert to using zlib-provided compress bound
Posted by Peter Samuelson <pe...@p12n.org>.
[Michael Spang]
> This reverts to using the zlib-provided version, since the old version
> of zlib that was missing this function should be quite rare these
> days.
Maybe I'm just old ... but I bet there's still some zlib 1.1.4
out there. Maybe do the following instead? (Untested.)
[[[
* subversion/libsvn_delta/svndiff.c
(svnCompressBound): Use zlib compressBound() if available.
]]]
Index: libsvn_delta/svndiff.c
===================================================================
--- subversion/libsvn_delta/svndiff.c (revisione 980368)
+++ subversion/libsvn_delta/svndiff.c (copia locale)
@@ -31,10 +31,12 @@
#include "svn_private_config.h"
#include <zlib.h>
-/* This macro is taken from zlib, and was originally the function
- compressBound. It shouldn't ever change, but once every millenium,
- it may be useful for someone to make sure. */
+/* The zlib compressBound function was not exported until 1.2.0. */
+#if ZLIB_VERNUM >= 0x1200
+#define svnCompressBound(LEN) compressBound(LEN)
+#else
#define svnCompressBound(LEN) ((LEN) + ((LEN) >> 12) + ((LEN) >> 14) + 11)
+#endif
/* For svndiff1, address/instruction/new data under this size will not
be compressed using zlib as a secondary compressor. */