GNU bug report logs - #7610
Stripping of comments with the `+=' operator

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; Severity: minor; Reported by: Stefano Lattarini <stefano.lattarini@HIDDEN>; dated Fri, 10 Dec 2010 18:02:01 UTC; Maintainer for automake is bug-automake@HIDDEN.
Severity set to 'minor' from 'normal' Request was from Stefano Lattarini <stefano.lattarini@HIDDEN> to control <at> debbugs.gnu.org. Full text available.

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


Received: (at submit) by debbugs.gnu.org; 10 Dec 2010 18:01:17 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Fri Dec 10 13:01:17 2010
Received: from localhost ([127.0.0.1] helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1PR7HR-0004rs-0B
	for submit <at> debbugs.gnu.org; Fri, 10 Dec 2010 13:01:17 -0500
Received: from eggs.gnu.org ([140.186.70.92])
	by debbugs.gnu.org with esmtp (Exim 4.69)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1PR7HP-0004rf-CN
	for submit <at> debbugs.gnu.org; Fri, 10 Dec 2010 13:01:16 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1PR7NB-0006ig-0m
	for submit <at> debbugs.gnu.org; Fri, 10 Dec 2010 13:07:18 -0500
X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,FREEMAIL_FROM,
	RCVD_IN_DNSWL_LOW, T_DKIM_INVALID,
	T_TO_NO_BRKTS_FREEMAIL autolearn=unavailable version=3.3.1
Received: from lists.gnu.org ([199.232.76.165]:39816)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1PR7NA-0006iV-RY
	for submit <at> debbugs.gnu.org; Fri, 10 Dec 2010 13:07:12 -0500
Received: from [140.186.70.92] (port=51534 helo=eggs.gnu.org)
	by lists.gnu.org with esmtp (Exim 4.43) id 1PR7N9-0001Hm-Oi
	for bug-automake@HIDDEN; Fri, 10 Dec 2010 13:07:12 -0500
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1PR7N6-0006gx-Sm
	for bug-automake@HIDDEN; Fri, 10 Dec 2010 13:07:11 -0500
Received: from mail-wy0-f169.google.com ([74.125.82.169]:37859)
	by eggs.gnu.org with esmtp (Exim 4.71)
	(envelope-from <stefano.lattarini@HIDDEN>) id 1PR7N6-0006gW-OR
	for bug-automake@HIDDEN; Fri, 10 Dec 2010 13:07:08 -0500
Received: by wyj26 with SMTP id 26so3925034wyj.0
	for <bug-automake@HIDDEN>; Fri, 10 Dec 2010 10:07:07 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma;
	h=domainkey-signature:received:received:from:to:subject:date
	:user-agent:mime-version:content-type:content-transfer-encoding
	:message-id; bh=dAmNUDZPFb7kbTAtmGJyjWgheBLmhUR/mO4EKDOkVl8=;
	b=TpDguTOqgalnwPImbvo83QuHLEIBDQ+ZriRiFRSNzzbVeYqeZdJh7k1XQpXM1rO+sX
	sJ+SFZExigFYKJHwDnRssyim2ugNsYHuHAyB9zkbvP1ymKSeSZpyq+ue8dlXcHeoDsns
	D6cJwmtQ6nS90Zip7UAWsvMBedbQ+k4QfKTIA=
DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma;
	h=from:to:subject:date:user-agent:mime-version:content-type
	:content-transfer-encoding:message-id;
	b=jlEReM8fGYZs1ygpQntvm0NYzsEbGXAmDxcSIcYl3vw8lyax75cUq/Z0cTpcCpB+a5
	W+7jbsULcP5ObepkUyCFtXlVDEya91WIrcxN8UvjkOTXls2YzSUST3OBtrVJFaxVNZ6l
	5zVSZXuwUU51+X0dbQaAfN8r0dsvHTn690w/g=
Received: by 10.216.156.132 with SMTP id m4mr2372323wek.91.1292004427715;
	Fri, 10 Dec 2010 10:07:07 -0800 (PST)
Received: from bigio.localnet
	(host87-103-dynamic.0-79-r.retail.telecomitalia.it [79.0.103.87])
	by mx.google.com with ESMTPS id p4sm1625502wej.28.2010.12.10.10.07.06
	(version=TLSv1/SSLv3 cipher=RC4-MD5);
	Fri, 10 Dec 2010 10:07:07 -0800 (PST)
From: Stefano Lattarini <stefano.lattarini@HIDDEN>
To: bug-automake@HIDDEN
Subject: Stripping of comments with the `+=' operator
Date: Fri, 10 Dec 2010 19:06:43 +0100
User-Agent: KMail/1.13.3 (Linux/2.6.30-2-686; KDE/4.4.4; i686; ; )
MIME-Version: 1.0
Content-Type: Text/Plain;
  charset="us-ascii"
Content-Transfer-Encoding: 7bit
Message-Id: <201012101906.44467.stefano.lattarini@HIDDEN>
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6 (newer, 2)
X-Spam-Score: -4.3 (----)
X-Debbugs-Envelope-To: submit
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.11
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/pipermail/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>
Sender: debbugs-submit-bounces <at> debbugs.gnu.org
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
X-Spam-Score: -4.6 (----)

Hello automakers.

The current automake implementation of variable-appending operator
`+=' tries to be smart w.r.t. comments in the values; for example:

  $ cat configure.ac
  AC_INIT(x,0)
  AM_INIT_AUTOMAKE
  AC_CONFIG_FILES(Makefile)
  AC_OUTPUT
  $ cat Makefile.am
  foo1 = bar # comment 1
  foo1 += baz # comment 2
  foo2 = bar
  foo2 += baz # comment 3
  foo3 = bar baz # comment 4

results in:

  $ aclocal && automake --foreign --add-missing
  configure.ac:2: installing `./install-sh'
  configure.ac:2: installing `./missing'
  $ grep '^foo[0-9] *=' Makefile.in
  foo1 = bar baz # comment 2
  foo2 = bar baz # comment 3
  foo3 = bar baz # comment 4

which is admittedly better than having something bogus like:
  
   $ cat Makefile.am
   foo = bar # comment
   foo += baz
   $ aclocal && automake ...
   $ grep '^foo *=' Makefile.in
   foo = bar # comment baz

However, the code in automake is apparently not smart enough to detect
that someone might be trying to put a *literal* `#' character in a
variable extended with `+=':

  $ cat configure.ac
  AC_INIT(x,0)
  AM_INIT_AUTOMAKE
  AC_CONFIG_FILES(Makefile)
  AC_OUTPUT
  $ cat Makefile.am
  CDEFS = -D'FOO_STRING="\#\#foo\#\#"'
  CDEFS += -DBAR
  $ aclocal && automake --foreign --add-missing
  configure.ac:2: installing `./install-sh'
  configure.ac:2: installing `./missing'
  $ grep '^CDEFS *=' Makefile.in
  CDEFS = -D'FOO_STRING="\ -DBAR

Now, while the above use of -D'FOO_STRING="\#\#foo\#\#"' in a variable
definition is certainly bound to produce code unportable to some make
implementations, the right thing for automake to do is either to
assume the user knows what he's doing (maybe he's not interested into
portability to those make implementations), or to warn about the 
unportable usage (if `-Wportability' is enabled, obviously).

Silently mangling the value of the resulting value of $(DEFS) is *not*
an acceptale behaviour IMHO, but unfortunately, that's exactly what
automake currently does (as seen above).

Tangentially, note that the definition:
   CDEFS = -D'FOO_STRING="\#\#foo\#\#"'
actually works with at least GNU make, modern FreeBSD make,
and modern NetBSD make:

  $ cat Makefile 
  CDEFS = -D'FOO_STRING="\#\#foo\#\#"'
  all:; @echo $(CDEFS)
  $ make # is either GNU, FreeBSD or NetBSD make
  -DFOO_STRING="##foo##"

and "sorta" works with Solaris 10 make:

  $ /usr/xpg4/bin/make
  -DFOO_STRING="\#\#foo\#\#"
  $ /usr/ccs/bin/make
  -DFOO_STRING="\#\#foo\#\#"

Regards,
   Stefano




Acknowledgement sent to Stefano Lattarini <stefano.lattarini@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-automake@HIDDEN. Full text available.
Report forwarded to owner <at> debbugs.gnu.org, bug-automake@HIDDEN:
bug#7610; 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.