From wollman@hergotha.csail.mit.edu  Mon Nov 29 03:47:43 2010
Return-Path: <wollman@hergotha.csail.mit.edu>
Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34])
	by hub.freebsd.org (Postfix) with ESMTP id BB770106564A
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 29 Nov 2010 03:47:43 +0000 (UTC)
	(envelope-from wollman@hergotha.csail.mit.edu)
Received: from hergotha.csail.mit.edu (wollman-1-pt.tunnel.tserv4.nyc4.ipv6.he.net [IPv6:2001:470:1f06:ccb::2])
	by mx1.freebsd.org (Postfix) with ESMTP id 6279C8FC08
	for <FreeBSD-gnats-submit@freebsd.org>; Mon, 29 Nov 2010 03:47:43 +0000 (UTC)
Received: from hergotha.csail.mit.edu (localhost [127.0.0.1])
	by hergotha.csail.mit.edu (8.14.4/8.14.4) with ESMTP id oAT3lgQ7001897
	for <FreeBSD-gnats-submit@freebsd.org>; Sun, 28 Nov 2010 22:47:42 -0500 (EST)
	(envelope-from wollman@hergotha.csail.mit.edu)
Received: (from wollman@localhost)
	by hergotha.csail.mit.edu (8.14.4/8.14.4/Submit) id oAT3lguR001896;
	Sun, 28 Nov 2010 22:47:42 -0500 (EST)
	(envelope-from wollman)
Message-Id: <201011290347.oAT3lguR001896@hergotha.csail.mit.edu>
Date: Sun, 28 Nov 2010 22:47:42 -0500 (EST)
From: Garrett Wollman <wollman@hergotha.csail.mit.edu>
Reply-To: Garrett Wollman <wollman@hergotha.csail.mit.edu>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: parallel make sometimes gets working dir confused
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         152661
>Category:       bin
>Synopsis:       parallel make sometimes gets working dir confused
>Confidential:   no
>Severity:       serious
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Nov 29 03:50:09 UTC 2010
>Closed-Date:    
>Last-Modified:  Mon Nov 29 05:40:06 UTC 2010
>Originator:     Garrett Wollman
>Release:        FreeBSD 8.1-RELEASE-p1 amd64
>Organization:
MIT Computer Science & Artificial Intelligence Laboratory
>Environment:
System: FreeBSD hergotha.csail.mit.edu 8.1-RELEASE-p1 FreeBSD 8.1-RELEASE-p1 #1 r215854M: Sat Nov 27 02:07:10 EST 2010 wollman@hergotha.csail.mit.edu:/usr/obj/usr/src/sys/HERGOTHA amd64

System Heimdal expunged; MIT Kerberos installed from ports.

>Description:

A parallel build of the current OpenAFS source fails in a strange way:
one command is not executed in the correct working directory.  The
top-level OpenAFS Makefile was slightly altered to show the working
directory prior to executing the command which fails, and confirms
this (seen in the output of "make -P -j2 -dj"):

Process 54997 exited or stopped.
Job queue is no longer full.
Results of making cmdebug:
gcc  -L/usr/home/buildbot/openafs-master/openafs/lib  -O    -g -O2  -O  -I/usr/home/buildbot/openafs-master/openafs/src/config -I/usr/home/buildbot/openafs-master/openafs/include  -I. -I.     -O2 -pipe -fPIC   -o cmdebug cmdebug.o /usr/home/buildbot/openafs-master/openafs/lib/libsys.a  /usr/home/buildbot/openafs-master/openafs/lib/libafsint.a  /usr/home/buildbot/openafs-master/openafs/lib/librxkad.a  /usr/home/buildbot/openafs-master/openafs/lib/libauth.a  /usr/home/buildbot/openafs-master/openafs/lib/libcom_err.a  /usr/home/buildbot/openafs-master/openafs/lib/libcmd.a  /usr/home/buildbot/openafs-master/openafs/lib/librx.a  /usr/home/buildbot/openafs-master/openafs/lib/libsys.a  /usr/home/buildbot/openafs-master/openafs/lib/liblwp.a  /usr/home/buildbot/openafs-master/openafs/lib/libafsutil.a -lrokenafs 
Process 54997 exited.
*** Completed successfully
echo -n 'cwd is '; pwd && cd src && cd venus/test && make all
cwd is /usr/home/buildbot/openafs-master/openafs/src/venus
cd: can't cd to src
Process 54940 exited.
*** Error code 2
1 error
Process 48701 exited.
*** Error code 2
1 error
Process 48699 exited.
*** Error code 2
1 error

The command line starting with "echo" above is from the top-level
Makefile, /usr/home/buildbot/openafs-master/openafs/Makefile, and
should be executed there, but instead it's executed in the same
directory as the previous command.  (The original Makefile does not
include the echo or the pwd command; the line in question is the only
one that mentions "venus/test".)

>How-To-Repeat:

Check out the current OpenAFS sources from
git://git.openafs.org/openafs.git (revision
3f69d7247cfbd809aeed1e4d943c2b21da035654 if I'm reading the entrails
correctly).  Run regen.sh and configure according to the
documentation.

Run "make -j2".  Watch it fail.  Run plain "make" and watch it
succeed.  Run "gmake -j2" and watch it succeed.

>Fix:

Only workaround is to use GNU make or to eschew parallel make.
>Release-Note:
>Audit-Trail:

From: Garrett Wollman <wollman@bimajority.org>
To: bug-followup@FreeBSD.org
Cc:  
Subject: Re: bin/152661: parallel make sometimes gets working dir confused
Date: Mon, 29 Nov 2010 00:37:05 -0500

 Using the "-B" flag (to suppress shell sharing) also works around this
 bug.
 
 -GAWollman
>Unformatted:
