From patchwork Fri Feb 19 17:52:16 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Jackson X-Patchwork-Id: 8363241 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 0A8939F372 for ; Fri, 19 Feb 2016 17:55:00 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 31B192053E for ; Fri, 19 Feb 2016 17:54:59 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 52ED72053D for ; Fri, 19 Feb 2016 17:54:58 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWpEB-0000pS-Qx; Fri, 19 Feb 2016 17:52:27 +0000 Received: from mail6.bemta5.messagelabs.com ([195.245.231.135]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aWpEA-0000pJ-Ih for xen-devel@lists.xenproject.org; Fri, 19 Feb 2016 17:52:26 +0000 Received: from [85.158.139.211] by server-1.bemta-5.messagelabs.com id 84/29-03316-95657C65; Fri, 19 Feb 2016 17:52:25 +0000 X-Env-Sender: prvs=8502c4cf5=Ian.Jackson@citrix.com X-Msg-Ref: server-16.tower-206.messagelabs.com!1455904344!9220247!1 X-Originating-IP: [66.165.176.89] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni44OSA9PiAyMDMwMDc=\n, received_headers: No Received headers X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 36858 invoked from network); 19 Feb 2016 17:52:25 -0000 Received: from smtp.citrix.com (HELO SMTP.CITRIX.COM) (66.165.176.89) by server-16.tower-206.messagelabs.com with RC4-SHA encrypted SMTP; 19 Feb 2016 17:52:25 -0000 X-IronPort-AV: E=Sophos;i="5.22,471,1449532800"; d="scan'208";a="332937076" From: Ian Jackson To: Date: Fri, 19 Feb 2016 17:52:16 +0000 Message-ID: <1455904336-31539-1-git-send-email-ian.jackson@eu.citrix.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1455814560-5406-1-git-send-email-ian.campbell@citrix.com> References: <1455814560-5406-1-git-send-email-ian.campbell@citrix.com> MIME-Version: 1.0 X-DLP: MIA2 Cc: Ian Jackson , Ian Campbell Subject: [Xen-devel] [OSSTEST PATCH] mg-list-all-branches: avoid mistakenly generating `.' in the output X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The regex in mg-list-all-branches assumes that the BRANCHES= will either be a singleton entry separated from the following command by a hard tab or a single quoted list of space separated entries, however the xen-unstable-coverity line is singleton separated from the command by a single space. We could fix this by using a hard tab, but that ends up aligning things in an aesthetically displeasing way, and relying on hard tabs is fragile. Instead, improve the parsing in mg-list-all-branches: break out a couple of semantically (as well as syntactically) common regexp elements out into variables, and then provide two regexps: one which matches shell "assign default values" substitutions, and the other which matches the ordinary shell assignments. We use an empty pair of () in the first regexp to make sure that they both produce the branch name list in $2. (It would be possible to use named capture groups but I'm not sure whether all our perls are recent enough.) I have verified that the actual difference in output right now is just to remove the erroneous `.' entry. Reported-by: Ian Campbell Signed-off-by: Ian Campbell Signed-off-by: Ian Jackson --- mg-list-all-branches | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/mg-list-all-branches b/mg-list-all-branches index 87703c7..62d3ff1 100755 --- a/mg-list-all-branches +++ b/mg-list-all-branches @@ -7,11 +7,16 @@ use Sort::Versions; our %branches; +my $branchvar_re = '(?:EXTRA_)?BRANCHES'; +my $branchchr_re = '[-.0-9a-z ]'; + foreach my $f (qw(cr-for-branches crontab)) { open C, $f or die $!; while () { - next unless m/(?:EXTRA_)?BRANCHES[:+]?='?([-.0-9a-z ]+)/; - $branches{$_}=1 foreach split /\s+/, $1; + next unless + m/\$\{$branchvar_re[:+]?=()($branchchr_re+)\b/ || + m/$branchvar_re[:+]?=('?)($branchchr_re+?)\1\s/; + $branches{$_}=1 foreach split /\s+/, $2; } close C or die $!; }