Hi,
On Mon, Mar 06, 2017 at 09:04:22AM -0700, Giovanni Bechis wrote:
> CVSROOT: /cvs
> Module name: ports
> Changes by: [email protected] 2017/03/06 09:04:22
>
> Modified files:
> net/unison : Makefile
> Added files:
> net/unison/patches: patch-patch-bytearray_stubs_c
>
> Log message:
> Fix rare SIGSEGV when transferring large replicas.
> from Alex Markley via Davide Gerhard
There is a problem with patch-patch-bytearray_stubs_c.
The file should patch bytearray_stubs.c, but instead it creates a
patch which would patch bytearray_stubs.c. A fix can be found below.
Thanks,
Caspar Schutijser
Index: Makefile
===================================================================
RCS file: /cvs/ports/net/unison/Makefile,v
retrieving revision 1.11
diff -u -p -r1.11 Makefile
--- Makefile 6 Mar 2017 16:04:22 -0000 1.11
+++ Makefile 12 Mar 2017 20:43:26 -0000
@@ -4,7 +4,7 @@ COMMENT= multi-platform file synchroniza
CATEGORIES= net
V= 2.48.4
-REVISION= 0
+REVISION= 1
DISTNAME= unison-${V}
MASTER_SITES= ${HOMEPAGE}download/releases/stable/
Index: patches/patch-bytearray_stubs_c
===================================================================
RCS file: patches/patch-bytearray_stubs_c
diff -N patches/patch-bytearray_stubs_c
--- /dev/null 1 Jan 1970 00:00:00 -0000
+++ patches/patch-bytearray_stubs_c 12 Mar 2017 20:43:26 -0000
@@ -0,0 +1,41 @@
+$OpenBSD$
+
+Fix rare SIGSEGV when transferring large replicas.
+Fix a theoretical integer overflow.
+
+References:
+https://github.com/bcpierce00/unison/commit/c1ddff13aa96b124680cce61673129aeb563dbf7
+https://github.com/bcpierce00/unison/commit/f59663d67f4593a5bc1e554058fe6864751e805e
+
+Thanks to Alex Markley and OCaml developers
+--- bytearray_stubs.c.orig Mon May 23 18:40:05 2016
++++ bytearray_stubs.c Sun Mar 12 20:41:53 2017
+@@ -5,6 +5,7 @@
+
+ #include "caml/intext.h"
+ #include "caml/bigarray.h"
++#include "caml/memory.h"
+
+ CAMLprim value ml_marshal_to_bigarray(value v, value flags)
+ {
+@@ -21,15 +22,18 @@ CAMLprim value ml_marshal_to_bigarray(value v, value f
+
+ CAMLprim value ml_unmarshal_from_bigarray(value b, value ofs)
+ {
++ CAMLparam1(b); /* Holds [b] live until unmarshalling completes. */
++ value result;
+ struct caml_bigarray *b_arr = Bigarray_val(b);
+- return input_value_from_block (Array_data (b_arr, ofs),
++ result = input_value_from_block (Array_data (b_arr, ofs),
+ b_arr->dim[0] - Long_val(ofs));
++ CAMLreturn(result);
+ }
+
+ CAMLprim value ml_blit_string_to_bigarray
+ (value s, value i, value a, value j, value l)
+ {
+- char *src = String_val(s) + Int_val(i);
++ char *src = String_val(s) + Long_val(i);
+ char *dest = Array_data(Bigarray_val(a), j);
+ memcpy(dest, src, Long_val(l));
+ return Val_unit;
Index: patches/patch-patch-bytearray_stubs_c
===================================================================
RCS file: patches/patch-patch-bytearray_stubs_c
diff -N patches/patch-patch-bytearray_stubs_c
--- patches/patch-patch-bytearray_stubs_c 6 Mar 2017 16:04:22 -0000
1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,44 +0,0 @@
-$OpenBSD: patch-patch-bytearray_stubs_c,v 1.1 2017/03/06 16:04:22 giovanni Exp
$
---- patch-bytearray_stubs_c.orig Fri Jan 20 23:42:43 2017
-+++ patch-bytearray_stubs_c Fri Jan 20 23:42:56 2017
-@@ -0,0 +1,40 @@
-+
-+Fix rare SIGSEGV when transferring large replicas.
-+Fix a theoretical integer overflow.
-+
-+References:
-+https://github.com/bcpierce00/unison/commit/c1ddff13aa96b124680cce61673129aeb563dbf7
-+https://github.com/bcpierce00/unison/commit/f59663d67f4593a5bc1e554058fe6864751e805e
-+
-+Thanks to Alex Markley and OCaml developers
-+--- bytearray_stubs.c.orig Tue Jan 17 08:41:00 2017
-++++ bytearray_stubs.c Tue Jan 17 08:41:21 2017
-+@@ -5,6 +5,7 @@
-+ #include "caml/intext.h"
-+
-+ #include "caml/bigarray.h"
-++#include "caml/memory.h"
-+
-+ CAMLprim value ml_marshal_to_bigarray(value v, value flags)
-+ {
-+@@ -21,15 +22,18 @@ CAMLprim value ml_marshal_to_bigarray(value v, value f
-+
-+ CAMLprim value ml_unmarshal_from_bigarray(value b, value ofs)
-+ {
-++ CAMLparam1(b); /* Holds [b] live until unmarshalling completes. */
-++ value result;
-+ struct caml_bigarray *b_arr = Bigarray_val(b);
-+- return input_value_from_block (Array_data (b_arr, ofs),
-++ result = input_value_from_block (Array_data (b_arr, ofs),
-+ b_arr->dim[0] - Long_val(ofs));
-++ CAMLreturn(result);
-+ }
-+
-+ CAMLprim value ml_blit_string_to_bigarray
-+ (value s, value i, value a, value j, value l)
-+ {
-+- char *src = String_val(s) + Int_val(i);
-++ char *src = String_val(s) + Long_val(i);
-+ char *dest = Array_data(Bigarray_val(a), j);
-+ memcpy(dest, src, Long_val(l));
-+ return Val_unit;