diff --git a/ocaml-3.11.0-string-index-from.patch b/ocaml-3.11.0-string-index-from.patch new file mode 100644 index 0000000..c6a8ddc --- /dev/null +++ b/ocaml-3.11.0-string-index-from.patch @@ -0,0 +1,47 @@ +--- ocaml/stdlib/string.ml 2008/07/22 11:29:00 1.28 ++++ ocaml/stdlib/string.ml 2008/11/18 10:29:26 1.29 +@@ -11,7 +11,7 @@ + (* *) + (***********************************************************************) + +-(* $Id: ocaml-3.11.0-string-index-from.patch,v 1.1 2008/11/20 17:52:37 rjones Exp $ *) ++(* $Id: ocaml-3.11.0-string-index-from.patch,v 1.1 2008/11/20 17:52:37 rjones Exp $ *) + + (* String operations *) + +@@ -154,7 +154,7 @@ let index s c = index_rec s (length s) 0 + + let index_from s i c = + let l = length s in +- if i < 0 || i >= l then invalid_arg "String.index_from" else ++ if i < 0 || i > l then invalid_arg "String.index_from" else + index_rec s l i c;; + + let rec rindex_rec s i c = +@@ -164,22 +164,18 @@ let rec rindex_rec s i c = + let rindex s c = rindex_rec s (length s - 1) c;; + + let rindex_from s i c = +- let l = length s in +- if i < 0 || i >= l then invalid_arg "String.rindex_from" else ++ if i < -1 || i >= length s then invalid_arg "String.rindex_from" else + rindex_rec s i c;; + + let contains_from s i c = + let l = length s in +- if i < 0 || i >= l then invalid_arg "String.contains_from" else ++ if i < 0 || i > l then invalid_arg "String.contains_from" else + try ignore (index_rec s l i c); true with Not_found -> false;; + +-let contains s c = +- let l = length s in +- l <> 0 && contains_from s 0 c;; ++let contains s c = contains_from s 0 c;; + + let rcontains_from s i c = +- let l = length s in +- if i < 0 || i >= l then invalid_arg "String.rcontains_from" else ++ if i < 0 || i >= length s then invalid_arg "String.rcontains_from" else + try ignore (rindex_rec s i c); true with Not_found -> false;; + + type t = string diff --git a/ocaml.spec b/ocaml.spec index e0a8f43..c33b9c6 100644 --- a/ocaml.spec +++ b/ocaml.spec @@ -2,7 +2,7 @@ Name: ocaml Version: 3.11.0+beta1 -Release: 1%{?dist} +Release: 2%{?dist} Summary: Objective Caml compiler and programming environment @@ -32,6 +32,12 @@ Patch3: ocaml-3.11.0-ppc64.patch # A similar fix went upstream in 3.11.0: #Patch5: ocaml-3.11-dev12-no-executable-stack.patch +# This is a patch from upstream which fixes PR#4637, PR#4582. +# http://camlcvs.inria.fr/cgi-bin/cvsweb/ocaml/stdlib/string.ml.diff?r1=text&tr1=1.29&r2=text&tr2=1.28 +# commonly manifested as errors thrown saying: +# Invalid_argument("String.index_from") +Patch6: ocaml-3.11.0-string-index-from.patch + BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: ncurses-devel @@ -206,6 +212,7 @@ man pages and info files. %patch3 -p1 -b .ppc64 #%patch4 -p1 -b .map32bit #%patch5 -p0 -b .noexecstack +%patch6 -p1 -b .stringindexfrom cp %{SOURCE2} refman.pdf @@ -446,6 +453,9 @@ fi %changelog +* Thu Nov 20 2008 Richard W.M. Jones - 3.11.0+beta1-2 +- Fix Invalid_argument("String.index_from") with patch from upstream. + * Tue Nov 18 2008 Richard W.M. Jones - 3.11.0+beta1-1 - Rebuild for major new upstream release of 3.11.0 for Fedora 11.