Commit dbe0b69f24421f258da2fb420b58fc1530a9cd03 transscribed the Perl
regexp incorrectly so that it only matched the impossible case of
‘resume=/dev/X’ for a single non-whitespace character X.
This fixes the regular expression, referencing back to the original
Perl code in virt-v2v.
---
v2v/convert_linux.ml | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index f78d18d39..93a6f1732 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -917,7 +917,7 @@ let rec convert (g : G.guestfs) inspect source output rcaps =
List.flatten (List.map Array.to_list (List.map g#aug_match paths)) in
(* Map device names for each entry. *)
- let rex_resume = Str.regexp "^\\(.*resume=\\)\\(/dev/[^ ]\\)\\(.*\\)$"
+ let rex_resume = PCRE.compile "^(.*resume=)(/dev/\\S+)(.*)$"
and rex_device_cciss_p =
Str.regexp "^/dev/\\(cciss/c[0-9]+d[0-9]+\\)p\\([0-9]+\\)$"
and rex_device_cciss =
@@ -943,10 +943,10 @@ let rec convert (g : G.guestfs) inspect source output rcaps =
if String.find path "GRUB_CMDLINE" >= 0 then (
(* Handle grub2 resume=<dev> specially. *)
- if Str.string_match rex_resume value 0 then (
- let start = Str.matched_group 1 value
- and device = Str.matched_group 2 value
- and end_ = Str.matched_group 3 value in
+ if PCRE.matches rex_resume value then (
+ let start = PCRE.sub 1
+ and device = PCRE.sub 2
+ and end_ = PCRE.sub 3 in
let device = replace_if_device path device in
start ^ device ^ end_
)
--
2.13.2