[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [OSSTEST PATCH 2/3] allow files: Support negation syntax



We now support !<pattern>, which undoes the effect of a <pattern>
specified previously (perhaps in another file).

Note that the logic is a bit poor: !... only undoes the effect of an
identical (or equivalent) earlier pattern; it doesn't provide a
specific override.

Improving that would involve a more invasive change to
sg-report-flight which I don't want to do right now.

Signed-off-by: Ian Jackson <Ian.Jackson@xxxxxxxxxxxxx>
---
 sg-report-flight |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/sg-report-flight b/sg-report-flight
index 062107a..7d804fa 100755
--- a/sg-report-flight
+++ b/sg-report-flight
@@ -76,13 +76,20 @@ while (@ARGV && $ARGV[0] =~ m/^-/) {
                 next unless m/\S/;
                 next if m/^\#/;
                 s/\s+/ /g;
+               my $remove = s/^!\s*//;
                 die if m/ /g > 1;
                 $_ .= ' @@' unless m/ /;
                 s/\@\@/ '[^ ]*' /ge;
                 s/\@/ '[^ -\/]*' /ge;
                 $_= '^(?:'.$_.')$';
-                print DEBUG "ALLOW $_\n";
-                push @allows, $_;
+               my $entry = $_;
+                if (!$remove) {
+                   print DEBUG "ALLOW $entry\n";
+                   push @allows, $entry;
+               } else {
+                   print DEBUG "DEWALLOW $entry\n";
+                   @allows = grep { $_ ne $entry } @allows;
+               }
             }
             A->error and die "$allowfile $!";
             close A or die "$allowfile $!";
-- 
1.7.10.4


_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel


 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.