NetBSD Problem Report #38031

From martin@duskware.de  Thu Feb 14 20:22:54 2008
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 77B3463B101
	for <gnats-bugs@gnats.netbsd.org>; Thu, 14 Feb 2008 20:22:54 +0000 (UTC)
Message-Id: <20080214190915.91BD863B101@narn.NetBSD.org>
Date: Thu, 14 Feb 2008 19:09:15 +0000 (UTC)
From: stutsman@cs.stanford.edu
Reply-To: stutsman@cs.stanford.edu
To: netbsd-bugs-owner@NetBSD.org
Subject: fork/wait return/take type pid_t not int in bmake
X-Send-Pr-Version: www-1.0

>Number:         38031
>Category:       toolchain
>Synopsis:       fork/wait return/take type pid_t not int in bmake
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    toolchain-manager
>State:          closed
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Feb 14 20:25:00 +0000 2008
>Closed-Date:    Sun Feb 22 07:44:52 +0000 2009
>Last-Modified:  Sun Feb 22 07:44:52 +0000 2009
>Originator:     Ryan Stutsman
>Release:        None; HiStar amd64
>Organization:
Stanford University
>Environment:
Linux histar-box HiStar devel x86_64 GNU/Linux

>Description:
In trying to run pkgsrc/bootstrap/bootstrap bmake must be build.  The bootstrap version of bmake compiles successfully but fails to run non-deterministically because HiStar uses 64-bit pid_t and bmake naively stores the return from vfork as int.

A patch is given to modify the storage for the pid to be type pid_t instead of int.

To ensure bmake (and, thus, pkgsrc) portability the storage of the return type should match the function declaration.

This probably affects trunk NetBSD's make as well, though I haven't looked since I'm not using this on NetBSD.  If additional work needs to be done to correct the mainline copy of make I'd be happy to take care of it as well.
>How-To-Repeat:
Run the HiStar amd64 iso, untar pkgsrc in any directory and run the bootstrap script.  Once the build procedure starts invoking the bmake.boot  that it has built forks will begin to fail non-deterministically.
>Fix:
--- files/compat.c	2008-02-14 18:48:13.000000000 +0000
+++ files/compat.c.orig	2008-02-14 18:37:22.000000000 +0000
@@ -214,8 +214,8 @@
 		  errCheck; 	/* Check errors */
     WAIT_T 	  reason;   	/* Reason for child's death */
     int    	  status;   	/* Description of child's death */
-    pid_t    	  cpid;	    	/* Child actually found */
-    pid_t	  retstat;    	/* Status of fork */
+    int	    	  cpid;	    	/* Child actually found */
+    ReturnStatus  retstat;    	/* Status of fork */
     LstNode 	  cmdNode;  	/* Node where current command is located */
     const char  **av;	    	/* Argument vector for thing to exec */
     int	    	  argc;	    	/* Number of arguments in av or 0 if not

>Release-Note:

>Audit-Trail:

Responsible-Changed-From-To: toolchain-manager->pkg-manager
Responsible-Changed-By: tnn@narn.netbsd.org
Responsible-Changed-When: Thu, 14 Feb 2008 22:28:32 +0000
Responsible-Changed-Why:
Christos fixed it in src, reassigning to pkg-manager pending bmake update.


State-Changed-From-To: open->analyzed
State-Changed-By: obache@NetBSD.org
State-Changed-When: Thu, 06 Mar 2008 05:13:18 +0000
State-Changed-Why:
Pending bmake update.


Responsible-Changed-From-To: pkg-manager->toolchain-manager
Responsible-Changed-By: tnn@NetBSD.org
Responsible-Changed-When: Sun, 09 Mar 2008 20:23:00 +0000
Responsible-Changed-Why:
Reopen and give back to toolchain-manager, the change was reverted.


State-Changed-From-To: analyzed->open
State-Changed-By: tnn@NetBSD.org
State-Changed-When: Sun, 09 Mar 2008 20:23:00 +0000
State-Changed-Why:
Reopen and give back to toolchain-manager, the change was reverted.


From: "David A. Holland" <dholland@netbsd.org>
To: gnats-bugs@gnats.NetBSD.org
Cc: 
Subject: PR/38031 CVS commit: src/usr.bin/make
Date: Sun, 22 Feb 2009 07:33:00 +0000 (UTC)

 Module Name:	src
 Committed By:	dholland
 Date:		Sun Feb 22 07:33:00 UTC 2009

 Modified Files:
 	src/usr.bin/make: compat.c

 Log Message:
 Use pid_t for the result of fork and wait. PR 38031 from Ryan Stutsman.


 To generate a diff of this commit:
 cvs rdiff -r1.75 -r1.76 src/usr.bin/make/compat.c

 Please note that diffs are not public domain; they are subject to the
 copyright notices on the relevant files.

State-Changed-From-To: open->closed
State-Changed-By: dholland@NetBSD.org
State-Changed-When: Sun, 22 Feb 2009 07:44:52 +0000
State-Changed-Why:
Fixed in HEAD; the fix will propagate in due course to the pkgsrc and
standalone versions of bmake.


>Unformatted:

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.