[Libguestfs] [PATCH 1/2] podwrapper: Give an error if an --insert or --verbatim pattern is not found in the input.

Richard W.M. Jones rjones at redhat.com
Tue Mar 18 13:31:49 UTC 2014


---
 podwrapper.pl.in | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/podwrapper.pl.in b/podwrapper.pl.in
index 61d5e12..74432ad 100755
--- a/podwrapper.pl.in
+++ b/podwrapper.pl.in
@@ -274,7 +274,10 @@ foreach (@inserts) {
     my @a = split /:/, $_, 2;
     die "$progname: $input: no colon in parameter of --insert\n" unless @a >= 2;
     my $replacement = read_whole_file ($a[0]);
+    my $oldcontent = $content;
     $content =~ s/$a[1]/$replacement/ge;
+    die "$progname: $input: could not find pattern '$a[1]' in input file\n"
+        if $content eq $oldcontent;
 }
 
 # Perform @verbatims.
@@ -282,7 +285,10 @@ foreach (@verbatims) {
     my @a = split /:/, $_, 2;
     die "$progname: $input: no colon in parameter of --verbatim\n" unless @a >= 2;
     my $replacement = read_verbatim_file ($a[0]);
+    my $oldcontent = $content;
     $content =~ s/$a[1]/$replacement/ge;
+    die "$progname: $input: could not find pattern '$a[1]' in input file\n"
+        if $content eq $oldcontent;
 }
 
 if ($strict_checks) {
-- 
1.8.5.3




More information about the Libguestfs mailing list