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): fix bug in :S modifier from 2020-07-19



details:   https://anonhg.NetBSD.org/src/rev/5ebf8f5b7420
branches:  trunk
changeset: 936387:5ebf8f5b7420
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sun Jul 26 12:19:37 2020 +0000

description:
make(1): fix bug in :S modifier from 2020-07-19

diffstat:

 usr.bin/make/unit-tests/modmisc.mk |  5 ++---
 usr.bin/make/var.c                 |  8 ++++----
 2 files changed, 6 insertions(+), 7 deletions(-)

diffs (58 lines):

diff -r d3732753eb87 -r 5ebf8f5b7420 usr.bin/make/unit-tests/modmisc.mk
--- a/usr.bin/make/unit-tests/modmisc.mk        Sun Jul 26 12:18:11 2020 +0000
+++ b/usr.bin/make/unit-tests/modmisc.mk        Sun Jul 26 12:19:37 2020 +0000
@@ -1,4 +1,4 @@
-# $Id: modmisc.mk,v 1.24 2020/07/26 12:18:11 rillig Exp $
+# $Id: modmisc.mk,v 1.25 2020/07/26 12:19:37 rillig Exp $
 #
 # miscellaneous modifier tests
 
@@ -73,8 +73,7 @@
        @echo @:${:U:@var@empty@}
 
 WORDS=         sequences of letters
-# FIXME: The "*" in "letters" must not be substituted because of the 1.
-.if ${WORDS:S,e,*,1} != "s*quences of l*tters"
+.if ${WORDS:S,e,*,1} != "s*quences of letters"
 .warning ${WORDS:S,e,*,1}
 .endif
 .if ${WORDS:S,e,*,} != "s*quences of l*tters"
diff -r d3732753eb87 -r 5ebf8f5b7420 usr.bin/make/var.c
--- a/usr.bin/make/var.c        Sun Jul 26 12:18:11 2020 +0000
+++ b/usr.bin/make/var.c        Sun Jul 26 12:19:37 2020 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: var.c,v 1.309 2020/07/26 10:11:04 rillig Exp $ */
+/*     $NetBSD: var.c,v 1.310 2020/07/26 12:19:37 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990, 1993
@@ -69,14 +69,14 @@
  */
 
 #ifndef MAKE_NATIVE
-static char rcsid[] = "$NetBSD: var.c,v 1.309 2020/07/26 10:11:04 rillig Exp $";
+static char rcsid[] = "$NetBSD: var.c,v 1.310 2020/07/26 12:19:37 rillig Exp $";
 #else
 #include <sys/cdefs.h>
 #ifndef lint
 #if 0
 static char sccsid[] = "@(#)var.c      8.3 (Berkeley) 3/19/94";
 #else
-__RCSID("$NetBSD: var.c,v 1.309 2020/07/26 10:11:04 rillig Exp $");
+__RCSID("$NetBSD: var.c,v 1.310 2020/07/26 12:19:37 rillig Exp $");
 #endif
 #endif /* not lint */
 #endif
@@ -1339,11 +1339,11 @@
     while ((cp = Str_FindSubstring(word, args->lhs)) != NULL) {
        SepBuf_AddBytes(buf, word, cp - word);
        SepBuf_AddBytes(buf, args->rhs, args->rhsLen);
+       args->pflags |= VARP_SUB_MATCHED;
        wordLen -= (cp - word) + args->lhsLen;
        word = cp + args->lhsLen;
        if (wordLen == 0 || !(args->pflags & VARP_SUB_GLOBAL))
            break;
-       args->pflags |= VARP_SUB_MATCHED;
     }
 nosub:
     SepBuf_AddBytes(buf, word, wordLen);



Home | Main Index | Thread Index | Old Index