NetBSD Problem Report #45027

From dholland@macaran.localdomain  Mon Jun  6 01:29:50 2011
Return-Path: <dholland@macaran.localdomain>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by www.NetBSD.org (Postfix) with ESMTP id D2B4863BA4F
	for <gnats-bugs@gnats.NetBSD.org>; Mon,  6 Jun 2011 01:29:50 +0000 (UTC)
Message-Id: <20110606013059.122D16E1D5@macaran.localdomain>
Date: Sun,  5 Jun 2011 21:30:58 -0400 (EDT)
From: dholland@eecs.harvard.edu
Reply-To: dholland@eecs.harvard.edu
To: gnats-bugs@gnats.NetBSD.org
Subject: make: yacc/mkdep build race
X-Send-Pr-Version: 3.95

>Number:         45027
>Category:       bin
>Synopsis:       make: yacc/mkdep build race
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Mon Jun 06 01:30:00 +0000 2011
>Originator:     David A. Holland
>Release:        NetBSD 5.99.52 (20110605)
>Organization:
>Environment:
System: NetBSD macaran 5.99.49 NetBSD 5.99.49 (MACARAN) #8: Mon Apr 11 19:54:18 EDT 2011 dholland@macaran:/usr/src/sys/arch/amd64/compile/MACARAN amd64
Architecture: x86_64
Machine: amd64
>Description:

When running a -j8 build just now I got the following failure in libc:

   nsparser.c:81:1: error: unterminated #ifndef

Since the 3rd line of nsparser.c is the terminating endif for the
ifndef, the file is yacc output, and the failure wasn't repeatble, it
appears to be a parallelism bug.

It looks as if what happened is that one make subprocess resolved
suffix rules and started creating nsparser.c from nsparser.y, and then
as yacc was writing it, another subprocess resolved suffix rules,
found that nsparser.c existed and was newer than nsparser.y, and fired
off mkdep on it, which then failed miserably. Or something like that.

I originally was going to file this as a makefile bug, but now I'm
leaning towards calling it a make bug. That is, suffix rules should
ultimately generate definite nodes in the dependency graph, and make
is supposed to know better than to fire off a recipe that depends on
something else while the recipe for generating that something is still
running.

That is, it looks as if what happened is that the .c.d rule for
nsparser.d fired off while the .y.c rule for nsparser.c was still
running.

Nonetheless, fixing this in make is probably going to be painful at
best (unless I have totally the wrong idea about how it processes
suffix rules, which is possible, but in that case I don't understand
what broke) so we probably want a workaround in bsd.sys.mk too.

>How-To-Repeat:

Have a previous build fail in just the right place (so as to have the
exact right combination of preexisting build products) and do build.sh
-u -j8.

>Fix:

will suck.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.