Blame SOURCES/0015-v2v-Remove-use-of-anchored.patch

b85204
From 8802e8b4135c913f206508c8f7650a9f99ee6667 Mon Sep 17 00:00:00 2001
b85204
From: "Richard W.M. Jones" <rjones@redhat.com>
b85204
Date: Mon, 30 Jan 2023 09:17:33 +0000
b85204
Subject: [PATCH] v2v: Remove use of ~anchored
b85204
b85204
In various places we used PCRE.compile ~anchored:true (PCRE2_ANCHORED)
b85204
thinking it means that the regular expression is anchored at both
b85204
ends.  However this is not what it means (it only anchors the start).
b85204
Replace with ^...$
b85204
b85204
(cherry picked from commit 8c316ed125e26583edc72eb9e953499b0078dcbd)
b85204
---
b85204
 in-place/in_place.ml   | 4 ++--
b85204
 inspector/inspector.ml | 4 ++--
b85204
 v2v/v2v.ml             | 4 ++--
b85204
 3 files changed, 6 insertions(+), 6 deletions(-)
b85204
b85204
diff --git a/in-place/in_place.ml b/in-place/in_place.ml
b85204
index 55541814..f76651e6 100644
b85204
--- a/in-place/in_place.ml
b85204
+++ b/in-place/in_place.ml
b85204
@@ -29,8 +29,8 @@ open Types
b85204
 open Utils
b85204
 
b85204
 (* Matches --mac command line parameters. *)
b85204
-let mac_re = PCRE.compile ~anchored:true "([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)"
b85204
-let mac_ip_re = PCRE.compile ~anchored:true "([[:xdigit:]]|:|\\.)+"
b85204
+let mac_re = PCRE.compile "^([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)$"
b85204
+let mac_ip_re = PCRE.compile "^([[:xdigit:]]|:|\\.)+$"
b85204
 
b85204
 let rec main () =
b85204
   let set_string_option_once optname optref arg =
b85204
diff --git a/inspector/inspector.ml b/inspector/inspector.ml
b85204
index 13d58df3..d12d85c2 100644
b85204
--- a/inspector/inspector.ml
b85204
+++ b/inspector/inspector.ml
b85204
@@ -30,8 +30,8 @@ open Utils
b85204
 open DOM
b85204
 
b85204
 (* Matches --mac command line parameters. *)
b85204
-let mac_re = PCRE.compile ~anchored:true "([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)"
b85204
-let mac_ip_re = PCRE.compile ~anchored:true "([[:xdigit:]]|:|\\.)+"
b85204
+let mac_re = PCRE.compile "^([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)$"
b85204
+let mac_ip_re = PCRE.compile "^([[:xdigit:]]|:|\\.)+$"
b85204
 
b85204
 let rec main () =
b85204
   let set_string_option_once optname optref arg =
b85204
diff --git a/v2v/v2v.ml b/v2v/v2v.ml
b85204
index 1e8d03ef..7a01eab5 100644
b85204
--- a/v2v/v2v.ml
b85204
+++ b/v2v/v2v.ml
b85204
@@ -34,8 +34,8 @@ open Types
b85204
 open Utils
b85204
 
b85204
 (* Matches --mac command line parameters. *)
b85204
-let mac_re = PCRE.compile ~anchored:true "([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)"
b85204
-let mac_ip_re = PCRE.compile ~anchored:true "([[:xdigit:]]|:|\\.)+"
b85204
+let mac_re = PCRE.compile "^([[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}:[[:xdigit:]]{2}):(network|bridge|ip):(.*)$"
b85204
+let mac_ip_re = PCRE.compile "^([[:xdigit:]]|:|\\.)+$"
b85204
 
b85204
 let rec main () =
b85204
   let set_string_option_once optname optref arg =