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: fix echoing of command with '-' in silent...



details:   https://anonhg.NetBSD.org/src/rev/864f80ba8a3b
branches:  trunk
changeset: 361147:864f80ba8a3b
user:      rillig <rillig%NetBSD.org@localhost>
date:      Sat Feb 12 11:14:48 2022 +0000

description:
make: fix echoing of command with '-' in silent target in jobs mode

Since job.c 1.83 from 2003-12-20, the command had been echoed even if
the target had the attribute '.SILENT'.

In sh-flags.exp, each removed 'echo' command is below a target name
matching the pattern 'opt-?j????-tgt-??s-cmd-?i?', which means that the
target was marked as silent, either through a global '.SILENT'
declaration or the command line option '-s' or the attribute '.SILENT'
on the target.

Reported by Alan Barrett in PR#45356.

diffstat:

 usr.bin/make/job.c                             |   9 +--
 usr.bin/make/unit-tests/deptgt-silent-jobs.exp |   1 -
 usr.bin/make/unit-tests/deptgt-silent-jobs.mk  |   5 +-
 usr.bin/make/unit-tests/sh-flags.exp           |  72 --------------------------
 4 files changed, 5 insertions(+), 82 deletions(-)

diffs (truncated from 572 to 300 lines):

diff -r 632601e57eba -r 864f80ba8a3b usr.bin/make/job.c
--- a/usr.bin/make/job.c        Sat Feb 12 03:24:34 2022 +0000
+++ b/usr.bin/make/job.c        Sat Feb 12 11:14:48 2022 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: job.c,v 1.451 2022/02/04 23:22:19 rillig Exp $ */
+/*     $NetBSD: job.c,v 1.452 2022/02/12 11:14:48 rillig Exp $ */
 
 /*
  * Copyright (c) 1988, 1989, 1990 The Regents of the University of California.
@@ -142,7 +142,7 @@
 #include "trace.h"
 
 /*     "@(#)job.c      8.2 (Berkeley) 3/19/94" */
-MAKE_RCSID("$NetBSD: job.c,v 1.451 2022/02/04 23:22:19 rillig Exp $");
+MAKE_RCSID("$NetBSD: job.c,v 1.452 2022/02/12 11:14:48 rillig Exp $");
 
 /*
  * A shell defines how the commands are run.  All commands for a target are
@@ -835,7 +835,7 @@
 JobWriteSpecialsEchoCtl(Job *job, ShellWriter *wr, CommandFlags *inout_cmdFlags,
                        const char *escCmd, const char **inout_cmdTemplate)
 {
-       /* XXX: Why is the job modified at this point? */
+       /* XXX: Why is the whole job modified at this point? */
        job->ignerr = true;
 
        if (job->echo && inout_cmdFlags->echo) {
@@ -847,9 +847,6 @@
                 * for toggling the error checking.
                 */
                inout_cmdFlags->echo = false;
-       } else {
-               if (inout_cmdFlags->echo)
-                       ShellWriter_EchoCmd(wr, escCmd);
        }
        *inout_cmdTemplate = shell->runIgnTmpl;
 
diff -r 632601e57eba -r 864f80ba8a3b usr.bin/make/unit-tests/deptgt-silent-jobs.exp
--- a/usr.bin/make/unit-tests/deptgt-silent-jobs.exp    Sat Feb 12 03:24:34 2022 +0000
+++ b/usr.bin/make/unit-tests/deptgt-silent-jobs.exp    Sat Feb 12 11:14:48 2022 +0000
@@ -2,7 +2,6 @@
 compat: testing 2
 compat: testing 3
 jobs: testing 1
-echo 'jobs: testing 2'
 jobs: testing 2
 jobs: testing 3
 exit status 0
diff -r 632601e57eba -r 864f80ba8a3b usr.bin/make/unit-tests/deptgt-silent-jobs.mk
--- a/usr.bin/make/unit-tests/deptgt-silent-jobs.mk     Sat Feb 12 03:24:34 2022 +0000
+++ b/usr.bin/make/unit-tests/deptgt-silent-jobs.mk     Sat Feb 12 11:14:48 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: deptgt-silent-jobs.mk,v 1.1 2022/02/12 01:15:18 rillig Exp $
+# $NetBSD: deptgt-silent-jobs.mk,v 1.2 2022/02/12 11:14:48 rillig Exp $
 #
 # Ensure that the special dependency target '.SILENT' only affects the amount
 # of output, but not the kind of error handling.
@@ -7,7 +7,7 @@
 #      In job.c 1.83 from 2003.12.20.00.18.22, in an attempt to fix
 #      https://gnats.netbsd.org/18573, commands that suppressed error
 #      handling were output in jobs mode, even when the global '.SILENT'
-#      was set.
+#      was set.  This was fixed in job.c 1.452 from 2022-02-12.
 #
 # See also:
 #      https://gnats.netbsd.org/45356
@@ -28,7 +28,6 @@
        @${MAKE} -r -f ${MAKEFILE} test VARIANT=compat
 
 # expect: jobs: testing 1
-# FIXME: suppress 'echo 'jobs: testing 2''
 # expect: echo 'jobs: testing 2'
 # expect: jobs: testing 2
 # expect: jobs: testing 3
diff -r 632601e57eba -r 864f80ba8a3b usr.bin/make/unit-tests/sh-flags.exp
--- a/usr.bin/make/unit-tests/sh-flags.exp      Sat Feb 12 03:24:34 2022 +0000
+++ b/usr.bin/make/unit-tests/sh-flags.exp      Sat Feb 12 11:14:48 2022 +0000
@@ -1102,7 +1102,6 @@
 running
 
 opt-_j____-tgt-__s-cmd-_i_
-echo running; false
 running
 *** [opt-_j____-tgt-__s-cmd-_i_] Error code 1 (ignored)
 
@@ -1117,7 +1116,6 @@
 running
 
 opt-_j____-tgt-__s-cmd-ai_
-echo running; false
 running
 *** [opt-_j____-tgt-__s-cmd-ai_] Error code 1 (ignored)
 
@@ -1170,7 +1168,6 @@
 *** [opt-_j____-tgt-_is-cmd-__s] Error code 1 (ignored)
 
 opt-_j____-tgt-_is-cmd-_i_
-echo running; false
 running
 *** [opt-_j____-tgt-_is-cmd-_i_] Error code 1 (ignored)
 
@@ -1187,7 +1184,6 @@
 *** [opt-_j____-tgt-_is-cmd-a_s] Error code 1 (ignored)
 
 opt-_j____-tgt-_is-cmd-ai_
-echo running; false
 running
 *** [opt-_j____-tgt-_is-cmd-ai_] Error code 1 (ignored)
 
@@ -1234,7 +1230,6 @@
 running
 
 opt-_j____-tgt-a_s-cmd-_i_
-echo running; false
 running
 *** [opt-_j____-tgt-a_s-cmd-_i_] Error code 1 (ignored)
 
@@ -1249,7 +1244,6 @@
 running
 
 opt-_j____-tgt-a_s-cmd-ai_
-echo running; false
 running
 *** [opt-_j____-tgt-a_s-cmd-ai_] Error code 1 (ignored)
 
@@ -1302,7 +1296,6 @@
 *** [opt-_j____-tgt-ais-cmd-__s] Error code 1 (ignored)
 
 opt-_j____-tgt-ais-cmd-_i_
-echo running; false
 running
 *** [opt-_j____-tgt-ais-cmd-_i_] Error code 1 (ignored)
 
@@ -1319,7 +1312,6 @@
 *** [opt-_j____-tgt-ais-cmd-a_s] Error code 1 (ignored)
 
 opt-_j____-tgt-ais-cmd-ai_
-echo running; false
 running
 *** [opt-_j____-tgt-ais-cmd-ai_] Error code 1 (ignored)
 
@@ -1496,7 +1488,6 @@
 running
 
 opt-_j_n__-tgt-a_s-cmd-_i_
-echo running; false
 running
 
 opt-_j_n__-tgt-a_s-cmd-_is
@@ -1509,7 +1500,6 @@
 running
 
 opt-_j_n__-tgt-a_s-cmd-ai_
-echo running; false
 running
 
 opt-_j_n__-tgt-a_s-cmd-ais
@@ -1550,7 +1540,6 @@
 running
 
 opt-_j_n__-tgt-ais-cmd-_i_
-echo running; false
 running
 
 opt-_j_n__-tgt-ais-cmd-_is
@@ -1563,7 +1552,6 @@
 running
 
 opt-_j_n__-tgt-ais-cmd-ai_
-echo running; false
 running
 
 opt-_j_n__-tgt-ais-cmd-ais
@@ -1612,12 +1600,10 @@
 running
 
 opt-_jl___-tgt-__s-cmd-_i_
-echo running; false
 running
 *** [opt-_jl___-tgt-__s-cmd-_i_] Error code 1 (ignored)
 
 opt-_jl___-tgt-__s-cmd-_is
-echo running; false
 running
 *** [opt-_jl___-tgt-__s-cmd-_is] Error code 1 (ignored)
 
@@ -1628,12 +1614,10 @@
 running
 
 opt-_jl___-tgt-__s-cmd-ai_
-echo running; false
 running
 *** [opt-_jl___-tgt-__s-cmd-ai_] Error code 1 (ignored)
 
 opt-_jl___-tgt-__s-cmd-ais
-echo running; false
 running
 *** [opt-_jl___-tgt-__s-cmd-ais] Error code 1 (ignored)
 
@@ -1686,12 +1670,10 @@
 *** [opt-_jl___-tgt-_is-cmd-__s] Error code 1 (ignored)
 
 opt-_jl___-tgt-_is-cmd-_i_
-echo running; false
 running
 *** [opt-_jl___-tgt-_is-cmd-_i_] Error code 1 (ignored)
 
 opt-_jl___-tgt-_is-cmd-_is
-echo running; false
 running
 *** [opt-_jl___-tgt-_is-cmd-_is] Error code 1 (ignored)
 
@@ -1704,12 +1686,10 @@
 *** [opt-_jl___-tgt-_is-cmd-a_s] Error code 1 (ignored)
 
 opt-_jl___-tgt-_is-cmd-ai_
-echo running; false
 running
 *** [opt-_jl___-tgt-_is-cmd-ai_] Error code 1 (ignored)
 
 opt-_jl___-tgt-_is-cmd-ais
-echo running; false
 running
 *** [opt-_jl___-tgt-_is-cmd-ais] Error code 1 (ignored)
 
@@ -1756,12 +1736,10 @@
 running
 
 opt-_jl___-tgt-a_s-cmd-_i_
-echo running; false
 running
 *** [opt-_jl___-tgt-a_s-cmd-_i_] Error code 1 (ignored)
 
 opt-_jl___-tgt-a_s-cmd-_is
-echo running; false
 running
 *** [opt-_jl___-tgt-a_s-cmd-_is] Error code 1 (ignored)
 
@@ -1772,12 +1750,10 @@
 running
 
 opt-_jl___-tgt-a_s-cmd-ai_
-echo running; false
 running
 *** [opt-_jl___-tgt-a_s-cmd-ai_] Error code 1 (ignored)
 
 opt-_jl___-tgt-a_s-cmd-ais
-echo running; false
 running
 *** [opt-_jl___-tgt-a_s-cmd-ais] Error code 1 (ignored)
 
@@ -1830,12 +1806,10 @@
 *** [opt-_jl___-tgt-ais-cmd-__s] Error code 1 (ignored)
 
 opt-_jl___-tgt-ais-cmd-_i_
-echo running; false
 running
 *** [opt-_jl___-tgt-ais-cmd-_i_] Error code 1 (ignored)
 
 opt-_jl___-tgt-ais-cmd-_is
-echo running; false
 running
 *** [opt-_jl___-tgt-ais-cmd-_is] Error code 1 (ignored)
 
@@ -1848,12 +1822,10 @@
 *** [opt-_jl___-tgt-ais-cmd-a_s] Error code 1 (ignored)
 
 opt-_jl___-tgt-ais-cmd-ai_
-echo running; false
 running
 *** [opt-_jl___-tgt-ais-cmd-ai_] Error code 1 (ignored)
 
 opt-_jl___-tgt-ais-cmd-ais
-echo running; false
 running
 *** [opt-_jl___-tgt-ais-cmd-ais] Error code 1 (ignored)
 
@@ -2032,11 +2004,9 @@
 running
 
 opt-_jln__-tgt-a_s-cmd-_i_
-echo running; false
 running
 
 opt-_jln__-tgt-a_s-cmd-_is
-echo running; false
 running
 
 opt-_jln__-tgt-a_s-cmd-a__
@@ -2046,11 +2016,9 @@
 running
 
 opt-_jln__-tgt-a_s-cmd-ai_
-echo running; false
 running
 
 opt-_jln__-tgt-a_s-cmd-ais
-echo running; false
 running
 



Home | Main Index | Thread Index | Old Index