]> xenbits.xensource.com Git - people/liuw/osstest.git/commitdiff
allow files: Support negation syntax
authorIan Jackson <ian.jackson@eu.citrix.com>
Tue, 3 Mar 2015 13:13:02 +0000 (13:13 +0000)
committerIan Jackson <Ian.Jackson@eu.citrix.com>
Tue, 3 Mar 2015 14:06:18 +0000 (14:06 +0000)
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@eu.citrix.com>
sg-report-flight

index 062107ade4acb83a0f154dc63e82867c0ecbe14e..d2aff58a724f87dfa32a08fe2ddb6d805e4cdafa 100755 (executable)
@@ -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 "DEALLOW $entry\n";
+                   @allows = grep { $_ ne $entry } @allows;
+               }
             }
             A->error and die "$allowfile $!";
             close A or die "$allowfile $!";