[Libguestfs] [PATCH] v2v: fix regex replacement in grub2_update_console

Tomáš Golembiovský tgolembi at redhat.com
Sat Aug 6 18:04:53 UTC 2016


The replacement string was wrong. There are only two match groups in the
regular expression, not three.

Signed-off-by: Tomáš Golembiovský <tgolembi at redhat.com>
---
 v2v/convert_linux.ml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml
index 06943cd..4b1ce99 100644
--- a/v2v/convert_linux.ml
+++ b/v2v/convert_linux.ml
@@ -1057,9 +1057,9 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source rcaps =
       if Str.string_match rex grub_cmdline 0 then (
         let new_grub_cmdline =
           if not remove then
-            Str.global_replace rex "\\1console=ttyS0\\3" grub_cmdline
+            Str.global_replace rex "\\1console=ttyS0\\2" grub_cmdline
           else
-            Str.global_replace rex "\\1\\3" grub_cmdline in
+            Str.global_replace rex "\\1\\2" grub_cmdline in
         g#aug_set path new_grub_cmdline;
         g#aug_save ();
 
-- 
2.9.2





More information about the Libguestfs mailing list