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

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