Shahar Lev
2015-Sep-12 14:52 UTC
[Libguestfs] [PATCH] v2v: fix provides list whitespace trim
Tabs should not be doubly-escaped in regexp. Signed-off-by: Shahar Lev <shahar@stratoscale.com> --- v2v/convert_linux.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml index adbcaa2..1e9e689 100644 --- a/v2v/convert_linux.ml +++ b/v2v/convert_linux.ml @@ -581,7 +581,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source List.filter (fun s -> string_find s library = -1) provides in (* Trim whitespace. *) - let rex = Str.regexp "^[ \\t]*\\([^ \\t]+\\)[ \\t]*$" in + let rex = Str.regexp "^[ \t]*\\([^ \t]+\\)[ \t]*$" in let provides = List.map (Str.replace_first rex "\\1") provides in (* Install the dependencies with yum. Use yum explicitly -- 2.1.0
Richard W.M. Jones
2015-Sep-13 10:49 UTC
Re: [Libguestfs] [PATCH] v2v: fix provides list whitespace trim
On Sat, Sep 12, 2015 at 05:52:55PM +0300, Shahar Lev wrote:> Tabs should not be doubly-escaped in regexp. > > Signed-off-by: Shahar Lev <shahar@stratoscale.com> > --- > v2v/convert_linux.ml | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/v2v/convert_linux.ml b/v2v/convert_linux.ml > index adbcaa2..1e9e689 100644 > --- a/v2v/convert_linux.ml > +++ b/v2v/convert_linux.ml > @@ -581,7 +581,7 @@ let rec convert ~keep_serial_console (g : G.guestfs) inspect source > List.filter (fun s -> string_find s library = -1) provides in > > (* Trim whitespace. *) > - let rex = Str.regexp "^[ \\t]*\\([^ \\t]+\\)[ \\t]*$" in > + let rex = Str.regexp "^[ \t]*\\([^ \t]+\\)[ \t]*$" in > let provides = List.map (Str.replace_first rex "\\1") provides in > > (* Install the dependencies with yum. Use yum explicitlyYes, nasty mistake. In the crappy Str library that we have to use, \t means a literal 't' character :-( ACKed and pushed, thanks! Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com libguestfs lets you edit virtual machines. Supports shell scripting, bindings from many languages. http://libguestfs.org