Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/usr.bin/make make(1): replace segmentation fault with failed...



details:   https://anonhg.NetBSD.org/src/rev/ead84f9489fc
branches:  trunk
changeset: 1013201:ead84f9489fc
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Aug 22 19:53:22 2020 +0000

description:
make(1): replace segmentation fault with failed assertion

To reproduce: ./make -r -C unit-tests -f sh-dots.mk -j1

Without -j1, the test succeeds.

diffstat:

 usr.bin/make/compat.c |  8 +++++---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (42 lines):

diff -r 7960f12819fc -r ead84f9489fc usr.bin/make/compat.c
--- a/usr.bin/make/compat.c     Sat Aug 22 19:30:58 2020 +0000
+++ b/usr.bin/make/compat.c     Sat Aug 22 19:53:22 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: compat.c,v 1.124 2020/08/22 15:43:32 rillig Exp $      */
+/*     $NetBSD: compat.c,v 1.125 2020/08/22 19:53:22 rillig Exp $      */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -70,14 +70,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: compat.c,v 1.124 2020/08/22 15:43:32 rillig Exp $";
+static char rcsid[] = "$NetBSD: compat.c,v 1.125 2020/08/22 19:53:22 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)compat.c   8.2 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: compat.c,v 1.124 2020/08/22 15:43:32 rillig Exp $");
+__RCSID("$NetBSD: compat.c,v 1.125 2020/08/22 19:53:22 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -99,6 +99,7 @@
 #include    <sys/stat.h>
 #include    <sys/wait.h>
 
+#include    <assert.h>
 #include    <ctype.h>
 #include    <errno.h>
 #include    <signal.h>
@@ -250,6 +251,7 @@
     Lst_ReplaceS(cmdNode, cmdStart);
 
     if ((gn->type & OP_SAVE_CMDS) && (gn != ENDNode)) {
+        assert(ENDNode != NULL);
        Lst_AppendS(ENDNode->commands, cmdStart);
        return 0;
     }



Home | Main Index | Thread Index | Old Index