Commit e2bee888 authored by Rocky Automation's avatar Rocky Automation 📺
Browse files

import libguestfs-1.40.2-27.module+el8.4.0+9282+0bdec052

parent 77180da6
From a5e8afb4ed8576a1b3398add2ede49a1f90ad01a Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 30 Jul 2020 13:57:45 +0100
Subject: [PATCH] daemon, lib: Replace deprecated security_context_t with char
*.
This gives deprecation warnings. It always was simply a char *, and
the recommendation upstream is to replace uses with char *:
https://github.com/SELinuxProject/selinux/commit/9eb9c9327563014ad6a807814e7975424642d5b9
(cherry picked from commit eb78e990ac5277a4282293f8787af871a1420b61)
---
daemon/selinux.c | 3 +--
lib/launch-libvirt.c | 5 ++---
2 files changed, 3 insertions(+), 5 deletions(-)
diff --git a/daemon/selinux.c b/daemon/selinux.c
index 1c1446d30..f4d839c19 100644
--- a/daemon/selinux.c
+++ b/daemon/selinux.c
@@ -63,8 +63,7 @@ char *
do_getcon (void)
{
#if defined(HAVE_GETCON)
- security_context_t context;
- char *r;
+ char *context, *r;
if (getcon (&context) == -1) {
reply_with_perror ("getcon");
diff --git a/lib/launch-libvirt.c b/lib/launch-libvirt.c
index bc5978cc4..4a47bbb29 100644
--- a/lib/launch-libvirt.c
+++ b/lib/launch-libvirt.c
@@ -288,8 +288,7 @@ create_cow_overlay_libvirt (guestfs_h *g, void *datav, struct drive *drv)
if (data->selinux_imagelabel) {
debug (g, "setting SELinux label on %s to %s",
overlay, data->selinux_imagelabel);
- if (setfilecon (overlay,
- (security_context_t) data->selinux_imagelabel) == -1)
+ if (setfilecon (overlay, data->selinux_imagelabel) == -1)
selinux_warning (g, __func__, "setfilecon", overlay);
}
#endif
@@ -840,7 +839,7 @@ is_custom_hv (guestfs_h *g)
static void
set_socket_create_context (guestfs_h *g)
{
- security_context_t scon; /* this is actually a 'char *' */
+ char *scon;
context_t con;
if (getcon (&scon) == -1) {
--
2.18.4
From 524b0c748a3a2d47b4c76e3aa546b9d4af144e6c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Sat, 7 Dec 2019 11:08:54 +0000
Subject: [PATCH] caml_named_value returns const value pointer in OCaml 4.09+
(cherry picked from ocaml-augeas
commit 1cf5aef99b26a46529ca797547c0b49627fffe78)
---
common/mlaugeas/augeas-c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/mlaugeas/augeas-c.c b/common/mlaugeas/augeas-c.c
index 3e0ba67ba..3b1dc2551 100644
--- a/common/mlaugeas/augeas-c.c
+++ b/common/mlaugeas/augeas-c.c
@@ -77,7 +77,7 @@ static const int error_map_len = sizeof error_map / sizeof error_map[0];
static void
raise_error (augeas_t t, const char *msg)
{
- value *exn = caml_named_value ("Augeas.Error");
+ const value *exn = caml_named_value ("Augeas.Error");
value args[4];
const int code = aug_error (t);
const char *aug_err_minor;
@@ -113,7 +113,7 @@ raise_error (augeas_t t, const char *msg)
static void
raise_init_error (const char *msg)
{
- value *exn = caml_named_value ("Augeas.Error");
+ const value *exn = caml_named_value ("Augeas.Error");
value args[4];
args[0] = caml_alloc (1, 0);
--
2.18.4
From 3860ab78d9fe5c34785aabc2227ebc8687b1171b Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 5 Sep 2019 09:00:14 +0100
Subject: [PATCH] ocaml: Change calls to caml_named_value() to cope with const
value* return.
In OCaml >= 4.09 the return value pointer of caml_named_value is
declared const.
Based on Pino Toscano's original patch to ocaml-augeas.
(cherry picked from commit 9788fa50601ad4f1eab56d0b763591268026e536)
---
common/mlpcre/pcre-c.c | 3 +--
common/mltools/uri-c.c | 6 ++----
common/mlvisit/visit-c.c | 4 +---
3 files changed, 4 insertions(+), 9 deletions(-)
diff --git a/common/mlpcre/pcre-c.c b/common/mlpcre/pcre-c.c
index 0762a8341..07f99b8d6 100644
--- a/common/mlpcre/pcre-c.c
+++ b/common/mlpcre/pcre-c.c
@@ -73,12 +73,11 @@ init (void)
static void
raise_pcre_error (const char *msg, int errcode)
{
- value *exn = caml_named_value ("PCRE.Error");
value args[2];
args[0] = caml_copy_string (msg);
args[1] = Val_int (errcode);
- caml_raise_with_args (*exn, 2, args);
+ caml_raise_with_args (*caml_named_value ("PCRE.Error"), 2, args);
}
/* Wrap and unwrap pcre regular expression handles, with a finalizer. */
diff --git a/common/mltools/uri-c.c b/common/mltools/uri-c.c
index 2a8837cd9..e03647c7b 100644
--- a/common/mltools/uri-c.c
+++ b/common/mltools/uri-c.c
@@ -46,10 +46,8 @@ guestfs_int_mllib_parse_uri (value argv /* arg value, not an array! */)
int r;
r = parse_uri (String_val (argv), &uri);
- if (r == -1) {
- value *exn = caml_named_value ("URI.Parse_failed");
- caml_raise (*exn);
- }
+ if (r == -1)
+ caml_raise (*caml_named_value ("URI.Parse_failed"));
/* Convert the struct into an OCaml tuple. */
rv = caml_alloc_tuple (5);
diff --git a/common/mlvisit/visit-c.c b/common/mlvisit/visit-c.c
index 7137c4998..201f6d762 100644
--- a/common/mlvisit/visit-c.c
+++ b/common/mlvisit/visit-c.c
@@ -53,7 +53,6 @@ value
guestfs_int_mllib_visit (value gv, value dirv, value fv)
{
CAMLparam3 (gv, dirv, fv);
- value *visit_failure_exn;
guestfs_h *g = (guestfs_h *) (intptr_t) Int64_val (gv);
struct visitor_function_wrapper_args args;
/* The dir string could move around when we call the
@@ -84,8 +83,7 @@ guestfs_int_mllib_visit (value gv, value dirv, value fv)
* already printed the error to stderr (XXX - fix), so we raise a
* generic exception.
*/
- visit_failure_exn = caml_named_value ("Visit.Failure");
- caml_raise (*visit_failure_exn);
+ caml_raise (*caml_named_value ("Visit.Failure"));
}
free (dir);
--
2.18.4
From 5c5cc8b7bc2588c04dd0d0472b466f978f8ac55c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 6 Feb 2020 10:17:35 +0000
Subject: [PATCH] ocaml: Use caml_alloc_initialized_string instead of memcpy.
See this commit in libguestfs-common:
https://github.com/libguestfs/libguestfs-common/commit/398dc56a6cb5d6d01506338fa94ef580e668d5e9
(cherry picked from commit 9f3148c791a970b7d6adf249e949a1b7e0b4b0c1)
---
generator/OCaml.ml | 10 ++++------
m4/guestfs-ocaml.m4 | 18 ++++++++++++++++++
ocaml/guestfs-c.c | 3 +--
ocaml/guestfs-c.h | 18 ++++++++++++++++++
4 files changed, 41 insertions(+), 8 deletions(-)
diff --git a/generator/OCaml.ml b/generator/OCaml.ml
index bd4f73b85..1b6970f6d 100644
--- a/generator/OCaml.ml
+++ b/generator/OCaml.ml
@@ -504,12 +504,11 @@ copy_table (char * const * argv)
| name, FString ->
pr " v = caml_copy_string (%s->%s);\n" typ name
| name, FBuffer ->
- pr " v = caml_alloc_string (%s->%s_len);\n" typ name;
- pr " memcpy (String_val (v), %s->%s, %s->%s_len);\n"
+ pr " v = caml_alloc_initialized_string (%s->%s_len, %s->%s);\n"
typ name typ name
| name, FUUID ->
- pr " v = caml_alloc_string (32);\n";
- pr " memcpy (String_val (v), %s->%s, 32);\n" typ name
+ pr " v = caml_alloc_initialized_string (32, %s->%s);\n"
+ typ name
| name, (FBytes|FInt64|FUInt64) ->
pr " v = caml_copy_int64 (%s->%s);\n" typ name
| name, (FInt32|FUInt32) ->
@@ -757,8 +756,7 @@ copy_table (char * const * argv)
pr " for (i = 0; r[i] != NULL; ++i) free (r[i]);\n";
pr " free (r);\n";
| RBufferOut _ ->
- pr " rv = caml_alloc_string (size);\n";
- pr " memcpy (String_val (rv), r, size);\n";
+ pr " rv = caml_alloc_initialized_string (size, r);\n";
pr " free (r);\n"
);
diff --git a/m4/guestfs-ocaml.m4 b/m4/guestfs-ocaml.m4
index 3c504ce7e..90658e8c5 100644
--- a/m4/guestfs-ocaml.m4
+++ b/m4/guestfs-ocaml.m4
@@ -221,6 +221,24 @@ AS_IF([test "x$have_Hivex_OPEN_UNSAFE" = "xno"],[
])
AC_SUBST([HIVEX_OPEN_UNSAFE_FLAG])
+dnl Check if OCaml has caml_alloc_initialized_string (added 2017).
+AS_IF([test "x$OCAMLC" != "xno" && test "x$OCAMLFIND" != "xno" && \
+ test "x$enable_ocaml" = "xyes"],[
+ AC_MSG_CHECKING([for caml_alloc_initialized_string])
+ cat >conftest.c <<'EOF'
+#include <caml/alloc.h>
+int main () { char *p = (void *) caml_alloc_initialized_string; return 0; }
+EOF
+ AS_IF([$OCAMLC conftest.c >&AS_MESSAGE_LOG_FD 2>&1],[
+ AC_MSG_RESULT([yes])
+ AC_DEFINE([HAVE_CAML_ALLOC_INITIALIZED_STRING],[1],
+ [caml_alloc_initialized_string found at compile time.])
+ ],[
+ AC_MSG_RESULT([no])
+ ])
+ rm -f conftest.c conftest.o
+])
+
dnl Flags we want to pass to every OCaml compiler call.
OCAML_WARN_ERROR="-warn-error CDEFLMPSUVYZX+52-3"
AC_SUBST([OCAML_WARN_ERROR])
diff --git a/ocaml/guestfs-c.c b/ocaml/guestfs-c.c
index 3b5fb198f..18d7dd978 100644
--- a/ocaml/guestfs-c.c
+++ b/ocaml/guestfs-c.c
@@ -360,8 +360,7 @@ event_callback_wrapper_locked (guestfs_h *g,
ehv = Val_int (event_handle);
- bufv = caml_alloc_string (buf_len);
- memcpy (String_val (bufv), buf, buf_len);
+ bufv = caml_alloc_initialized_string (buf_len, buf);
arrayv = caml_alloc (array_len, 0);
for (i = 0; i < array_len; ++i) {
diff --git a/ocaml/guestfs-c.h b/ocaml/guestfs-c.h
index f05dbd8e7..93ad3e2bf 100644
--- a/ocaml/guestfs-c.h
+++ b/ocaml/guestfs-c.h
@@ -19,6 +19,24 @@
#ifndef GUESTFS_OCAML_C_H
#define GUESTFS_OCAML_C_H
+#include "config.h"
+
+#include <caml/alloc.h>
+#include <caml/mlvalues.h>
+
+/* Replacement if caml_alloc_initialized_string is missing, added
+ * to OCaml runtime in 2017.
+ */
+#ifndef HAVE_CAML_ALLOC_INITIALIZED_STRING
+static inline value
+caml_alloc_initialized_string (mlsize_t len, const char *p)
+{
+ value sv = caml_alloc_string (len);
+ memcpy ((char *) String_val (sv), p, len);
+ return sv;
+}
+#endif
+
#define Guestfs_val(v) (*((guestfs_h **)Data_custom_val(v)))
extern void guestfs_int_ocaml_raise_error (guestfs_h *g, const char *func)
Noreturn;
--
2.18.4
From 3b4082b239ec0976b366293067e42f91d56cfcd5 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 6 Feb 2020 10:15:29 +0000
Subject: [PATCH] ocaml: Use caml_alloc_initialized_string instead of memcpy.
Since about 2017 OCaml has had a function for creating an initialized
string. This uses the function instead of caml_alloc_string + memcpy
(which doesn't work for OCaml 4.10) and defines a replacement if the
function is missing.
Note this requires configure.ac in libguestfs.git and virt-v2v.git to
define HAVE_CAML_ALLOC_INITIALIZED_STRING.
(cherry picked from commit 398dc56a6cb5d6d01506338fa94ef580e668d5e9)
---
common/mlpcre/pcre-c.c | 16 ++++++++++++++--
common/mlvisit/visit-c.c | 16 ++++++++++++++--
common/mlxml/xml-c.c | 16 ++++++++++++++--
3 files changed, 42 insertions(+), 6 deletions(-)
diff --git a/common/mlpcre/pcre-c.c b/common/mlpcre/pcre-c.c
index 07f99b8d6..7dbba5857 100644
--- a/common/mlpcre/pcre-c.c
+++ b/common/mlpcre/pcre-c.c
@@ -39,6 +39,19 @@
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+/* Replacement if caml_alloc_initialized_string is missing, added
+ * to OCaml runtime in 2017.
+ */
+#ifndef HAVE_CAML_ALLOC_INITIALIZED_STRING
+static inline value
+caml_alloc_initialized_string (mlsize_t len, const char *p)
+{
+ value sv = caml_alloc_string (len);
+ memcpy ((char *) String_val (sv), p, len);
+ return sv;
+}
+#endif
+
/* Data on the most recent match is stored in this thread-local
* variable. It is freed either by the next call to PCRE.matches or
* by (clean) thread exit.
@@ -257,8 +270,7 @@ guestfs_int_pcre_sub (value nv)
if (len < 0)
raise_pcre_error ("pcre_get_substring", len);
- strv = caml_alloc_string (len);
- memcpy (String_val (strv), str, len);
+ strv = caml_alloc_initialized_string (len, str);
CAMLreturn (strv);
}
diff --git a/common/mlvisit/visit-c.c b/common/mlvisit/visit-c.c
index 201f6d762..d5585ca94 100644
--- a/common/mlvisit/visit-c.c
+++ b/common/mlvisit/visit-c.c
@@ -35,6 +35,19 @@
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+/* Replacement if caml_alloc_initialized_string is missing, added
+ * to OCaml runtime in 2017.
+ */
+#ifndef HAVE_CAML_ALLOC_INITIALIZED_STRING
+static inline value
+caml_alloc_initialized_string (mlsize_t len, const char *p)
+{
+ value sv = caml_alloc_string (len);
+ memcpy ((char *) String_val (sv), p, len);
+ return sv;
+}
+#endif
+
struct visitor_function_wrapper_args {
/* In both case we are pointing to local roots, hence why these are
* value* not value.
@@ -198,8 +211,7 @@ copy_xattr (const struct guestfs_xattr *xattr)
rv = caml_alloc (2, 0);
v = caml_copy_string (xattr->attrname);
Store_field (rv, 0, v);
- v = caml_alloc_string (xattr->attrval_len);
- memcpy (String_val (v), xattr->attrval, xattr->attrval_len);
+ v = caml_alloc_initialized_string (xattr->attrval_len, xattr->attrval);
Store_field (rv, 1, v);
CAMLreturn (rv);
}
diff --git a/common/mlxml/xml-c.c b/common/mlxml/xml-c.c
index d3db7e227..a0fa0fc3d 100644
--- a/common/mlxml/xml-c.c
+++ b/common/mlxml/xml-c.c
@@ -40,6 +40,19 @@
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
+/* Replacement if caml_alloc_initialized_string is missing, added
+ * to OCaml runtime in 2017.
+ */
+#ifndef HAVE_CAML_ALLOC_INITIALIZED_STRING
+static inline value
+caml_alloc_initialized_string (mlsize_t len, const char *p)
+{
+ value sv = caml_alloc_string (len);
+ memcpy ((char *) String_val (sv), p, len);
+ return sv;
+}
+#endif
+
/* xmlDocPtr type */
#define docptr_val(v) (*((xmlDocPtr *)Data_custom_val(v)))
@@ -183,8 +196,7 @@ mllib_xml_to_string (value docv, value formatv)
doc = docptr_val (docv);
xmlDocDumpFormatMemory (doc, &mem, &size, Bool_val (formatv));
- strv = caml_alloc_string (size);
- memcpy (String_val (strv), mem, size);
+ strv = caml_alloc_initialized_string (size, mem);
free (mem);
CAMLreturn (strv);
--
2.18.4
From 96462b30d5ca6e45601512609cedfc874739137d Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 5 Sep 2019 09:00:14 +0100
Subject: [PATCH] ocaml: Change calls to caml_named_value() to cope with const
value* return.
In OCaml >= 4.09 the return value pointer of caml_named_value is
declared const.
Based on Pino Toscano's original patch to ocaml-augeas.
(cherry picked from commit 74ce7332dbb9bab2a69737257f0d07c93eb9bab4)
---
generator/daemon.ml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/generator/daemon.ml b/generator/daemon.ml
index a4e136aaa..b67c4d20b 100644
--- a/generator/daemon.ml
+++ b/generator/daemon.ml
@@ -746,7 +746,7 @@ let generate_daemon_caml_stubs () =
let nr_args = List.length args_do_function in
pr "{\n";
- pr " static value *cb = NULL;\n";
+ pr " static const value *cb = NULL;\n";
pr " CAMLparam0 ();\n";
pr " CAMLlocal2 (v, retv);\n";
pr " CAMLlocalN (args, %d);\n"
--
2.18.4
From 93422725a0a8248d97b67cdbc20e065f5164e089 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 6 Feb 2020 10:27:48 +0000
Subject: [PATCH] cat: Fix GCC 10 warning.
I believe this warning is bogus, but simply initializing the local
variable is enough to avoid it.
log.c: In function 'do_log':
log.c:390:7: error: 'comm_len' may be used uninitialized in this function [-Werror=maybe-uninitialized]
390 | printf (" %.*s", (int) comm_len, comm);
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(cherry picked from commit 4e199494c41d3240aa5c0708887b7a7513c6b6f2)
---
cat/log.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cat/log.c b/cat/log.c
index 25107e25f..f8a5c85f2 100644
--- a/cat/log.c
+++ b/cat/log.c
@@ -337,7 +337,7 @@ do_log_journal (void)
while ((r = guestfs_journal_next (g)) > 0) {
CLEANUP_FREE_XATTR_LIST struct guestfs_xattr_list *xattrs = NULL;
const char *priority_str, *identifier, *comm, *pid, *message;
- size_t priority_len, identifier_len, comm_len, pid_len, message_len;
+ size_t priority_len, identifier_len, comm_len = 0, pid_len, message_len;
int priority = LOG_INFO;
int64_t ts;
--
2.18.4
From 17df30b82007073a40deb37ff7f840d56a1b5bf1 Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 6 Feb 2020 10:33:39 +0000
Subject: [PATCH] builder: Fix const correctness for OCaml 4.10.
String_val now returns a const char *.
(cherry picked from commit d6fcf519f2d860fe3167629f042f5ff6a4ccc40d)
---
builder/setlocale-c.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/builder/setlocale-c.c b/builder/setlocale-c.c
index f2ad85352..6d877e7ac 100644
--- a/builder/setlocale-c.c
+++ b/builder/setlocale-c.c
@@ -44,7 +44,8 @@ virt_builder_setlocale (value val_category, value val_name)
{
CAMLparam2 (val_category, val_name);
CAMLlocal2 (rv, rv2);
- char *ret, *locstring;
+ const char *locstring;
+ char *ret;
int category;
category = lc_string_table[Int_val (val_category)];
--
2.18.4
From 8eb9f06b156c6362a17712cfed9c629dec297a2c Mon Sep 17 00:00:00 2001
From: "Richard W.M. Jones" <rjones@redhat.com>
Date: Thu, 6 Feb 2020 10:22:42 +0000
Subject: [PATCH] mlxml: Fix pointed target signedness.
xml-c.c: In function 'mllib_xml_to_string':
xml-c.c:199:47: error: pointer targets in passing argument 2 of 'caml_alloc_initialized_string' differ in signedness [-Werror=pointer-sign]
199 | strv = caml_alloc_initialized_string (size, mem);
| ^~~
| |
| xmlChar * {aka unsigned char *}
(cherry picked from commit ea10827b4cfb3cfe5f782421c01d2902e5f73f90)
---
common/mlxml/xml-c.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/common/mlxml/xml-c.c b/common/mlxml/xml-c.c
index a0fa0fc3d..715c3bb24 100644
--- a/common/mlxml/xml-c.c
+++ b/common/mlxml/xml-c.c
@@ -196,7 +196,7 @@ mllib_xml_to_string (value docv, value formatv)
doc = docptr_val (docv);
xmlDocDumpFormatMemory (doc, &mem, &size, Bool_val (formatv));
- strv = caml_alloc_initialized_string (size, mem);
+ strv = caml_alloc_initialized_string (size, (const char *) mem);
free (mem);
CAMLreturn (strv);
--
2.18.4
From 83c76b6c610df17e0b9bfd9cd11deb43ebc40411 Mon Sep 17 00:00:00 2001
From: Pino Toscano <ptoscano@redhat.com>
Date: Tue, 19 Feb 2019 10:50:01 +0100
Subject: [PATCH] common/mlpcre: add offset flag for PCRE.matches
This way it is possible to change where the matching start, instead of
always assuming it is the beginning.
(cherry picked from commit 0ed2e5c14a302d15fd3b75ee2c1cb808a06cb746)
---
common/mlpcre/PCRE.ml | 2 +-
common/mlpcre/PCRE.mli | 5 ++++-
common/mlpcre/pcre-c.c | 16 +++++++++++++---
common/mlpcre/pcre_tests.ml | 11 ++++++++---
4 files changed, 26 insertions(+), 8 deletions(-)
diff --git a/common/mlpcre/PCRE.ml b/common/mlpcre/PCRE.ml
index b054928f9..33074af1c 100644
--- a/common/mlpcre/PCRE.ml
+++ b/common/mlpcre/PCRE.ml
@@ -23,7 +23,7 @@ exception Error of string * int
type regexp
external compile : ?anchored:bool -> ?caseless:bool -> ?dotall:bool -> ?extended:bool -> ?multiline:bool -> string -> regexp = "guestfs_int_pcre_compile_byte" "guestfs_int_pcre_compile"
-external matches : regexp -> string -> bool = "guestfs_int_pcre_matches"
+external matches : ?offset:int -> regexp -> string -> bool = "guestfs_int_pcre_matches"
external sub : int -> string = "guestfs_int_pcre_sub"
external subi : int -> int * int = "guestfs_int_pcre_subi"
diff --git a/common/mlpcre/PCRE.mli b/common/mlpcre/PCRE.mli
index eacb6fd90..e10d512fc 100644
--- a/common/mlpcre/PCRE.mli
+++ b/common/mlpcre/PCRE.mli
@@ -62,7 +62,7 @@ val compile : ?anchored:bool -> ?caseless:bool -> ?dotall:bool -> ?extended:bool
See pcreapi(3) for details of what they do.
All flags default to false. *)
-val matches : regexp -> string -> bool
+val matches : ?offset:int -> regexp -> string -> bool
(** Test whether the regular expression matches the string. This
returns true if the regexp matches or false otherwise.
@@ -71,6 +71,9 @@ val matches : regexp -> string -> bool
or the thread/program exits. You can call {!sub} to return
these substrings.
+ The [?offset] flag is used to change the start of the search,
+ which by default is at the beginning of the string (position 0).
+
This can raise {!Error} if PCRE returns an error. *)