From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id CAB17138010 for ; Sun, 30 Sep 2012 19:45:12 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id AF78DE060F; Sun, 30 Sep 2012 19:44:58 +0000 (UTC) Received: from mail-pb0-f53.google.com (mail-pb0-f53.google.com [209.85.160.53]) by pigeon.gentoo.org (Postfix) with ESMTP id 53112E060F for ; Sun, 30 Sep 2012 19:44:57 +0000 (UTC) Received: by pbcwz12 with SMTP id wz12so7982230pbc.40 for ; Sun, 30 Sep 2012 12:44:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=IhuObQp2dLLdhuPu1sPiQ5pt4DOwizdaaokRCStH0sA=; b=fFlZ1zrxPKgboKXOG7mbjoZGHvoaxGWVV+f8xtDMC/YZi80DYZLwsbnkpSftWbCbxf /fqRiCqzJ0XWTadJv7/11vyrws+BSnqIn3dT8em1sfbvtE6fnpXLMTnZbJZUYJdGjYCU 9kgFwWGFxBkwg6rtYfbaJ5CKfKq6IKZIQDSrZkQdEVNpR+TkL/tSblFq3fpEvuOotbet Jig0cSEzDyg8J8kuQrj5BCeCv/GsUQiJ8QOyH7RAebf3k0xpD0mwJjzXl7CnM4hYQaRD cYB+eqj0g0OhUQ5zHSPbqFiohKM8OUkqSdNWD3j2fWN2LsGtPVGOuoh6kdjv5Zm8x2RM mdhQ== Received: by 10.68.197.104 with SMTP id it8mr36322743pbc.167.1349034297513; Sun, 30 Sep 2012 12:44:57 -0700 (PDT) Received: from smtp.gmail.com:587 (74-95-192-101-SFBA.hfc.comcastbusiness.net. [74.95.192.101]) by mx.google.com with ESMTPS id i1sm9119644pay.26.2012.09.30.12.44.55 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 30 Sep 2012 12:44:56 -0700 (PDT) Received: by smtp.gmail.com:587 (sSMTP sendmail emulation); Sun, 30 Sep 2012 12:44:55 -0700 Date: Sun, 30 Sep 2012 12:44:55 -0700 From: Brian Harring To: Ulrich Mueller Cc: gentoo-pms@lists.gentoo.org Subject: Re: [gentoo-pms] [PATCH] EAPI must be at least a single char. Message-ID: <20120930194455.GB2180@localhost> References: <1348993716-27744-1-git-send-email-ferringb@gmail.com> <20584.3387.660954.8184@a1i15.kph.uni-mainz.de> Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Package Manager Specification discussions X-BeenThere: gentoo-pms@gentoo.org X-BeenThere: gentoo-pms@lists.gentoo.org Reply-To: gentoo-pms@lists.gentoo.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20584.3387.660954.8184@a1i15.kph.uni-mainz.de> User-Agent: Mutt/1.5.21 (2010-09-15) X-Archives-Salt: 789db3e7-eb87-4324-ad65-757adeb28ece X-Archives-Hash: 5734564984ef3407d2586242175d9576 On Sun, Sep 30, 2012 at 11:13:31AM +0200, Ulrich Mueller wrote: > >>>>> On Sun, 30 Sep 2012, Brian Harring wrote: > > > The example regex allowed for > > EAPI= > > > Which isn't used, alloewd, nor desired; at best, that's short hand > > for EAPI=0. > > The regexp was never meant to match exactly what is allowed. > It matches a superset, and if the matched substring turns out to be an > illegal or unknown EAPI, then the PM can catch it after parsing. > > Otherwise, an empty EAPI is already forbidden by section 3.1 > "Restrictions upon Names". Going by the fact this sort of scenario has come up before for me, I guess I just do things differently. The rules are such that "either an EAPI is matched, or EAPI=0 if the first non blank/non comment isn't a matching EAPI assignment". You want the rules to be left as: "Here's this regex you use to find the EAPI. The actual rules of the EAPI value are off in another part of the doc that we're not going to refer to, but you need to make sure it still is valid despite this regex allowing invalid EAPI's in." Respectfully, that is daft since it's going to result in anyone who tries to write a PM, likely fucking that up. If what you were saying was the actual intention behind it, that assignment would've just been along the lines of EAPI=("[^"]*"|'[^']*'|[^\t ]); aka "here's how you grab what looks like an EAPI assignment". Either way, I strongly disagree with your counterargument of leaving the spec as it is. The following is saner: ^[ \t]*EAPI=(['"]?)([A-Za-z0-9_][A-Za-z0-9+_.-]*)\1[ \t]*([ \t]#.*)?$ And the following multiline match covers the rules in full (ie, ready to go meaning people aren't likely to fuck it up): r"(?:^[ \t]*(?:#[^\n]*)?(?:$|\n))*^[ \t]*EAPI=(['\"]?)([A-Za-z0-9][A-Za-z0-9+_.-]*)\1" Roughly, if the spec is left the way you intend it, EAPI=-1 will get picked up, then it's reliant on the PM to spot it/explode; which in a quick check of portages source, it doesn't do. Now, if a QA tool wants to use a looser version to spot EAPI assignments of an invalid EAPI, have at it; but the core spec's "find an eapi via this" should block invalid EAPI's from being picked up, period. ~harring