From: Ian Jackson Subject: [OSSTEST PATCH 2/3] allow files: Support negation syntax Date: Tue, 3 Mar 2015 13:18:24 +0000 Message-ID: <1425388705-13278-2-git-send-email-ian.jackson@eu.citrix.com> References: <1425388705-13278-1-git-send-email-ian.jackson@eu.citrix.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1YSmib-00020o-TU for xen-devel@lists.xenproject.org; Tue, 03 Mar 2015 13:18:38 +0000 In-Reply-To: <1425388705-13278-1-git-send-email-ian.jackson@eu.citrix.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xenproject.org Cc: Ian Jackson , Ian Campbell List-Id: xen-devel@lists.xenproject.org We now support !, which undoes the effect of a 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 --- 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