NetBSD Problem Report #29545
From wiz@dmath5.geometrie.tuwien.ac.at Sun Feb 27 12:11:59 2005
Return-Path: <wiz@dmath5.geometrie.tuwien.ac.at>
Received: from dmath5.geometrie.tuwien.ac.at (dmath5.geometrie.tuwien.ac.at [128.130.42.105])
by narn.netbsd.org (Postfix) with ESMTP id 1039C63B104
for <gnats-bugs@gnats.NetBSD.org>; Sun, 27 Feb 2005 12:11:59 +0000 (UTC)
Message-Id: <20050227121016.9065E294B2@dmath5.geometrie.tuwien.ac.at>
Date: Sun, 27 Feb 2005 13:10:16 +0100 (CET)
From: Thomas Klausner <wiz@NetBSD.org>
Reply-To: Thomas Klausner <wiz@NetBSD.org>
To: gnats-bugs@netbsd.org
Subject: make(1) accepts .else* as .else
X-Send-Pr-Version: 3.95
>Number: 29545
>Category: bin
>Synopsis: make(1) accepts .else* as .else
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: bin-bug-people
>State: closed
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Sun Feb 27 12:12:01 +0000 2005
>Closed-Date: Sat Sep 24 08:56:43 +0000 2005
>Last-Modified: Sat Sep 24 08:56:43 +0000 2005
>Originator: Thomas Klausner
>Release: NetBSD 2.0
>Organization:
>Environment:
System: NetBSD dmath5.geometrie.tuwien.ac.at 2.0 NetBSD 2.0 (RAFFAELO) #0: Wed Dec 15 16:47:17 CET 2004 wiz@dmath5.geometrie.tuwien.ac.at:/home/2.0-src/sys/arch/i386/compile/RAFFAELO i386
Architecture: i386
Machine: i386
>Description:
make(1) accepts every string that starts with ".else" as ".else".
In particular, this is annoying because people forget it's ".elif"
and not ".elseif" and make doesn't even warn about it, except if
there is another ".else*".
>How-To-Repeat:
Use the following make rules:
.if defined(A)
a:
echo a
.elseidontcare
b:
echo not a
.endif
>Fix:
Not provided.
>Release-Note:
>Audit-Trail:
From: Robert Elz <kre@munnari.OZ.AU>
To: gnats-bugs@NetBSD.org
Cc: lukem@NetBSD.org, wiz@NetBSD.org
Subject: Re: bin/29545: make(1) accepts .else* as .else
Date: Wed, 02 Mar 2005 17:22:03 +0700
Date: Sun, 27 Feb 2005 12:12:01 +0000 (UTC)
From: Thomas Klausner <wiz@NetBSD.org>
Message-ID: <20050227121201.17F4463B117@narn.netbsd.org>
| make(1) accepts every string that starts with ".else" as ".else".
Ugh - the code in there is truly disgusting.
| >Fix:
| Not provided.
Here's a patch that "solves" that particular problem. Make treats
unknown .xxx's inside a conditional (that's being skipped) as simply
noise
.if 0
. this is a comment...
.endif
which is really pretty dumb - unrecognisable '.' lines should be
errors whether inside a .if or outside it (this is quite different than
attempting to evaluate the expression in a .if if the line is being
skipped - that clearly shouldn't be done).
That problem I haven't attempted to solve.
The effect is that now
.if whatever
.elseif
.endif
has a 50/50 chance of being reported as an error (will be if whatever
is true, the whole thing will simply be ignored if whatever is false).
At least that's the same now as .any-other-junk
This patch is truly ugly (like the rest of the code in this part of make)
but appears to work. Apologies for the ugly indentation style. I truly
detest code written with a normal indent setting != 8.
kre
Index: cond.c
===================================================================
RCS file: /cvsroot/NetBSD/src/usr.bin/make/cond.c,v
retrieving revision 1.19.2.5
diff -u -r1.19.2.5 cond.c
--- cond.c 10 May 2004 15:44:10 -0000 1.19.2.5
+++ cond.c 2 Mar 2005 09:58:29 -0000
@@ -1275,7 +1275,8 @@
* "else", it's a valid conditional whose value is the inverse
* of the previous if we parsed.
*/
- if (isElse && (line[0] == 's') && (line[1] == 'e')) {
+ if (isElse && (line[0] == 's') && (line[1] == 'e') &&
+ !isalpha(line[2]) && !isdigit(line[2])) {
if (finalElse[condTop][skipIfLevel]) {
Parse_Error (PARSE_WARNING, "extra else");
} else {
From: Ed Gould <ed@left.wing.org>
To: gnats-bugs@netbsd.org
Cc:
Subject: Re: bin/29545: make(1) accepts .else* as .else
Date: Wed, 02 Mar 2005 08:18:47 -0800
> I truly detest code written with a normal indent setting != 8.
I don't have a problem with 4-space indents (but it took me a while to
get used to them). What I can't abide is people who don't understand
is that "tab stops are every 8 spaces" is a constant of the universe,
and try to use tabs for 4-space indents.
--Ed
State-Changed-From-To: open->closed
State-Changed-By: dsl@netbsd.org
State-Changed-When: Sat, 24 Sep 2005 08:56:43 +0000
State-Changed-Why:
This was fixed prior to NetBSD 3
>Unformatted:
(Contact us)
$NetBSD: query-full-pr,v 1.51 2026/08/10 02:28:17 riastradh Exp $
$NetBSD: gnats_config.sh,v 1.10 2026/05/13 22:00:09 riastradh Exp $
Copyright © 1994-2026
The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.