GNU bug report logs - #18734
[PATCH] vala: Improper parsing of valac arguments leads to garbage in DIST_COMMON

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: automake; Reported by: Colomban Wendling <lists.ban@HIDDEN>; Keywords: patch; dated Wed, 15 Oct 2014 15:44:01 UTC; Maintainer for automake is bug-automake@HIDDEN.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 15 Oct 2014 15:43:18 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Oct 15 11:43:18 2014
Received: from localhost ([127.0.0.1]:44605 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XeQjM-00070d-Pz
	for submit <at> debbugs.gnu.org; Wed, 15 Oct 2014 11:43:17 -0400
Received: from eggs.gnu.org ([208.118.235.92]:44359)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <lists.ban@HIDDEN>) id 1XeQKK-0006LI-03
 for submit <at> debbugs.gnu.org; Wed, 15 Oct 2014 11:17:24 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <lists.ban@HIDDEN>) id 1XeQKD-0007J0-IO
 for submit <at> debbugs.gnu.org; Wed, 15 Oct 2014 11:17:23 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.0 required=5.0 tests=BAYES_20,T_DKIM_INVALID,
 UNPARSEABLE_RELAY autolearn=disabled version=3.3.2
Received: from lists.gnu.org ([2001:4830:134:3::11]:60983)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <lists.ban@HIDDEN>) id 1XeQKD-0007Iu-GO
 for submit <at> debbugs.gnu.org; Wed, 15 Oct 2014 11:17:17 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:45969)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <lists.ban@HIDDEN>) id 1XeQK8-0008Oe-A1
 for bug-automake@HIDDEN; Wed, 15 Oct 2014 11:17:17 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <lists.ban@HIDDEN>) id 1XeQK0-0007GF-Tl
 for bug-automake@HIDDEN; Wed, 15 Oct 2014 11:17:12 -0400
Received: from a4nancy.globenet.org ([80.67.172.114]:54148
 helo=mail.herbesfolles.org) by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <lists.ban@HIDDEN>) id 1XeQK0-0007F2-L8
 for bug-automake@HIDDEN; Wed, 15 Oct 2014 11:17:04 -0400
Received: from [127.0.0.1] (localhost [127.0.0.1]) with ESMTPSA id AE51022BB3
DKIM-Signature: v=1; a=rsa-sha256; c=simple/simple; d=herbesfolles.org;
 s=alternc; t=1413386221;
 bh=UxmiLOJN9pBf84yuRk87q7ceM18YLYlhSA/ns8e9C0Q=;
 h=Date:From:To:Subject;
 b=UIWStTtSSW776tTOVV+2NDIRWNPTKXZaxTTilP2hN/9iAItmJBWxtIppn+ljQetWb
 5XmrsVh8879oEkzpZRULJ+5qia55aWvXOmiGzNbApAhWAN7SLZGv2RfE671KiY9Ztn
 Aor4fzD4rRbkwbHg7nrE/Rjsad0R9LVPVNPqN3KE=
Message-ID: <543E8FEC.7030007@HIDDEN>
Date: Wed, 15 Oct 2014 17:17:00 +0200
From: Colomban Wendling <lists.ban@HIDDEN>
User-Agent: Mozilla/5.0 (X11; Linux x86_64;
 rv:31.0) Gecko/20100101 Icedove/31.1.2
MIME-Version: 1.0
To: bug-automake@HIDDEN
Subject: [PATCH] vala: Improper parsing of valac arguments leads to garbage
 in DIST_COMMON
Content-Type: multipart/mixed; boundary="------------020005010504040701000400"
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x
X-detected-operating-system: by eggs.gnu.org: Error: Malformed IPv6 address
 (bad octet value).
X-Received-From: 2001:4830:134:3::11
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Wed, 15 Oct 2014 11:43:14 -0400
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

This is a multi-part message in MIME format.
--------------020005010504040701000400
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Hi,

The parsing of valac flags is too permissive and incorrectly matches
some input, possibly leading to garbage in DIST_COMMON -- and then,
build failures.

The problem is that parsing of valac flags uses a non-anchored pattern
and so any argument happening to be a subset of a parsed argument will
match it, e.g. `vapi` will match against `--vapi` or `--internal-vapi`.

E.g. when using the following:

	something_VALAFLAGS = --vapidir vapi --pkg foo

`--pkg` is recognized as an interesting argument (and so, added to
`DIST_COMMON`) because `vapi` (the argument for `--vapidir`) matched
against `--vapi`.

Please find attached a patch fixing the issue.

Regards,
Colomban

--------------020005010504040701000400
Content-Type: text/x-patch;
 name="0001-vala-Fix-parsing-valac-flags.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename="0001-vala-Fix-parsing-valac-flags.patch"

From 16bb54572db217e14e0a024bacf33ab693ea10ec Mon Sep 17 00:00:00 2001
From: Colomban Wendling <ban@HIDDEN>
Date: Wed, 15 Oct 2014 16:22:13 +0200
Subject: [PATCH] vala: Fix parsing valac flags
To: lists.ban@HIDDEN

When parsing valac flags, ensure complete matches not to e.g. match
`vapi` against `--vapi` or `--internal-vapi`.  This fixes parsing when
one of the flags value is a subset of one of the flags we match.

E.g. when using the following:

	something_VALAFLAGS=--vapidir vapi --pkg foo

`--pkg` used to be recognized as an interesting argument (and so, added
to `DIST_COMMON`) because `vapi` (the argument for `--vapidir`) matched
against `--vapi`.
---
 bin/automake.in | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/bin/automake.in b/bin/automake.in
index 4cee0d0..832b208 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -5436,8 +5436,8 @@ sub lang_vala_finish_target
       my $lastflag = '';
       foreach my $flag ($flags->value_as_list_recursive)
 	{
-	  if (grep (/$lastflag/, ('-H', '-h', '--header', '--internal-header',
-	                          '--vapi', '--internal-vapi', '--gir')))
+	  if (grep (/^$lastflag$/, ('-H', '-h', '--header', '--internal-header',
+	                            '--vapi', '--internal-vapi', '--gir')))
 	    {
 	      my $headerfile = "\$(srcdir)/$flag";
 	      $output_rules .= "$headerfile: \$(srcdir)/${derived}_vala.stamp\n"
-- 
2.1.1


--------------020005010504040701000400--




Acknowledgement sent to Colomban Wendling <lists.ban@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-automake@HIDDEN. Full text available.
Report forwarded to bug-automake@HIDDEN:
bug#18734; Package automake. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.