From ae160215ca02b2d48568dc595e0c8861900ed73c Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Sat, 21 Jan 2017 05:22:36 -0500 Subject: [PATCH] RHEL 5: p2v: Workarounds for limited partial match support in ancient PCRE. In the ancient version of PCRE in RHEL 5, partial match support does not support /.*/, returning PCRE_ERROR_BADPARTIAL. However the equivalent regular expression /(?:.)*/ works fine, so use that instead. --- p2v/ssh.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/p2v/ssh.c b/p2v/ssh.c index 9961e7a93..2dbc109d4 100644 --- a/p2v/ssh.c +++ b/p2v/ssh.c @@ -163,15 +163,21 @@ compile_regexps (void) } while (0) COMPILE (password_re, "password:", 0); - COMPILE (ssh_message_re, "(ssh: .*)", 0); + /* Note that (?:.)* is required in order to work around a problem + * with partial matching and PCRE in RHEL 5. + */ + COMPILE (ssh_message_re, "(ssh: (?:.)*)", 0); COMPILE (sudo_password_re, "sudo: a password is required", 0); /* The magic synchronization strings all match this expression. See * start_ssh function below. */ COMPILE (prompt_re, "###((?:[0123456789abcdefghijklmnopqrstuvwxyz]){8})### ", 0); + /* Note that (?:.)* is required in order to work around a problem + * with partial matching and PCRE in RHEL 5. + */ COMPILE (version_re, - "virt-v2v ([1-9].*)", + "virt-v2v ([1-9](?:.)*)", 0); COMPILE (feature_libguestfs_rewrite_re, "libguestfs-rewrite", 0); COMPILE (feature_colours_option_re, "colours-option", 0);