CVS commit: src/sys/dev/audio
Module Name:src Committed By: isaki Date: Sun Dec 13 05:47:09 UTC 2020 Modified Files: src/sys/dev/audio: audio.c Log Message: Revise comments. To generate a diff of this commit: cvs rdiff -u -r1.84 -r1.85 src/sys/dev/audio/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.84 src/sys/dev/audio/audio.c:1.85 --- src/sys/dev/audio/audio.c:1.84 Sun Dec 13 05:44:09 2020 +++ src/sys/dev/audio/audio.c Sun Dec 13 05:47:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.84 2020/12/13 05:44:09 isaki Exp $ */ +/* $NetBSD: audio.c,v 1.85 2020/12/13 05:47:08 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -138,7 +138,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.84 2020/12/13 05:44:09 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.85 2020/12/13 05:47:08 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -2415,7 +2415,8 @@ audio_unlink(struct audio_softc *sc, aud /* * Acquire exlock to protect counters. - * Does not use audio_exlock_enter() due to sc_dying. + * audio_exlock_enter() cannot be used here because we have to go + * forward even if sc_dying is set. */ while (__predict_false(sc->sc_exlock != 0)) { error = cv_timedwait_sig(&sc->sc_exlockcv, sc->sc_lock, @@ -6153,8 +6154,8 @@ audio_softintr_wr(void *cookie) /* * Check (and convert) the format *p came from userland. - * If successful, it writes back the converted format to *p if necessary - * and returns 0. Otherwise returns errno (*p may change even this case). + * If successful, it writes back the converted format to *p if necessary and + * returns 0. Otherwise returns errno (*p may be changed even in this case). */ static int audio_check_params(audio_format2_t *p)
CVS commit: src/sys/dev/audio
Module Name:src Committed By: isaki Date: Sun Dec 13 05:44:09 UTC 2020 Modified Files: src/sys/dev/audio: audio.c Log Message: Fix a return value of audiopoll(). fo_poll is expected to return revents rather than errno on error. To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.84 src/sys/dev/audio/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.83 src/sys/dev/audio/audio.c:1.84 --- src/sys/dev/audio/audio.c:1.83 Sun Dec 13 05:29:19 2020 +++ src/sys/dev/audio/audio.c Sun Dec 13 05:44:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.83 2020/12/13 05:29:19 isaki Exp $ */ +/* $NetBSD: audio.c,v 1.84 2020/12/13 05:44:09 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -138,7 +138,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.83 2020/12/13 05:29:19 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.84 2020/12/13 05:44:09 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -1873,7 +1873,7 @@ audiopoll(struct file *fp, int events) sc = audio_file_enter(file, &sc_ref); if (sc == NULL) - return EIO; + return POLLERR; switch (AUDIODEV(dev)) { case SOUND_DEVICE:
CVS commit: src/sys/dev/audio
Module Name:src Committed By: isaki Date: Sun Dec 13 05:29:20 UTC 2020 Modified Files: src/sys/dev/audio: audio.c Log Message: Avoid a dead lock in audiodetach, since rev 1.63. audio_unlink() must be called without exlock held (and audio_mixer_destroy() must be called with exlock held). This makes unplugging during playing/recording work (again). Reported by Julian Coleman on current-users: http://mail-index.netbsd.org/current-users/2020/12/10/msg040050.html To generate a diff of this commit: cvs rdiff -u -r1.82 -r1.83 src/sys/dev/audio/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.82 src/sys/dev/audio/audio.c:1.83 --- src/sys/dev/audio/audio.c:1.82 Sun Dec 13 05:21:12 2020 +++ src/sys/dev/audio/audio.c Sun Dec 13 05:29:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.82 2020/12/13 05:21:12 isaki Exp $ */ +/* $NetBSD: audio.c,v 1.83 2020/12/13 05:29:19 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -138,7 +138,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.82 2020/12/13 05:21:12 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.83 2020/12/13 05:29:19 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -1331,7 +1331,6 @@ audiodetach(device_t self, int flags) * that hold sc, and any new calls with files that were for sc will * fail. Thus, we now have exclusive access to the softc. */ - sc->sc_exlock = 1; /* * Nuke all open instances. @@ -1357,6 +1356,7 @@ audiodetach(device_t self, int flags) pmf_device_deregister(self); /* Free resources */ + sc->sc_exlock = 1; if (sc->sc_pmixer) { audio_mixer_destroy(sc, sc->sc_pmixer); kmem_free(sc->sc_pmixer, sizeof(*sc->sc_pmixer));
CVS commit: src/sys/dev/audio
Module Name:src Committed By: isaki Date: Sun Dec 13 05:21:12 UTC 2020 Modified Files: src/sys/dev/audio: audio.c Log Message: Add missing newline. To generate a diff of this commit: cvs rdiff -u -r1.81 -r1.82 src/sys/dev/audio/audio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/audio/audio.c diff -u src/sys/dev/audio/audio.c:1.81 src/sys/dev/audio/audio.c:1.82 --- src/sys/dev/audio/audio.c:1.81 Wed Dec 9 04:30:39 2020 +++ src/sys/dev/audio/audio.c Sun Dec 13 05:21:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: audio.c,v 1.81 2020/12/09 04:30:39 isaki Exp $ */ +/* $NetBSD: audio.c,v 1.82 2020/12/13 05:21:12 isaki Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -138,7 +138,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.81 2020/12/09 04:30:39 isaki Exp $"); +__KERNEL_RCSID(0, "$NetBSD: audio.c,v 1.82 2020/12/13 05:21:12 isaki Exp $"); #ifdef _KERNEL_OPT #include "audio.h" @@ -2424,7 +2424,8 @@ audio_unlink(struct audio_softc *sc, aud if (error == EWOULDBLOCK) { mutex_exit(sc->sc_lock); device_printf(sc->sc_dev, - "%s: cv_timedwait_sig failed %d", __func__, error); + "%s: cv_timedwait_sig failed %d\n", + __func__, error); return error; } }
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sun Dec 13 05:13:38 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: Makefile sh-errctl.exp Log Message: Prune job debug output that may appear out of order. A race between child and parent means that we cannot guarantee whether all child output is seen before we call JobClosePipes, thus intervening debug output can appear before or after the last child output. To generate a diff of this commit: cvs rdiff -u -r1.247 -r1.248 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/sh-errctl.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.247 src/usr.bin/make/unit-tests/Makefile:1.248 --- src/usr.bin/make/unit-tests/Makefile:1.247 Sun Dec 13 02:09:33 2020 +++ src/usr.bin/make/unit-tests/Makefile Sun Dec 13 05:13:38 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.247 2020/12/13 02:09:33 sjg Exp $ +# $NetBSD: Makefile,v 1.248 2020/12/13 05:13:38 sjg Exp $ # # Unit tests for make(1) # @@ -537,11 +537,10 @@ STD_SED_CMDS.dg1+= -e 's,^\(MAKE *=\) .* # Omit details such as process IDs from the output of the -dj option. STD_SED_CMDS.dj= \ + -e '/Process/d;/JobFinish:/d' \ -e 's,^\(Job_TokenWithdraw\)([0-9]*),\1(),' \ -e 's,^([0-9][0-9]*) \(withdrew token\),() \1,' \ -e 's, \(pid\) [0-9][0-9]*, \1 ,' \ - -e 's,^\(Process\) [0-9][0-9]*,\1 ,' \ - -e 's,^\(JobFinish:\) [0-9][0-9]*,\1 ,' \ -e 's,^\( Command:\) .*,\1 ,' # Reduce the noise for tests running with the -n option, since there is no Index: src/usr.bin/make/unit-tests/sh-errctl.exp diff -u src/usr.bin/make/unit-tests/sh-errctl.exp:1.1 src/usr.bin/make/unit-tests/sh-errctl.exp:1.2 --- src/usr.bin/make/unit-tests/sh-errctl.exp:1.1 Sat Dec 12 15:06:11 2020 +++ src/usr.bin/make/unit-tests/sh-errctl.exp Sun Dec 13 05:13:38 2020 @@ -22,8 +22,6 @@ job 0, status 3, flags ---, pid silent ignerr always -Process exited/stopped status 0. -JobFinish: [all], status 0 Job_TokenWithdraw(): aborting 0, running 0 () withdrew token exit status 0
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Dec 13 02:15:49 UTC 2020 Modified Files: src/usr.bin/make: nonints.h parse.c var.c Log Message: make(1): remove dead code from GetVarnamesToUnexport Now that the parsing of the directives is unified and strict, there is no need anymore for the dispatched functions to check for unknown directives. These functions don't even get the information to decide that since this decision is already done. To generate a diff of this commit: cvs rdiff -u -r1.169 -r1.170 src/usr.bin/make/nonints.h cvs rdiff -u -r1.478 -r1.479 src/usr.bin/make/parse.c cvs rdiff -u -r1.731 -r1.732 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/nonints.h diff -u src/usr.bin/make/nonints.h:1.169 src/usr.bin/make/nonints.h:1.170 --- src/usr.bin/make/nonints.h:1.169 Sun Dec 13 01:41:12 2020 +++ src/usr.bin/make/nonints.h Sun Dec 13 02:15:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.169 2020/12/13 01:41:12 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.170 2020/12/13 02:15:49 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -335,7 +335,7 @@ void Var_Dump(GNode *); void Var_ReexportVars(void); void Var_Export(VarExportMode, const char *); void Var_ExportVars(const char *); -void Var_UnExport(const char *); +void Var_UnExport(Boolean, const char *); /* util.c */ typedef void (*SignalProc)(int); Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.478 src/usr.bin/make/parse.c:1.479 --- src/usr.bin/make/parse.c:1.478 Sun Dec 13 02:01:43 2020 +++ src/usr.bin/make/parse.c Sun Dec 13 02:15:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.478 2020/12/13 02:01:43 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.479 2020/12/13 02:15:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.478 2020/12/13 02:01:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.479 2020/12/13 02:15:49 rillig Exp $"); /* types and constants */ @@ -2998,9 +2998,11 @@ ParseDirective(char *line) } else if (IsDirective(dir, dirlen, "export-literal")) { Var_Export(VEM_LITERAL, arg); return TRUE; - } else if (IsDirective(dir, dirlen, "unexport") || - IsDirective(dir, dirlen, "unexport-env")) { - Var_UnExport(dir); + } else if (IsDirective(dir, dirlen, "unexport")) { + Var_UnExport(FALSE, arg); + return TRUE; + } else if (IsDirective(dir, dirlen, "unexport-env")) { + Var_UnExport(TRUE, arg); return TRUE; } else if (IsDirective(dir, dirlen, "info")) { if (ParseMessage(PARSE_INFO, arg)) Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.731 src/usr.bin/make/var.c:1.732 --- src/usr.bin/make/var.c:1.731 Sun Dec 13 01:41:12 2020 +++ src/usr.bin/make/var.c Sun Dec 13 02:15:49 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.731 2020/12/13 01:41:12 rillig Exp $ */ +/* $NetBSD: var.c,v 1.732 2020/12/13 02:15:49 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.731 2020/12/13 01:41:12 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.732 2020/12/13 02:15:49 rillig Exp $"); /* A string that may need to be freed after use. */ typedef struct FStr { @@ -740,34 +740,24 @@ ClearEnv(void) } static void -GetVarnamesToUnexport(const char *directive, +GetVarnamesToUnexport(Boolean isEnv, const char *arg, FStr *out_varnames, UnexportWhat *out_what) { UnexportWhat what; FStr varnames = FSTR_INIT; - const char *p = directive; - p += strlen("unexport"); - if (strncmp(p, "-env", 4) == 0) { - if (ch_isspace(p[4])) { + if (isEnv) { + if (arg[0] != '\0') { Parse_Error(PARSE_FATAL, "The directive .unexport-env does not take " "arguments"); - } else if (p[4] != '\0') { - Parse_Error(PARSE_FATAL, - "Unknown directive \"%s\"", directive); } what = UNEXPORT_ENV; - } else if (*p == '\0' || ch_isspace(*p)) { - cpp_skip_whitespace(&p); - what = p[0] != '\0' ? UNEXPORT_NAMED : UNEXPORT_ALL; - if (what == UNEXPORT_NAMED) - FStr_Assign(&varnames, p, NULL); } else { - Parse_Error(PARSE_FATAL, "Unknown directive \"%s\"", directive); - what = UNEXPORT_NAMED; - FStr_Assign(&varnames, "", NULL); + what = arg[0] != '\0' ? UNEXPORT_NAMED : UNEXPORT_ALL; + if (what == UNEXPORT_NAMED) + FStr_Assign(&varnames, arg, NULL); } if (what != UNEXPORT_NAMED) { @@ -838,12 +828,12 @@ UnexportVars(FStr *varnames, UnexportWha * str must have the form "unexport[-env] varname...". */ void -Var_UnExport(const char *str) +Var_UnExport(Boolean isEnv, const char *arg) { UnexportWhat what; FStr varnames; - GetVarnamesToUnexport(str, &varnames, &what); + GetVarnamesToUnexport(isEnv, arg, &varnames, &what); UnexportVars
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sun Dec 13 02:09:55 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: shell-csh.mk Log Message: Avoid noise when csh does not exist To generate a diff of this commit: cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/shell-csh.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/shell-csh.mk diff -u src/usr.bin/make/unit-tests/shell-csh.mk:1.6 src/usr.bin/make/unit-tests/shell-csh.mk:1.7 --- src/usr.bin/make/unit-tests/shell-csh.mk:1.6 Thu Dec 10 21:09:58 2020 +++ src/usr.bin/make/unit-tests/shell-csh.mk Sun Dec 13 02:09:55 2020 @@ -1,8 +1,8 @@ -# $NetBSD: shell-csh.mk,v 1.6 2020/12/10 21:09:58 rillig Exp $ +# $NetBSD: shell-csh.mk,v 1.7 2020/12/13 02:09:55 sjg Exp $ # # Tests for using a C shell for running the commands. -CSH!= which csh || true +CSH!= which csh 2> /dev/null || true # The shell path must be an absolute path. # This is only obvious in parallel mode since in compat mode,
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: sjg Date: Sun Dec 13 02:09:33 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: Makefile Log Message: Ensure we have a value for .MAKE.UID To generate a diff of this commit: cvs rdiff -u -r1.246 -r1.247 src/usr.bin/make/unit-tests/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.246 src/usr.bin/make/unit-tests/Makefile:1.247 --- src/usr.bin/make/unit-tests/Makefile:1.246 Sun Dec 13 00:46:25 2020 +++ src/usr.bin/make/unit-tests/Makefile Sun Dec 13 02:09:33 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.246 2020/12/13 00:46:25 rillig Exp $ +# $NetBSD: Makefile,v 1.247 2020/12/13 02:09:33 sjg Exp $ # # Unit tests for make(1) # @@ -31,6 +31,9 @@ # src/tests/usr.bin/make/t_make.sh. # +# we use this below but we might be an older make +.MAKE.UID?= ${id -u:L:sh} + # Each test is in a sub-makefile. # Keep the list sorted. # Any test that is commented out must be ignored in @@ -199,7 +202,7 @@ TESTS+= modmatch TESTS+= modmisc TESTS+= modts TESTS+= modword -.if ${.MAKE.UID:U0} > 0 +.if ${.MAKE.UID} > 0 TESTS+= objdir-writable .endif TESTS+= opt
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Dec 13 02:01:43 UTC 2020 Modified Files: src/usr.bin/make: job.c main.c parse.c Log Message: make(1): replace *line with line[0] Since a line is not an iterator and since the expression *line typically means "the current element", not "the first character", replacing *line with line[0] more directly expresses the idea of accessing the first character of a string. To generate a diff of this commit: cvs rdiff -u -r1.385 -r1.386 src/usr.bin/make/job.c cvs rdiff -u -r1.495 -r1.496 src/usr.bin/make/main.c cvs rdiff -u -r1.477 -r1.478 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.385 src/usr.bin/make/job.c:1.386 --- src/usr.bin/make/job.c:1.385 Sat Dec 12 18:53:53 2020 +++ src/usr.bin/make/job.c Sun Dec 13 02:01:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.385 2020/12/12 18:53:53 rillig Exp $ */ +/* $NetBSD: job.c,v 1.386 2020/12/13 02:01:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.385 2020/12/12 18:53:53 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.386 2020/12/13 02:01:43 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -2354,6 +2354,7 @@ Job_ParseShell(char *line) Boolean fullSpec = FALSE; Shell *sh; + /* XXX: don't use line as an iterator variable */ pp_skip_whitespace(&line); free(shellArgv); Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.495 src/usr.bin/make/main.c:1.496 --- src/usr.bin/make/main.c:1.495 Sat Dec 12 18:53:53 2020 +++ src/usr.bin/make/main.c Sun Dec 13 02:01:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.495 2020/12/12 18:53:53 rillig Exp $ */ +/* $NetBSD: main.c,v 1.496 2020/12/13 02:01:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.495 2020/12/12 18:53:53 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.496 2020/12/13 02:01:43 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -683,6 +683,7 @@ Main_ParseArgLine(const char *line) if (line == NULL) return; + /* XXX: don't use line as an iterator variable */ for (; *line == ' '; ++line) continue; if (line[0] == '\0') Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.477 src/usr.bin/make/parse.c:1.478 --- src/usr.bin/make/parse.c:1.477 Sun Dec 13 01:51:08 2020 +++ src/usr.bin/make/parse.c Sun Dec 13 02:01:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.477 2020/12/13 01:51:08 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.478 2020/12/13 02:01:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.477 2020/12/13 01:51:08 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.478 2020/12/13 02:01:43 rillig Exp $"); /* types and constants */ @@ -1099,7 +1099,7 @@ ParseDependencyTargetWord(const char **p /* Handle special targets like .PATH, .DEFAULT, .BEGIN, .ORDER. */ static void ParseDoDependencyTargetSpecial(ParseSpecial *inout_specType, - const char *line, + const char *line, /* XXX: bad name */ SearchPathList **inout_paths) { switch (*inout_specType) { @@ -1164,7 +1164,8 @@ ParseDoDependencyTargetSpecial(ParseSpec * Call on the suffix module to give us a path to modify. */ static Boolean -ParseDoDependencyTargetPath(const char *line, SearchPathList **inout_paths) +ParseDoDependencyTargetPath(const char *line, /* XXX: bad name */ + SearchPathList **inout_paths) { SearchPath *path; @@ -1186,12 +1187,13 @@ ParseDoDependencyTargetPath(const char * * See if it's a special target and if so set specType to match it. */ static Boolean -ParseDoDependencyTarget(const char *line, ParseSpecial *inout_specType, +ParseDoDependencyTarget(const char *line, /* XXX: bad name */ + ParseSpecial *inout_specType, GNodeType *out_tOp, SearchPathList **inout_paths) { int keywd; - if (!(*line == '.' && ch_isupper(line[1]))) + if (!(line[0] == '.' && ch_isupper(line[1]))) return TRUE; /* @@ -1221,7 +1223,8 @@ ParseDoDependencyTarget(const char *line } static void -ParseDoDependencyTargetMundane(char *line, StringList *curTargs) +ParseDoDependencyTargetMundane(char *line, /* XXX: bad name */ + StringList *curTargs) { if (Dir_HasWildcards(line)) { /* @@ -1666,6 +1669,7 @@ ParseDoDependency(char *line) /* * First, grind through the targets. */ + /* XXX
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Dec 13 01:51:08 UTC 2020 Modified Files: src/usr.bin/make: parse.c Log Message: make(1): clean up comment for ParseDirective To generate a diff of this commit: cvs rdiff -u -r1.476 -r1.477 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.476 src/usr.bin/make/parse.c:1.477 --- src/usr.bin/make/parse.c:1.476 Sun Dec 13 01:41:12 2020 +++ src/usr.bin/make/parse.c Sun Dec 13 01:51:08 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.476 2020/12/13 01:41:12 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.477 2020/12/13 01:51:08 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.476 2020/12/13 01:41:12 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.477 2020/12/13 01:51:08 rillig Exp $"); /* types and constants */ @@ -2950,11 +2950,8 @@ IsDirective(const char *dir, size_t dirl } /* - * Lines that begin with '.' can be pretty much anything: - * - directives like '.include' or '.if', - * - suffix rules like '.c.o:', - * - dependencies for filenames that start with '.', - * - variable assignments like '.tmp=value'. + * See if the line starts with one of the known directives, and if so, handle + * the directive. */ static Boolean ParseDirective(char *line) @@ -3121,6 +3118,13 @@ ParseDependency(char *line) static void ParseLine(char *line) { + /* + * Lines that begin with '.' can be pretty much anything: + * - directives like '.include' or '.if', + * - suffix rules like '.c.o:', + * - dependencies for filenames that start with '.', + * - variable assignments like '.tmp=value'. + */ if (line[0] == '.' && ParseDirective(line)) return;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Dec 13 01:41:12 UTC 2020 Modified Files: src/usr.bin/make: nonints.h parse.c var.c Log Message: make(1): clean up Var_Export To generate a diff of this commit: cvs rdiff -u -r1.168 -r1.169 src/usr.bin/make/nonints.h cvs rdiff -u -r1.475 -r1.476 src/usr.bin/make/parse.c cvs rdiff -u -r1.730 -r1.731 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/nonints.h diff -u src/usr.bin/make/nonints.h:1.168 src/usr.bin/make/nonints.h:1.169 --- src/usr.bin/make/nonints.h:1.168 Sat Dec 12 21:20:30 2020 +++ src/usr.bin/make/nonints.h Sun Dec 13 01:41:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.168 2020/12/12 21:20:30 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.169 2020/12/13 01:41:12 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -311,6 +311,15 @@ typedef enum VarParseResult { VPR_UNKNOWN = 0x0008 } VarParseResult; +typedef enum VarExportMode { + /* .export-env */ + VEM_NORMAL, + /* .export: Initial export or update an already exported variable. */ + VEM_PARENT, + /* .export-literal: Do not expand the variable value. */ + VEM_LITERAL +} VarExportMode; + void Var_Delete(const char *, GNode *); void Var_Set(const char *, const char *, GNode *); void Var_SetWithFlags(const char *, const char *, GNode *, VarSetFlags); @@ -324,7 +333,7 @@ VarParseResult Var_Subst(const char *, G void Var_Stats(void); void Var_Dump(GNode *); void Var_ReexportVars(void); -void Var_Export(const char *); +void Var_Export(VarExportMode, const char *); void Var_ExportVars(const char *); void Var_UnExport(const char *); Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.475 src/usr.bin/make/parse.c:1.476 --- src/usr.bin/make/parse.c:1.475 Sun Dec 13 01:07:54 2020 +++ src/usr.bin/make/parse.c Sun Dec 13 01:41:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.475 2020/12/13 01:07:54 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.476 2020/12/13 01:41:12 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.475 2020/12/13 01:07:54 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.476 2020/12/13 01:41:12 rillig Exp $"); /* types and constants */ @@ -2988,10 +2988,14 @@ ParseDirective(char *line) /* TODO: undefine all variables, not only the first */ /* TODO: use Str_Words, like everywhere else */ return TRUE; - } else if (IsDirective(dir, dirlen, "export") || - IsDirective(dir, dirlen, "export-env") || - IsDirective(dir, dirlen, "export-literal")) { - Var_Export(dir + strlen("export")); + } else if (IsDirective(dir, dirlen, "export")) { + Var_Export(VEM_PARENT, arg); + return TRUE; + } else if (IsDirective(dir, dirlen, "export-env")) { + Var_Export(VEM_NORMAL, arg); + return TRUE; + } else if (IsDirective(dir, dirlen, "export-literal")) { + Var_Export(VEM_LITERAL, arg); return TRUE; } else if (IsDirective(dir, dirlen, "unexport") || IsDirective(dir, dirlen, "unexport-env")) { Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.730 src/usr.bin/make/var.c:1.731 --- src/usr.bin/make/var.c:1.730 Sun Dec 13 01:33:17 2020 +++ src/usr.bin/make/var.c Sun Dec 13 01:41:12 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.730 2020/12/13 01:33:17 rillig Exp $ */ +/* $NetBSD: var.c,v 1.731 2020/12/13 01:41:12 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.730 2020/12/13 01:33:17 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.731 2020/12/13 01:41:12 rillig Exp $"); /* A string that may need to be freed after use. */ typedef struct FStr { @@ -212,14 +212,6 @@ typedef struct Var { VarFlags flags; } Var; -typedef enum VarExportMode { - VEM_NORMAL, - /* Initial export or updating an already exported variable. */ - VEM_PARENT, - /* Do not expand the variable value. */ - VEM_LITERAL -} VarExportMode; - /* * Exporting vars is expensive so skip it if we can */ @@ -578,7 +570,7 @@ ExportVar(const char *name, VarExportMod return FALSE; /* nothing to do */ val = Buf_GetAll(&v->val, NULL); - if (!(mode == VEM_LITERAL) && strchr(val, '$') != NULL) { + if (mode != VEM_LITERAL && strchr(val, '$') != NULL) { char *expr; if (parent) { @@ -700,35 +692,16 @@ ExportVarsExpand(const char *uvarnames, free(xvarnames); } -/* - * This is called when .export is seen or .MAKE.EXPORTED is modified. - * - * It is also called when any exported variable is modified. - * XXX: Is it really? - * - * str has the format "[-env|-literal] varname...". - */ +/* Export the named variables, or all variables. */ void -Var_Export(const char *str) +Var_Export(VarExportMode mode, const char *varnames) { - VarExport
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Dec 13 01:33:17 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): replace bitset VarExportFlags with enum VarExportMode The previous flags were not combined at all. To generate a diff of this commit: cvs rdiff -u -r1.729 -r1.730 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.729 src/usr.bin/make/var.c:1.730 --- src/usr.bin/make/var.c:1.729 Sat Dec 12 21:20:30 2020 +++ src/usr.bin/make/var.c Sun Dec 13 01:33:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.729 2020/12/12 21:20:30 rillig Exp $ */ +/* $NetBSD: var.c,v 1.730 2020/12/13 01:33:17 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.729 2020/12/12 21:20:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.730 2020/12/13 01:33:17 rillig Exp $"); /* A string that may need to be freed after use. */ typedef struct FStr { @@ -212,18 +212,13 @@ typedef struct Var { VarFlags flags; } Var; -typedef enum VarExportFlags { - VAR_EXPORT_NORMAL = 0, - /* - * We pass this to Var_Export when doing the initial export - * or after updating an exported var. - */ - VAR_EXPORT_PARENT = 0x01, - /* - * We pass this to ExportVar to tell it to leave the value alone. - */ - VAR_EXPORT_LITERAL = 0x02 -} VarExportFlags; +typedef enum VarExportMode { + VEM_NORMAL, + /* Initial export or updating an already exported variable. */ + VEM_PARENT, + /* Do not expand the variable value. */ + VEM_LITERAL +} VarExportMode; /* * Exporting vars is expensive so skip it if we can @@ -566,9 +561,9 @@ MayExport(const char *name) * We only manipulate flags of vars if 'parent' is set. */ static Boolean -ExportVar(const char *name, VarExportFlags flags) +ExportVar(const char *name, VarExportMode mode) { - Boolean parent = (flags & VAR_EXPORT_PARENT) != 0; + Boolean parent = mode == VEM_PARENT; Var *v; char *val; @@ -583,7 +578,7 @@ ExportVar(const char *name, VarExportFla return FALSE; /* nothing to do */ val = Buf_GetAll(&v->val, NULL); - if (!(flags & VAR_EXPORT_LITERAL) && strchr(val, '$') != NULL) { + if (!(mode == VEM_LITERAL) && strchr(val, '$') != NULL) { char *expr; if (parent) { @@ -652,7 +647,7 @@ Var_ReexportVars(void) HashIter_Init(&hi, &VAR_GLOBAL->vars); while (HashIter_Next(&hi) != NULL) { Var *var = hi.entry->value; - ExportVar(var->name.str, VAR_EXPORT_NORMAL); + ExportVar(var->name.str, VEM_NORMAL); } return; } @@ -665,14 +660,14 @@ Var_ReexportVars(void) size_t i; for (i = 0; i < words.len; i++) - ExportVar(words.words[i], VAR_EXPORT_NORMAL); + ExportVar(words.words[i], VEM_NORMAL); Words_Free(words); } free(val); } static void -ExportVars(const char *varnames, Boolean isExport, VarExportFlags flags) +ExportVars(const char *varnames, Boolean isExport, VarExportMode mode) { Words words = Str_Words(varnames, FALSE); size_t i; @@ -682,26 +677,26 @@ ExportVars(const char *varnames, Boolean for (i = 0; i < words.len; i++) { const char *varname = words.words[i]; - if (!ExportVar(varname, flags)) + if (!ExportVar(varname, mode)) continue; if (var_exportedVars == VAR_EXPORTED_NONE) var_exportedVars = VAR_EXPORTED_SOME; - if (isExport && (flags & VAR_EXPORT_PARENT)) + if (isExport && mode == VEM_PARENT) Var_Append(MAKE_EXPORTED, varname, VAR_GLOBAL); } Words_Free(words); } static void -ExportVarsExpand(const char *uvarnames, Boolean isExport, VarExportFlags flags) +ExportVarsExpand(const char *uvarnames, Boolean isExport, VarExportMode mode) { char *xvarnames; (void)Var_Subst(uvarnames, VAR_GLOBAL, VARE_WANTRES, &xvarnames); /* TODO: handle errors */ - ExportVars(xvarnames, isExport, flags); + ExportVars(xvarnames, isExport, mode); free(xvarnames); } @@ -716,7 +711,7 @@ ExportVarsExpand(const char *uvarnames, void Var_Export(const char *str) { - VarExportFlags flags; + VarExportMode mode; if (str[0] == '\0') { var_exportedVars = VAR_EXPORTED_ALL; /* use with caution! */ @@ -725,21 +720,21 @@ Var_Export(const char *str) if (strncmp(str, "-env", 4) == 0) { str += 4; - flags = VAR_EXPORT_NORMAL; + mode = VEM_NORMAL; } else if (strncmp(str, "-literal", 8) == 0) { str += 8; - flags = VAR_EXPORT_LITERAL; + mode = VEM_LITERAL; } else { - flags = VAR_EXPORT_PARENT; + mode = VEM_PARENT; } - ExportVarsExpand(str, TRUE, flags); + ExportVarsExpand(str, TRUE, mode); } void Var_ExportVars(const char *varnames) { - ExportVarsExpand(varnames, FALSE, VAR_EXPORT_PARENT); + ExportVarsExpand(varnames, FALSE, VEM_PARENT); } @@ -945,7 +940,7 @@ Var_SetWithFlags(const char *name, const DEBUG3(VAR, "%s:%s = %s\n", ctxt->name,
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sun Dec 13 01:10:22 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: directive-info.mk directive-misspellings.mk directive-warning.mk Log Message: make(1): adjust timestamps in unit tests These could not be known before the previous commit. To generate a diff of this commit: cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-info.mk cvs rdiff -u -r1.2 -r1.3 \ src/usr.bin/make/unit-tests/directive-misspellings.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-warning.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/directive-info.mk diff -u src/usr.bin/make/unit-tests/directive-info.mk:1.5 src/usr.bin/make/unit-tests/directive-info.mk:1.6 --- src/usr.bin/make/unit-tests/directive-info.mk:1.5 Sun Dec 13 01:07:54 2020 +++ src/usr.bin/make/unit-tests/directive-info.mk Sun Dec 13 01:10:22 2020 @@ -1,4 +1,4 @@ -# $NetBSD: directive-info.mk,v 1.5 2020/12/13 01:07:54 rillig Exp $ +# $NetBSD: directive-info.mk,v 1.6 2020/12/13 01:10:22 rillig Exp $ # # Tests for the .info directive. @@ -10,7 +10,7 @@ .info message .info indented message .information -.information message # Accepted before 2020-12-13 01:??:??. +.information message # Accepted before 2020-12-13 01:07:54. .info.man: # not a message, but possibly a suffix rule # Even if lines would have trailing whitespace, this would be trimmed by Index: src/usr.bin/make/unit-tests/directive-misspellings.mk diff -u src/usr.bin/make/unit-tests/directive-misspellings.mk:1.2 src/usr.bin/make/unit-tests/directive-misspellings.mk:1.3 --- src/usr.bin/make/unit-tests/directive-misspellings.mk:1.2 Sun Dec 13 01:07:54 2020 +++ src/usr.bin/make/unit-tests/directive-misspellings.mk Sun Dec 13 01:10:22 2020 @@ -1,4 +1,4 @@ -# $NetBSD: directive-misspellings.mk,v 1.2 2020/12/13 01:07:54 rillig Exp $ +# $NetBSD: directive-misspellings.mk,v 1.3 2020/12/13 01:10:22 rillig Exp $ # # Tests for misspelled directives. # @@ -22,17 +22,17 @@ .expor varname .export varname .exporx varname -.exports varname # Accepted before 2020-12-13 01:??:??. +.exports varname # Accepted before 2020-12-13 01:07:54. -.export-en # Accepted before 2020-12-13 01:??:??. +.export-en # Accepted before 2020-12-13 01:07:54. .export-env .export-env extra argument # XXX: undetected extra argument -.export-environment # Accepted before 2020-12-13 01:??:??. +.export-environment # Accepted before 2020-12-13 01:07:54. -.export-litera varname # Accepted before 2020-12-13 01:??:??. +.export-litera varname # Accepted before 2020-12-13 01:07:54. .export-literal varname -.export-literax varname # Accepted before 2020-12-13 01:??:??. -.export-literally varname # Accepted before 2020-12-13 01:??:??. +.export-literax varname # Accepted before 2020-12-13 01:07:54. +.export-literally varname # Accepted before 2020-12-13 01:07:54. .-includ "file" .-include "file" @@ -47,7 +47,7 @@ .inf msg .info msg .infx msg -.infos msg # Accepted before 2020-12-13 01:??:??. +.infos msg # Accepted before 2020-12-13 01:07:54. .sinclud "file" .sinclude "file" @@ -57,7 +57,7 @@ .unde varname .undef varname .undex varname -.undefs varname # Accepted before 2020-12-13 01:??:??. +.undefs varname # Accepted before 2020-12-13 01:07:54. .unexpor varname .unexport varname @@ -74,6 +74,6 @@ .warnin msg .warning msg .warninx msg -.warnings msg # Accepted before 2020-12-13 01:??:??. +.warnings msg # Accepted before 2020-12-13 01:07:54. all: Index: src/usr.bin/make/unit-tests/directive-warning.mk diff -u src/usr.bin/make/unit-tests/directive-warning.mk:1.4 src/usr.bin/make/unit-tests/directive-warning.mk:1.5 --- src/usr.bin/make/unit-tests/directive-warning.mk:1.4 Sun Dec 13 01:07:54 2020 +++ src/usr.bin/make/unit-tests/directive-warning.mk Sun Dec 13 01:10:22 2020 @@ -1,4 +1,4 @@ -# $NetBSD: directive-warning.mk,v 1.4 2020/12/13 01:07:54 rillig Exp $ +# $NetBSD: directive-warning.mk,v 1.5 2020/12/13 01:10:22 rillig Exp $ # # Tests for the .warning directive. @@ -11,7 +11,7 @@ .warning # oops: should be "missing argument" .warning message # ok .warnings # misspelled -.warnings messages # Accepted before 2020-12-13 01:??:??. +.warnings messages # Accepted before 2020-12-13 01:07:54. all: @:;
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sun Dec 13 01:07:54 UTC 2020 Modified Files: src/usr.bin/make: parse.c src/usr.bin/make/unit-tests: directive-error.mk directive-export-env.mk directive-export-literal.mk directive-export.exp directive-export.mk directive-info.exp directive-info.mk directive-misspellings.exp directive-misspellings.mk directive-undef.exp directive-undef.mk directive-unexport.exp directive-unexport.mk directive-warning.exp directive-warning.mk Log Message: make(1): error out on misspelled directives Before, make accepted misspellings like .warnings, .export-literally and a few others, all of which are unlikely to occur in practice. See the test directive-misspellings.mk for further details. To generate a diff of this commit: cvs rdiff -u -r1.474 -r1.475 src/usr.bin/make/parse.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-error.mk \ src/usr.bin/make/unit-tests/directive-undef.exp \ src/usr.bin/make/unit-tests/directive-warning.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/directive-export-env.mk \ src/usr.bin/make/unit-tests/directive-export.exp \ src/usr.bin/make/unit-tests/directive-info.exp \ src/usr.bin/make/unit-tests/directive-warning.mk cvs rdiff -u -r1.6 -r1.7 \ src/usr.bin/make/unit-tests/directive-export-literal.mk \ src/usr.bin/make/unit-tests/directive-unexport.mk cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-export.mk \ src/usr.bin/make/unit-tests/directive-undef.mk \ src/usr.bin/make/unit-tests/directive-unexport.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-info.mk cvs rdiff -u -r1.1 -r1.2 \ src/usr.bin/make/unit-tests/directive-misspellings.exp \ src/usr.bin/make/unit-tests/directive-misspellings.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.474 src/usr.bin/make/parse.c:1.475 --- src/usr.bin/make/parse.c:1.474 Sat Dec 12 21:35:21 2020 +++ src/usr.bin/make/parse.c Sun Dec 13 01:07:54 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.474 2020/12/12 21:35:21 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.475 2020/12/13 01:07:54 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.474 2020/12/12 21:35:21 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.475 2020/12/13 01:07:54 rillig Exp $"); /* types and constants */ @@ -726,26 +726,20 @@ Parse_Error(ParseErrorLevel type, const /* Parse and handle a .info, .warning or .error directive. * For an .error directive, immediately exit. */ static Boolean -ParseMessage(const char *directive) +ParseMessage(ParseErrorLevel level, const char *umsg) { - const char *p = directive; - ParseErrorLevel mtype = *p == 'i' ? PARSE_INFO : - *p == 'w' ? PARSE_WARNING : PARSE_FATAL; - char *arg; + char *xmsg; - while (ch_isalpha(*p)) - p++; - if (!ch_isspace(*p)) + if (umsg[0] == '\0') return FALSE; /* missing argument */ - cpp_skip_whitespace(&p); - (void)Var_Subst(p, VAR_CMDLINE, VARE_WANTRES, &arg); + (void)Var_Subst(umsg, VAR_CMDLINE, VARE_WANTRES, &xmsg); /* TODO: handle errors */ - Parse_Error(mtype, "%s", arg); - free(arg); + Parse_Error(level, "%s", xmsg); + free(xmsg); - if (mtype == PARSE_FATAL) { + if (level == PARSE_FATAL) { PrintOnError(NULL, NULL); exit(1); } @@ -2949,6 +2943,12 @@ ParseLine_ShellCommand(const char *p) } } +MAKE_INLINE Boolean +IsDirective(const char *dir, size_t dirlen, const char *name) +{ + return dirlen == strlen(name) && memcmp(dir, name, dirlen) == 0; +} + /* * Lines that begin with '.' can be pretty much anything: * - directives like '.include' or '.if', @@ -2960,6 +2960,8 @@ static Boolean ParseDirective(char *line) { char *cp = line + 1; + const char *dir, *arg; + size_t dirlen; pp_skip_whitespace(&cp); if (IsInclude(cp, FALSE)) { @@ -2967,30 +2969,42 @@ ParseDirective(char *line) return TRUE; } - if (strncmp(cp, "undef", 5) == 0) { - const char *varname; - cp += 5; - pp_skip_whitespace(&cp); - varname = cp; + dir = cp; + while (ch_isalpha(*cp) || *cp == '-') + cp++; + dirlen = (size_t)(cp - dir); + + if (*cp != '\0' && !ch_isspace(*cp)) + return FALSE; + + pp_skip_whitespace(&cp); + arg = cp; + + if (IsDirective(dir, dirlen, "undef")) { for (; !ch_isspace(*cp) && *cp != '\0'; cp++) continue; *cp = '\0'; - Var_Delete(varname, VAR_GLOBAL); + Var_Delete(arg, VAR_GLOBAL); /* TODO: undefine all variables, not only the first */ /* TODO: use Str_Words, like everywhere else */ return TRUE; - } else if (strncmp(cp, "export", 6) == 0) { - cp += 6; - pp_skip_whitespace(&cp); - Var_Export(cp); + } else if (IsDirective(dir, dirlen, "export") ||
CVS commit: src
Module Name:src Committed By: rillig Date: Sun Dec 13 00:46:25 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: directive-misspellings.exp directive-misspellings.mk Log Message: make(1): add test for misspelled directives This test allows the other directive-* tests to focus on the purpose of the individual directive, allowing these tests to continue after parsing, without errors. To generate a diff of this commit: cvs rdiff -u -r1.991 -r1.992 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.245 -r1.246 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/directive-misspellings.exp \ src/usr.bin/make/unit-tests/directive-misspellings.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.991 src/distrib/sets/lists/tests/mi:1.992 --- src/distrib/sets/lists/tests/mi:1.991 Sun Dec 13 00:37:43 2020 +++ src/distrib/sets/lists/tests/mi Sun Dec 13 00:46:25 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.991 2020/12/13 00:37:43 roy Exp $ +# $NetBSD: mi,v 1.992 2020/12/13 00:46:25 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5072,6 +5072,8 @@ ./usr/tests/usr.bin/make/unit-tests/directive-include.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-info.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-info.mktests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/directive-misspellings.exp tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/directive-misspellings.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-sinclude.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-sinclude.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/directive-undef.exptests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.245 src/usr.bin/make/unit-tests/Makefile:1.246 --- src/usr.bin/make/unit-tests/Makefile:1.245 Sat Dec 12 15:06:11 2020 +++ src/usr.bin/make/unit-tests/Makefile Sun Dec 13 00:46:25 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.245 2020/12/12 15:06:11 rillig Exp $ +# $NetBSD: Makefile,v 1.246 2020/12/13 00:46:25 rillig Exp $ # # Unit tests for make(1) # @@ -164,6 +164,7 @@ TESTS+= directive-ifnmake TESTS+= directive-include TESTS+= directive-include-fatal TESTS+= directive-info +TESTS+= directive-misspellings TESTS+= directive-sinclude TESTS+= directive-undef TESTS+= directive-unexport Added files: Index: src/usr.bin/make/unit-tests/directive-misspellings.exp diff -u /dev/null src/usr.bin/make/unit-tests/directive-misspellings.exp:1.1 --- /dev/null Sun Dec 13 00:46:25 2020 +++ src/usr.bin/make/unit-tests/directive-misspellings.exp Sun Dec 13 00:46:25 2020 @@ -0,0 +1,38 @@ +make: "directive-misspellings.mk" line 12: Unknown directive "dinclud" +make: "directive-misspellings.mk" line 14: Unknown directive "dincludx" +make: "directive-misspellings.mk" line 15: .include filename must be delimited by '"' or '<' +make: "directive-misspellings.mk" line 17: Unknown directive "erro" +make: "directive-misspellings.mk" line 18: Unknown directive "errox" +make: "directive-misspellings.mk" line 22: Unknown directive "expor" +make: "directive-misspellings.mk" line 24: Unknown directive "exporx" +make: "directive-misspellings.mk" line 37: Unknown directive "-includ" +make: "directive-misspellings.mk" line 39: Unknown directive "-includx" +make: "directive-misspellings.mk" line 40: .include filename must be delimited by '"' or '<' +make: "directive-misspellings.mk" line 42: Unknown directive "includ" +make: "directive-misspellings.mk" line 43: Could not find file +make: "directive-misspellings.mk" line 44: Unknown directive "includx" +make: "directive-misspellings.mk" line 45: .include filename must be delimited by '"' or '<' +make: "directive-misspellings.mk" line 47: Unknown directive "inf" +make: "directive-misspellings.mk" line 48: msg +make: "directive-misspellings.mk" line 49: Unknown directive "infx" +make: "directive-misspellings.mk" line 50: msg +make: "directive-misspellings.mk" line 52: Unknown directive "sinclud" +make: "directive-misspellings.mk" line 54: Unknown directive "sincludx" +make: "directive-misspellings.mk" line 55: .include filename must be delimited by '"' or '<' +make: "directive-misspellings.mk" line 57: Unknown directive "unde" +make: "directive-misspellings.mk" line 59: Unknown directive "undex" +make: "directive-misspellings.mk" line 62: Unknown directive "unexpor" +make: "directive-mis
CVS commit: src/distrib/sets/lists/tests
Module Name:src Committed By: roy Date: Sun Dec 13 00:37:43 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi Log Message: t_ossaudio was installed for clang, so remove gcc marking To generate a diff of this commit: cvs rdiff -u -r1.990 -r1.991 src/distrib/sets/lists/tests/mi Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.990 src/distrib/sets/lists/tests/mi:1.991 --- src/distrib/sets/lists/tests/mi:1.990 Sat Dec 12 15:06:11 2020 +++ src/distrib/sets/lists/tests/mi Sun Dec 13 00:37:43 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.990 2020/12/12 15:06:11 rillig Exp $ +# $NetBSD: mi,v 1.991 2020/12/13 00:37:43 roy Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -3800,7 +3800,7 @@ ./usr/tests/lib/libossaudiotests-lib-tests compattestfile,atf ./usr/tests/lib/libossaudio/Atffile tests-lib-tests compattestfile,atf ./usr/tests/lib/libossaudio/Kyuafile tests-lib-tests compattestfile,atf,kyua -./usr/tests/lib/libossaudio/t_ossaudio tests-lib-tests compattestfile,atf,gcc +./usr/tests/lib/libossaudio/t_ossaudio tests-lib-tests compattestfile,atf ./usr/tests/lib/libposixtests-lib-tests compattestfile,atf ./usr/tests/lib/libposix/Atffile tests-lib-tests compattestfile,atf ./usr/tests/lib/libposix/Kyuafile tests-lib-tests compattestfile,atf,kyua
CVS commit: src/external/gpl2/diffutils/dist/src
Module Name:src Committed By: roy Date: Sun Dec 13 00:04:40 UTC 2020 Modified Files: src/external/gpl2/diffutils/dist/src: util.c Log Message: diffutils: execl requires a NULL sentinel To generate a diff of this commit: cvs rdiff -u -r1.1.1.1 -r1.2 src/external/gpl2/diffutils/dist/src/util.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/gpl2/diffutils/dist/src/util.c diff -u src/external/gpl2/diffutils/dist/src/util.c:1.1.1.1 src/external/gpl2/diffutils/dist/src/util.c:1.2 --- src/external/gpl2/diffutils/dist/src/util.c:1.1.1.1 Wed Jan 13 03:15:30 2016 +++ src/external/gpl2/diffutils/dist/src/util.c Sun Dec 13 00:04:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: util.c,v 1.1.1.1 2016/01/13 03:15:30 christos Exp $ */ +/* $NetBSD: util.c,v 1.2 2020/12/13 00:04:40 roy Exp $ */ /* Support routines for GNU DIFF. @@ -217,7 +217,7 @@ begin_output (void) close (pipes[0]); } - execl (pr_program, pr_program, "-h", name, 0); + execl (pr_program, pr_program, "-h", name, NULL); _exit (errno == ENOEXEC ? 126 : 127); } else
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 21:35:21 UTC 2020 Modified Files: src/usr.bin/make: parse.c Log Message: make(1): reduce indentation of ParseDirective To generate a diff of this commit: cvs rdiff -u -r1.473 -r1.474 src/usr.bin/make/parse.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.473 src/usr.bin/make/parse.c:1.474 --- src/usr.bin/make/parse.c:1.473 Sat Dec 12 21:20:30 2020 +++ src/usr.bin/make/parse.c Sat Dec 12 21:35:21 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.473 2020/12/12 21:20:30 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.474 2020/12/12 21:35:21 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.473 2020/12/12 21:20:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.474 2020/12/12 21:35:21 rillig Exp $"); /* types and constants */ @@ -2949,51 +2949,49 @@ ParseLine_ShellCommand(const char *p) } } +/* + * Lines that begin with '.' can be pretty much anything: + * - directives like '.include' or '.if', + * - suffix rules like '.c.o:', + * - dependencies for filenames that start with '.', + * - variable assignments like '.tmp=value'. + */ static Boolean ParseDirective(char *line) { - char *cp; + char *cp = line + 1; - if (*line == '.') { - /* - * Lines that begin with '.' can be pretty much anything: - * - directives like '.include' or '.if', - * - suffix rules like '.c.o:', - * - dependencies for filenames that start with '.', - * - variable assignments like '.tmp=value'. - */ - cp = line + 1; + pp_skip_whitespace(&cp); + if (IsInclude(cp, FALSE)) { + ParseDoInclude(cp); + return TRUE; + } + + if (strncmp(cp, "undef", 5) == 0) { + const char *varname; + cp += 5; pp_skip_whitespace(&cp); - if (IsInclude(cp, FALSE)) { - ParseDoInclude(cp); - return TRUE; - } - if (strncmp(cp, "undef", 5) == 0) { - const char *varname; - cp += 5; - pp_skip_whitespace(&cp); - varname = cp; - for (; !ch_isspace(*cp) && *cp != '\0'; cp++) -continue; - *cp = '\0'; - Var_Delete(varname, VAR_GLOBAL); - /* TODO: undefine all variables, not only the first */ - /* TODO: use Str_Words, like everywhere else */ - return TRUE; - } else if (strncmp(cp, "export", 6) == 0) { - cp += 6; - pp_skip_whitespace(&cp); - Var_Export(cp); - return TRUE; - } else if (strncmp(cp, "unexport", 8) == 0) { - Var_UnExport(cp); + varname = cp; + for (; !ch_isspace(*cp) && *cp != '\0'; cp++) + continue; + *cp = '\0'; + Var_Delete(varname, VAR_GLOBAL); + /* TODO: undefine all variables, not only the first */ + /* TODO: use Str_Words, like everywhere else */ + return TRUE; + } else if (strncmp(cp, "export", 6) == 0) { + cp += 6; + pp_skip_whitespace(&cp); + Var_Export(cp); + return TRUE; + } else if (strncmp(cp, "unexport", 8) == 0) { + Var_UnExport(cp); + return TRUE; + } else if (strncmp(cp, "info", 4) == 0 || + strncmp(cp, "error", 5) == 0 || + strncmp(cp, "warning", 7) == 0) { + if (ParseMessage(cp)) return TRUE; - } else if (strncmp(cp, "info", 4) == 0 || - strncmp(cp, "error", 5) == 0 || - strncmp(cp, "warning", 7) == 0) { - if (ParseMessage(cp)) -return TRUE; - } } return FALSE; } @@ -3105,7 +3103,7 @@ ParseDependency(char *line) static void ParseLine(char *line) { - if (ParseDirective(line)) + if (line[0] == '.' && ParseDirective(line)) return; if (*line == '\t') {
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 21:20:30 UTC 2020 Modified Files: src/usr.bin/make: nonints.h parse.c var.c Log Message: make(1): eliminate boolean argument of Var_Export To generate a diff of this commit: cvs rdiff -u -r1.167 -r1.168 src/usr.bin/make/nonints.h cvs rdiff -u -r1.472 -r1.473 src/usr.bin/make/parse.c cvs rdiff -u -r1.728 -r1.729 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/nonints.h diff -u src/usr.bin/make/nonints.h:1.167 src/usr.bin/make/nonints.h:1.168 --- src/usr.bin/make/nonints.h:1.167 Sat Dec 12 18:53:53 2020 +++ src/usr.bin/make/nonints.h Sat Dec 12 21:20:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.167 2020/12/12 18:53:53 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.168 2020/12/12 21:20:30 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -324,7 +324,8 @@ VarParseResult Var_Subst(const char *, G void Var_Stats(void); void Var_Dump(GNode *); void Var_ReexportVars(void); -void Var_Export(const char *, Boolean); +void Var_Export(const char *); +void Var_ExportVars(const char *); void Var_UnExport(const char *); /* util.c */ Index: src/usr.bin/make/parse.c diff -u src/usr.bin/make/parse.c:1.472 src/usr.bin/make/parse.c:1.473 --- src/usr.bin/make/parse.c:1.472 Sun Dec 6 20:33:44 2020 +++ src/usr.bin/make/parse.c Sat Dec 12 21:20:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse.c,v 1.472 2020/12/06 20:33:44 rillig Exp $ */ +/* $NetBSD: parse.c,v 1.473 2020/12/12 21:20:30 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -117,7 +117,7 @@ #include "pathnames.h" /* "@(#)parse.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: parse.c,v 1.472 2020/12/06 20:33:44 rillig Exp $"); +MAKE_RCSID("$NetBSD: parse.c,v 1.473 2020/12/12 21:20:30 rillig Exp $"); /* types and constants */ @@ -2042,7 +2042,7 @@ VarAssignSpecial(const char *name, const } else if (strcmp(name, MAKE_JOB_PREFIX) == 0) Job_SetPrefix(); else if (strcmp(name, MAKE_EXPORTED) == 0) - Var_Export(avalue, FALSE); + Var_ExportVars(avalue); } /* Perform the variable variable assignment in the given context. */ @@ -2983,7 +2983,7 @@ ParseDirective(char *line) } else if (strncmp(cp, "export", 6) == 0) { cp += 6; pp_skip_whitespace(&cp); - Var_Export(cp, TRUE); + Var_Export(cp); return TRUE; } else if (strncmp(cp, "unexport", 8) == 0) { Var_UnExport(cp); Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.728 src/usr.bin/make/var.c:1.729 --- src/usr.bin/make/var.c:1.728 Sat Dec 12 20:00:51 2020 +++ src/usr.bin/make/var.c Sat Dec 12 21:20:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.728 2020/12/12 20:00:51 rillig Exp $ */ +/* $NetBSD: var.c,v 1.729 2020/12/12 21:20:30 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.728 2020/12/12 20:00:51 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.729 2020/12/12 21:20:30 rillig Exp $"); /* A string that may need to be freed after use. */ typedef struct FStr { @@ -714,26 +714,32 @@ ExportVarsExpand(const char *uvarnames, * str has the format "[-env|-literal] varname...". */ void -Var_Export(const char *str, Boolean isExport) +Var_Export(const char *str) { VarExportFlags flags; - if (isExport && str[0] == '\0') { + if (str[0] == '\0') { var_exportedVars = VAR_EXPORTED_ALL; /* use with caution! */ return; } - if (isExport && strncmp(str, "-env", 4) == 0) { + if (strncmp(str, "-env", 4) == 0) { str += 4; flags = VAR_EXPORT_NORMAL; - } else if (isExport && strncmp(str, "-literal", 8) == 0) { + } else if (strncmp(str, "-literal", 8) == 0) { str += 8; flags = VAR_EXPORT_LITERAL; } else { flags = VAR_EXPORT_PARENT; } - ExportVarsExpand(str, isExport, flags); + ExportVarsExpand(str, TRUE, flags); +} + +void +Var_ExportVars(const char *varnames) +{ + ExportVarsExpand(varnames, FALSE, VAR_EXPORT_PARENT); }
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Sat Dec 12 20:31:57 UTC 2020 Modified Files: src/doc [netbsd-8]: CHANGES-8.3 Log Message: Ticket #1637 To generate a diff of this commit: cvs rdiff -u -r1.1.2.58 -r1.1.2.59 src/doc/CHANGES-8.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.3 diff -u src/doc/CHANGES-8.3:1.1.2.58 src/doc/CHANGES-8.3:1.1.2.59 --- src/doc/CHANGES-8.3:1.1.2.58 Sat Dec 12 13:00:18 2020 +++ src/doc/CHANGES-8.3 Sat Dec 12 20:31:57 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.3,v 1.1.2.58 2020/12/12 13:00:18 martin Exp $ +# $NetBSD: CHANGES-8.3,v 1.1.2.59 2020/12/12 20:31:57 martin Exp $ A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3 release: @@ -1450,3 +1450,9 @@ sys/dev/usb/ucom.c1.128 when detaching the device. [mrg, ticket #1636] +sys/dev/usb/ohci.c1.311,1.312 +sys/dev/usb/ohcivar.h1.62 + + PR 22646, PR 55835: restructure the abort code for TD based transfers. + [skrll, ticket #1637] +
CVS commit: [netbsd-8] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sat Dec 12 20:30:57 UTC 2020 Modified Files: src/sys/dev/usb [netbsd-8]: ohci.c ohcivar.h Log Message: Pull up following revision(s) (requested by skrll in ticket #1637): sys/dev/usb/ohci.c: revision 1.311 sys/dev/usb/ohci.c: revision 1.312 sys/dev/usb/ohcivar.h: revision 1.62 Restructure the abort code for TD based transfers (ctrl, bulk, intr). In PR kern/22646 some TDs can be on the done queue when the abort start and, if this is the case, they need to processed after the WDH interrupt. Instead of waiting for WDH we release TDs that have been touched by the HC and replace them with new ones. Once WDH happens the floating TDs will be returned to the free list. Also addresses the issue seen in PR kern/55835 Thanks to both Andreas Gustafsson and Edgar Fu=C3=9F for testing. Apologi= es to Andreas Gustafsson for not committing this to HEAD for 4y6m.w Remove leading space that crept in in the last change To generate a diff of this commit: cvs rdiff -u -r1.273.6.6 -r1.273.6.7 src/sys/dev/usb/ohci.c cvs rdiff -u -r1.58.10.1 -r1.58.10.2 src/sys/dev/usb/ohcivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/ohci.c diff -u src/sys/dev/usb/ohci.c:1.273.6.6 src/sys/dev/usb/ohci.c:1.273.6.7 --- src/sys/dev/usb/ohci.c:1.273.6.6 Tue Feb 25 18:52:44 2020 +++ src/sys/dev/usb/ohci.c Sat Dec 12 20:30:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.273.6.6 2020/02/25 18:52:44 martin Exp $ */ +/* $NetBSD: ohci.c,v 1.273.6.7 2020/12/12 20:30:57 martin Exp $ */ /* * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.273.6.6 2020/02/25 18:52:44 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.273.6.7 2020/12/12 20:30:57 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -390,6 +390,7 @@ ohci_detach(struct ohci_softc *sc, int f if (sc->sc_hcca != NULL) usb_freemem(&sc->sc_bus, &sc->sc_hccadma); pool_cache_destroy(sc->sc_xferpool); + cv_destroy(&sc->sc_abort_cv); return rv; } @@ -492,6 +493,7 @@ ohci_alloc_std(ohci_softc_t *sc) memset(&std->td, 0, sizeof(ohci_td_t)); std->nexttd = NULL; std->xfer = NULL; + std->held = NULL; return std; } @@ -539,14 +541,17 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s DPRINTFN(8, "xfer %#jx nstd %jd", (uintptr_t)xfer, nstd, 0, 0); - for (size_t j = 0; j < ox->ox_nstd;) { + for (size_t j = 0; j < ox->ox_nstd; j++) { ohci_soft_td_t *cur = ohci_alloc_std(sc); if (cur == NULL) goto nomem; - ox->ox_stds[j++] = cur; + ox->ox_stds[j] = cur; + cur->held = &ox->ox_stds[j]; cur->xfer = xfer; cur->flags = 0; + DPRINTFN(10, "xfer=%#jx new std=%#jx held at %#jx", (uintptr_t)ox, + (uintptr_t)cur, (uintptr_t)cur->held, 0); } return 0; @@ -797,6 +802,9 @@ ohci_init(ohci_softc_t *sc) for (i = 0; i < OHCI_HASH_SIZE; i++) LIST_INIT(&sc->sc_hash_itds[i]); + TAILQ_INIT(&sc->sc_abortingxfers); + cv_init(&sc->sc_abort_cv, "ohciabt"); + sc->sc_xferpool = pool_cache_init(sizeof(struct ohci_xfer), 0, 0, 0, "ohcixfer", NULL, IPL_USB, NULL, NULL, NULL); @@ -1313,6 +1321,21 @@ ohci_intr1(ohci_softc_t *sc) */ usb_schedsoftintr(&sc->sc_bus); } + if (eintrs & OHCI_SF) { + struct ohci_xfer *ox, *tmp; + TAILQ_FOREACH_SAFE(ox, &sc->sc_abortingxfers, ox_abnext, tmp) { + DPRINTFN(10, "SF %#jx xfer %#jx", (uintptr_t)sc, + (uintptr_t)ox, 0, 0); + ox->ox_abintrs &= ~OHCI_SF; + KASSERT(ox->ox_abintrs == 0); + TAILQ_REMOVE(&sc->sc_abortingxfers, ox, ox_abnext); + } + cv_broadcast(&sc->sc_abort_cv); + + KASSERT(TAILQ_EMPTY(&sc->sc_abortingxfers)); + DPRINTFN(10, "end SOF %#jx", (uintptr_t)sc, 0, 0, 0); + /* Don't remove OHIC_SF from eintrs so it is blocked below */ + } if (eintrs & OHCI_RD) { /* 1 argument, but zero format strings */ DPRINTFN(5, "resume detect", (uintptr_t)sc, 0, 0, 0); @@ -1391,12 +1414,22 @@ ohci_softintr(void *v) struct ohci_pipe *opipe; int len, cc; int i, j, actlen, iframes, uedir; - ohci_physaddr_t done; + ohci_physaddr_t done = 0; KASSERT(sc->sc_bus.ub_usepolling || mutex_owned(&sc->sc_lock)); OHCIHIST_FUNC(); OHCIHIST_CALLED(); + /* + * Only read hccadone if WDH is set - we might get here from places + * other than an interrupt + */ + if (!(OREAD4(sc, OHCI_INTERRUPT_STATUS) & OHCI_WDH)) { + DPRINTFN(10, "no WDH %#jx", (uintptr_t)sc, 0, 0, 0); + return; + } + + DPRINTFN(10, "WDH %#jx", (uintptr_t)sc, 0, 0, 0); usb_syncmem(&sc->sc_hccadma, offsetof(struct ohci_hcca, hcca_done_head), sizeof(sc->sc_hcca->hcca_done_head), BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); @@ -1449,11 +1482,19 @@ ohci_softintr(void *v) DPRINTFN(10, "--- TD dump end ---", 0, 0, 0, 0); for (std = sdone; std; std = stdnext) { - xfer = std->xfer; stdnext = std->dnext; -
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Sat Dec 12 20:30:03 UTC 2020 Modified Files: src/doc [netbsd-9]: CHANGES-9.2 Log Message: Ticket #1150 To generate a diff of this commit: cvs rdiff -u -r1.1.2.21 -r1.1.2.22 src/doc/CHANGES-9.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.2 diff -u src/doc/CHANGES-9.2:1.1.2.21 src/doc/CHANGES-9.2:1.1.2.22 --- src/doc/CHANGES-9.2:1.1.2.21 Sat Dec 12 13:04:48 2020 +++ src/doc/CHANGES-9.2 Sat Dec 12 20:30:03 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.2,v 1.1.2.21 2020/12/12 13:04:48 martin Exp $ +# $NetBSD: CHANGES-9.2,v 1.1.2.22 2020/12/12 20:30:03 martin Exp $ A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2 release: @@ -1211,3 +1211,9 @@ sys/dev/fdt/pwm_backlight.c 1.7 restored after dpms blanking. [mrg, ticket #1149] +sys/dev/usb/ohci.c1.311,1.312 +sys/dev/usb/ohcivar.h1.62 + + PR 22646, PR 55835: restructure the abort code for TD based transfers. + [skrll, ticket #1150] +
CVS commit: [netbsd-9] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sat Dec 12 20:29:11 UTC 2020 Modified Files: src/sys/dev/usb [netbsd-9]: ohci.c ohcivar.h Log Message: Pull up following revision(s) (requested by skrll in ticket #1150): sys/dev/usb/ohci.c: revision 1.311 sys/dev/usb/ohci.c: revision 1.312 sys/dev/usb/ohcivar.h: revision 1.62 Restructure the abort code for TD based transfers (ctrl, bulk, intr). In PR kern/22646 some TDs can be on the done queue when the abort start and, if this is the case, they need to processed after the WDH interrupt. Instead of waiting for WDH we release TDs that have been touched by the HC and replace them with new ones. Once WDH happens the floating TDs will be returned to the free list. Also addresses the issue seen in PR kern/55835 Thanks to both Andreas Gustafsson and Edgar Fu=C3=9F for testing. Apologi= es to Andreas Gustafsson for not committing this to HEAD for 4y6m.w Remove leading space that crept in in the last change To generate a diff of this commit: cvs rdiff -u -r1.289.4.5 -r1.289.4.6 src/sys/dev/usb/ohci.c cvs rdiff -u -r1.60 -r1.60.6.1 src/sys/dev/usb/ohcivar.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/ohci.c diff -u src/sys/dev/usb/ohci.c:1.289.4.5 src/sys/dev/usb/ohci.c:1.289.4.6 --- src/sys/dev/usb/ohci.c:1.289.4.5 Sun Mar 1 12:35:16 2020 +++ src/sys/dev/usb/ohci.c Sat Dec 12 20:29:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.289.4.5 2020/03/01 12:35:16 martin Exp $ */ +/* $NetBSD: ohci.c,v 1.289.4.6 2020/12/12 20:29:11 martin Exp $ */ /* * Copyright (c) 1998, 2004, 2005, 2012 The NetBSD Foundation, Inc. @@ -41,7 +41,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.289.4.5 2020/03/01 12:35:16 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.289.4.6 2020/12/12 20:29:11 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -389,6 +389,7 @@ ohci_detach(struct ohci_softc *sc, int f if (sc->sc_hcca != NULL) usb_freemem(&sc->sc_bus, &sc->sc_hccadma); pool_cache_destroy(sc->sc_xferpool); + cv_destroy(&sc->sc_abort_cv); return rv; } @@ -491,6 +492,7 @@ ohci_alloc_std(ohci_softc_t *sc) memset(&std->td, 0, sizeof(ohci_td_t)); std->nexttd = NULL; std->xfer = NULL; + std->held = NULL; return std; } @@ -538,14 +540,17 @@ ohci_alloc_std_chain(ohci_softc_t *sc, s DPRINTFN(8, "xfer %#jx nstd %jd", (uintptr_t)xfer, nstd, 0, 0); - for (size_t j = 0; j < ox->ox_nstd;) { + for (size_t j = 0; j < ox->ox_nstd; j++) { ohci_soft_td_t *cur = ohci_alloc_std(sc); if (cur == NULL) goto nomem; - ox->ox_stds[j++] = cur; + ox->ox_stds[j] = cur; + cur->held = &ox->ox_stds[j]; cur->xfer = xfer; cur->flags = 0; + DPRINTFN(10, "xfer=%#jx new std=%#jx held at %#jx", (uintptr_t)ox, + (uintptr_t)cur, (uintptr_t)cur->held, 0); } return 0; @@ -796,6 +801,9 @@ ohci_init(ohci_softc_t *sc) for (i = 0; i < OHCI_HASH_SIZE; i++) LIST_INIT(&sc->sc_hash_itds[i]); + TAILQ_INIT(&sc->sc_abortingxfers); + cv_init(&sc->sc_abort_cv, "ohciabt"); + sc->sc_xferpool = pool_cache_init(sizeof(struct ohci_xfer), 0, 0, 0, "ohcixfer", NULL, IPL_USB, NULL, NULL, NULL); @@ -1319,6 +1327,21 @@ ohci_intr1(ohci_softc_t *sc) */ usb_schedsoftintr(&sc->sc_bus); } + if (eintrs & OHCI_SF) { + struct ohci_xfer *ox, *tmp; + TAILQ_FOREACH_SAFE(ox, &sc->sc_abortingxfers, ox_abnext, tmp) { + DPRINTFN(10, "SF %#jx xfer %#jx", (uintptr_t)sc, + (uintptr_t)ox, 0, 0); + ox->ox_abintrs &= ~OHCI_SF; + KASSERT(ox->ox_abintrs == 0); + TAILQ_REMOVE(&sc->sc_abortingxfers, ox, ox_abnext); + } + cv_broadcast(&sc->sc_abort_cv); + + KASSERT(TAILQ_EMPTY(&sc->sc_abortingxfers)); + DPRINTFN(10, "end SOF %#jx", (uintptr_t)sc, 0, 0, 0); + /* Don't remove OHIC_SF from eintrs so it is blocked below */ + } if (eintrs & OHCI_RD) { DPRINTFN(5, "resume detect sc=%#jx", (uintptr_t)sc, 0, 0, 0); printf("%s: resume detect\n", device_xname(sc->sc_dev)); @@ -1395,12 +1418,22 @@ ohci_softintr(void *v) struct ohci_pipe *opipe; int len, cc; int i, j, actlen, iframes, uedir; - ohci_physaddr_t done; + ohci_physaddr_t done = 0; KASSERT(sc->sc_bus.ub_usepolling || mutex_owned(&sc->sc_lock)); OHCIHIST_FUNC(); OHCIHIST_CALLED(); + /* + * Only read hccadone if WDH is set - we might get here from places + * other than an interrupt + */ + if (!(OREAD4(sc, OHCI_INTERRUPT_STATUS) & OHCI_WDH)) { + DPRINTFN(10, "no WDH %#jx", (uintptr_t)sc, 0, 0, 0); + return; + } + + DPRINTFN(10, "WDH %#jx", (uintptr_t)sc, 0, 0, 0); usb_syncmem(&sc->sc_hccadma, offsetof(struct ohci_hcca, hcca_done_head), sizeof(sc->sc_hcca->hcca_done_head), BUS_DMASYNC_POSTWRITE | BUS_DMASYNC_POSTREAD); @@ -1453,11 +1486,19 @@ ohci_softintr(void *v) DPRINTFN(10, "--- TD dump end ---", 0, 0, 0, 0); for (std = sdone; std; std = stdnext) { - xfer = std->xfer; stdnex
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 20:00:52 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): extract ExportVarsExpand from Var_Export To generate a diff of this commit: cvs rdiff -u -r1.727 -r1.728 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.727 src/usr.bin/make/var.c:1.728 --- src/usr.bin/make/var.c:1.727 Sat Dec 12 19:39:34 2020 +++ src/usr.bin/make/var.c Sat Dec 12 20:00:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.727 2020/12/12 19:39:34 rillig Exp $ */ +/* $NetBSD: var.c,v 1.728 2020/12/12 20:00:51 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.727 2020/12/12 19:39:34 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.728 2020/12/12 20:00:51 rillig Exp $"); /* A string that may need to be freed after use. */ typedef struct FStr { @@ -694,6 +694,17 @@ ExportVars(const char *varnames, Boolean Words_Free(words); } +static void +ExportVarsExpand(const char *uvarnames, Boolean isExport, VarExportFlags flags) +{ + char *xvarnames; + + (void)Var_Subst(uvarnames, VAR_GLOBAL, VARE_WANTRES, &xvarnames); + /* TODO: handle errors */ + ExportVars(xvarnames, isExport, flags); + free(xvarnames); +} + /* * This is called when .export is seen or .MAKE.EXPORTED is modified. * @@ -706,7 +717,6 @@ void Var_Export(const char *str, Boolean isExport) { VarExportFlags flags; - char *varnames; if (isExport && str[0] == '\0') { var_exportedVars = VAR_EXPORTED_ALL; /* use with caution! */ @@ -723,10 +733,7 @@ Var_Export(const char *str, Boolean isEx flags = VAR_EXPORT_PARENT; } - (void)Var_Subst(str, VAR_GLOBAL, VARE_WANTRES, &varnames); - /* TODO: handle errors */ - ExportVars(varnames, isExport, flags); - free(varnames); + ExportVarsExpand(str, isExport, flags); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 19:39:34 UTC 2020 Modified Files: src/usr.bin/make: var.c Log Message: make(1): fix undefined behavior when exporting ${:U } To generate a diff of this commit: cvs rdiff -u -r1.726 -r1.727 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.726 src/usr.bin/make/var.c:1.727 --- src/usr.bin/make/var.c:1.726 Sat Dec 12 19:31:17 2020 +++ src/usr.bin/make/var.c Sat Dec 12 19:39:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.726 2020/12/12 19:31:17 rillig Exp $ */ +/* $NetBSD: var.c,v 1.727 2020/12/12 19:39:34 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.726 2020/12/12 19:31:17 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.727 2020/12/12 19:39:34 rillig Exp $"); /* A string that may need to be freed after use. */ typedef struct FStr { @@ -674,23 +674,24 @@ Var_ReexportVars(void) static void ExportVars(const char *varnames, Boolean isExport, VarExportFlags flags) { - if (varnames[0] != '\0') { - Words words = Str_Words(varnames, FALSE); + Words words = Str_Words(varnames, FALSE); + size_t i; - size_t i; - for (i = 0; i < words.len; i++) { - const char *name = words.words[i]; - if (ExportVar(name, flags)) { -if (var_exportedVars == VAR_EXPORTED_NONE) - var_exportedVars = VAR_EXPORTED_SOME; -if (isExport && (flags & VAR_EXPORT_PARENT)) { - Var_Append(MAKE_EXPORTED, name, - VAR_GLOBAL); -} - } - } - Words_Free(words); + if (words.len == 1 && words.words[0][0] == '\0') + words.len = 0; + + for (i = 0; i < words.len; i++) { + const char *varname = words.words[i]; + if (!ExportVar(varname, flags)) + continue; + + if (var_exportedVars == VAR_EXPORTED_NONE) + var_exportedVars = VAR_EXPORTED_SOME; + + if (isExport && (flags & VAR_EXPORT_PARENT)) + Var_Append(MAKE_EXPORTED, varname, VAR_GLOBAL); } + Words_Free(words); } /*
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 19:31:18 UTC 2020 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: directive-export.exp directive-export.mk Log Message: make(1): extract ExportVars from Var_Export To generate a diff of this commit: cvs rdiff -u -r1.725 -r1.726 src/usr.bin/make/var.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/directive-export.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-export.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.725 src/usr.bin/make/var.c:1.726 --- src/usr.bin/make/var.c:1.725 Sat Dec 12 18:53:53 2020 +++ src/usr.bin/make/var.c Sat Dec 12 19:31:17 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.725 2020/12/12 18:53:53 rillig Exp $ */ +/* $NetBSD: var.c,v 1.726 2020/12/12 19:31:17 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -131,7 +131,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.725 2020/12/12 18:53:53 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.726 2020/12/12 19:31:17 rillig Exp $"); /* A string that may need to be freed after use. */ typedef struct FStr { @@ -671,6 +671,28 @@ Var_ReexportVars(void) free(val); } +static void +ExportVars(const char *varnames, Boolean isExport, VarExportFlags flags) +{ + if (varnames[0] != '\0') { + Words words = Str_Words(varnames, FALSE); + + size_t i; + for (i = 0; i < words.len; i++) { + const char *name = words.words[i]; + if (ExportVar(name, flags)) { +if (var_exportedVars == VAR_EXPORTED_NONE) + var_exportedVars = VAR_EXPORTED_SOME; +if (isExport && (flags & VAR_EXPORT_PARENT)) { + Var_Append(MAKE_EXPORTED, name, + VAR_GLOBAL); +} + } + } + Words_Free(words); + } +} + /* * This is called when .export is seen or .MAKE.EXPORTED is modified. * @@ -683,7 +705,7 @@ void Var_Export(const char *str, Boolean isExport) { VarExportFlags flags; - char *val; + char *varnames; if (isExport && str[0] == '\0') { var_exportedVars = VAR_EXPORTED_ALL; /* use with caution! */ @@ -700,26 +722,10 @@ Var_Export(const char *str, Boolean isEx flags = VAR_EXPORT_PARENT; } - (void)Var_Subst(str, VAR_GLOBAL, VARE_WANTRES, &val); + (void)Var_Subst(str, VAR_GLOBAL, VARE_WANTRES, &varnames); /* TODO: handle errors */ - if (val[0] != '\0') { - Words words = Str_Words(val, FALSE); - - size_t i; - for (i = 0; i < words.len; i++) { - const char *name = words.words[i]; - if (ExportVar(name, flags)) { -if (var_exportedVars == VAR_EXPORTED_NONE) - var_exportedVars = VAR_EXPORTED_SOME; -if (isExport && (flags & VAR_EXPORT_PARENT)) { - Var_Append(MAKE_EXPORTED, name, - VAR_GLOBAL); -} - } - } - Words_Free(words); - } - free(val); + ExportVars(varnames, isExport, flags); + free(varnames); } Index: src/usr.bin/make/unit-tests/directive-export.exp diff -u src/usr.bin/make/unit-tests/directive-export.exp:1.2 src/usr.bin/make/unit-tests/directive-export.exp:1.3 --- src/usr.bin/make/unit-tests/directive-export.exp:1.2 Tue Nov 3 17:17:31 2020 +++ src/usr.bin/make/unit-tests/directive-export.exp Sat Dec 12 19:31:18 2020 @@ -1,4 +1,4 @@ -make: "directive-export.mk" line 25: Unknown directive "expor" +make: "directive-export.mk" line 29: Unknown directive "expor" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/directive-export.mk diff -u src/usr.bin/make/unit-tests/directive-export.mk:1.4 src/usr.bin/make/unit-tests/directive-export.mk:1.5 --- src/usr.bin/make/unit-tests/directive-export.mk:1.4 Tue Nov 3 17:17:31 2020 +++ src/usr.bin/make/unit-tests/directive-export.mk Sat Dec 12 19:31:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: directive-export.mk,v 1.4 2020/11/03 17:17:31 rillig Exp $ +# $NetBSD: directive-export.mk,v 1.5 2020/12/12 19:31:18 rillig Exp $ # # Tests for the .export directive. @@ -7,6 +7,10 @@ INDIRECT= indirect VAR= value $$ ${INDIRECT} +# Before 2020-12-13, this unusual expression invoked undefined behavior since +# it accessed out-of-bounds memory via Var_Export -> ExportVar -> MayExport. +.export ${:U } + # A variable is exported using the .export directive. # During that, its value is expanded, just like almost everywhere else. .export VAR
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 19:13:48 UTC 2020 Modified Files: src/usr.bin/make: str.c Log Message: make(1): remove redundant call to strlen in Str_Words To generate a diff of this commit: cvs rdiff -u -r1.74 -r1.75 src/usr.bin/make/str.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/str.c diff -u src/usr.bin/make/str.c:1.74 src/usr.bin/make/str.c:1.75 --- src/usr.bin/make/str.c:1.74 Mon Nov 16 18:28:27 2020 +++ src/usr.bin/make/str.c Sat Dec 12 19:13:47 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: str.c,v 1.74 2020/11/16 18:28:27 rillig Exp $ */ +/* $NetBSD: str.c,v 1.75 2020/12/12 19:13:47 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -71,7 +71,7 @@ #include "make.h" /* "@(#)str.c 5.8 (Berkeley) 6/1/90" */ -MAKE_RCSID("$NetBSD: str.c,v 1.74 2020/11/16 18:28:27 rillig Exp $"); +MAKE_RCSID("$NetBSD: str.c,v 1.75 2020/12/12 19:13:47 rillig Exp $"); /* Return the concatenation of s1 and s2, freshly allocated. */ char * @@ -142,7 +142,7 @@ Str_Words(const char *str, Boolean expan /* words_buf holds the words, separated by '\0'. */ str_len = strlen(str); - words_buf = bmake_malloc(strlen(str) + 1); + words_buf = bmake_malloc(str_len + 1); words_cap = str_len / 5 > 50 ? str_len / 5 : 50; words = bmake_malloc((words_cap + 1) * sizeof(char *));
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 18:53:53 UTC 2020 Modified Files: src/usr.bin/make: compat.c job.c main.c nonints.h var.c Log Message: make(1): rename Var_ExportVars to Var_ReexportVars To generate a diff of this commit: cvs rdiff -u -r1.207 -r1.208 src/usr.bin/make/compat.c cvs rdiff -u -r1.384 -r1.385 src/usr.bin/make/job.c cvs rdiff -u -r1.494 -r1.495 src/usr.bin/make/main.c cvs rdiff -u -r1.166 -r1.167 src/usr.bin/make/nonints.h cvs rdiff -u -r1.724 -r1.725 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/compat.c diff -u src/usr.bin/make/compat.c:1.207 src/usr.bin/make/compat.c:1.208 --- src/usr.bin/make/compat.c:1.207 Sat Dec 12 00:33:25 2020 +++ src/usr.bin/make/compat.c Sat Dec 12 18:53:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.207 2020/12/12 00:33:25 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.208 2020/12/12 18:53:53 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -96,7 +96,7 @@ #include "pathnames.h" /* "@(#)compat.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: compat.c,v 1.207 2020/12/12 00:33:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.208 2020/12/12 18:53:53 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -348,7 +348,7 @@ Compat_RunCommand(const char *cmdp, GNod Fatal("Could not fork"); } if (cpid == 0) { - Var_ExportVars(); + Var_ReexportVars(); #ifdef USE_META if (useMeta) { meta_compat_child(); Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.384 src/usr.bin/make/job.c:1.385 --- src/usr.bin/make/job.c:1.384 Sat Dec 12 13:13:34 2020 +++ src/usr.bin/make/job.c Sat Dec 12 18:53:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.384 2020/12/12 13:13:34 rillig Exp $ */ +/* $NetBSD: job.c,v 1.385 2020/12/12 18:53:53 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.384 2020/12/12 13:13:34 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.385 2020/12/12 18:53:53 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1459,7 +1459,7 @@ JobExec(Job *job, char **argv) # endif #endif - Var_ExportVars(); + Var_ReexportVars(); (void)execv(shellPath, argv); execDie("exec", shellPath); Index: src/usr.bin/make/main.c diff -u src/usr.bin/make/main.c:1.494 src/usr.bin/make/main.c:1.495 --- src/usr.bin/make/main.c:1.494 Fri Dec 11 23:00:59 2020 +++ src/usr.bin/make/main.c Sat Dec 12 18:53:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: main.c,v 1.494 2020/12/11 23:00:59 rillig Exp $ */ +/* $NetBSD: main.c,v 1.495 2020/12/12 18:53:53 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -109,7 +109,7 @@ #include "trace.h" /* "@(#)main.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: main.c,v 1.494 2020/12/11 23:00:59 rillig Exp $"); +MAKE_RCSID("$NetBSD: main.c,v 1.495 2020/12/12 18:53:53 rillig Exp $"); #if defined(MAKE_NATIVE) && !defined(lint) __COPYRIGHT("@(#) Copyright (c) 1988, 1989, 1990, 1993 " "The Regents of the University of California. " @@ -1799,7 +1799,7 @@ Cmd_Exec(const char *cmd, const char **e (void)dup2(pipefds[1], 1); (void)close(pipefds[1]); - Var_ExportVars(); + Var_ReexportVars(); (void)execv(shellPath, UNCONST(args)); _exit(1); Index: src/usr.bin/make/nonints.h diff -u src/usr.bin/make/nonints.h:1.166 src/usr.bin/make/nonints.h:1.167 --- src/usr.bin/make/nonints.h:1.166 Sat Dec 12 00:05:05 2020 +++ src/usr.bin/make/nonints.h Sat Dec 12 18:53:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: nonints.h,v 1.166 2020/12/12 00:05:05 rillig Exp $ */ +/* $NetBSD: nonints.h,v 1.167 2020/12/12 18:53:53 rillig Exp $ */ /*- * Copyright (c) 1988, 1989, 1990, 1993 @@ -323,7 +323,7 @@ VarParseResult Var_Parse(const char **, VarParseResult Var_Subst(const char *, GNode *, VarEvalFlags, char **); void Var_Stats(void); void Var_Dump(GNode *); -void Var_ExportVars(void); +void Var_ReexportVars(void); void Var_Export(const char *, Boolean); void Var_UnExport(const char *); Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.724 src/usr.bin/make/var.c:1.725 --- src/usr.bin/make/var.c:1.724 Sat Dec 12 18:11:42 2020 +++ src/usr.bin/make/var.c Sat Dec 12 18:53:53 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.724 2020/12/12 18:11:42 rillig Exp $ */ +/* $NetBSD: var.c,v 1.725 2020/12/12 18:53:53 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -98,7 +98,8 @@ * * Var_Delete Delete a variable. * - * Var_ExportVars Export some or even all variables to the environment + * Var_ReexportVars + * Export some or even all variables to the environment * of this process and its child processes. * * Var_Export
CVS commit: src/external/bsd/libfido2/lib
Module Name:src Committed By: christos Date: Sat Dec 12 18:45:12 UTC 2020 Modified Files: src/external/bsd/libfido2/lib: Makefile Log Message: Use the NetBSD-specific back-end. To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/external/bsd/libfido2/lib/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/libfido2/lib/Makefile diff -u src/external/bsd/libfido2/lib/Makefile:1.2 src/external/bsd/libfido2/lib/Makefile:1.3 --- src/external/bsd/libfido2/lib/Makefile:1.2 Fri Dec 4 13:27:44 2020 +++ src/external/bsd/libfido2/lib/Makefile Sat Dec 12 13:45:11 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.2 2020/12/04 18:27:44 christos Exp $ +# $NetBSD: Makefile,v 1.3 2020/12/12 18:45:11 christos Exp $ NOLINT= .include @@ -31,7 +31,7 @@ eddsa.c \ err.c \ es256.c \ hid.c \ -hid_openbsd.c \ +hid_netbsd.c \ info.c \ io.c \ iso7816.c \
CVS commit: src/external/bsd/libfido2/dist/src
Module Name:src Committed By: christos Date: Sat Dec 12 18:44:38 UTC 2020 Added Files: src/external/bsd/libfido2/dist/src: hid_netbsd.c Log Message: Add a NetBSD-specific back-end. (riastradh@) To generate a diff of this commit: cvs rdiff -u -r0 -r1.1 src/external/bsd/libfido2/dist/src/hid_netbsd.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Added files: Index: src/external/bsd/libfido2/dist/src/hid_netbsd.c diff -u /dev/null src/external/bsd/libfido2/dist/src/hid_netbsd.c:1.1 --- /dev/null Sat Dec 12 13:44:38 2020 +++ src/external/bsd/libfido2/dist/src/hid_netbsd.c Sat Dec 12 13:44:38 2020 @@ -0,0 +1,423 @@ +/* + * Copyright (c) 2020 Yubico AB. All rights reserved. + * Use of this source code is governed by a BSD-style + * license that can be found in the LICENSE file. + */ + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "fido.h" + +#define MAX_UHID 64 + +struct hid_netbsd { + int fd; + size_t report_in_len; + size_t report_out_len; +}; + +/* Hack to make this work with newer kernels even if /usr/include is old. */ +#if __NetBSD_Version__ < 90100 /* 9.1 */ +#define USB_HID_GET_RAW _IOR('h', 1, int) +#define USB_HID_SET_RAW _IOW('h', 2, int) +#endif + +static bool +is_fido(int fd) +{ + report_desc_t rdesc; + hid_data_t hdata; + hid_item_t hitem; + boolisfido; + intraw = 1; + + if ((rdesc = hid_get_report_desc(fd)) == NULL) { + fido_log_debug("%s: failed to get report descriptor", + __func__); + return (false); + } + if ((hdata = hid_start_parse(rdesc, 1 << hid_collection, -1)) + == NULL) { + fido_log_debug("%s: failed to parse report descriptor", + __func__); + hid_dispose_report_desc(rdesc); + return (false); + } + isfido = false; + while ((hid_get_item(hdata, &hitem)) > 0) { + if (HID_PAGE(hitem.usage) == 0xf1d0) { + isfido = true; + break; + } + } + hid_end_parse(hdata); + hid_dispose_report_desc(rdesc); + if (!isfido) + return (false); + +/* + * This step is not strictly necessary -- NetBSD puts fido + * devices into raw mode automatically by default, but in + * principle that might change, and this serves as a test to + * verify that we're running on a kernel with support for raw + * mode at all so we don't get confused issuing writes that try + * to set the report descriptor rather than transfer data on + * the output interrupt pipe as we need. + */ + if (ioctl(fd, USB_HID_SET_RAW, &raw) == -1) { + fido_log_debug("%s: unable to set raw", __func__); + return (false); + } + + return (true); +} + +static int +copy_info(fido_dev_info_t *di, const char *path) +{ + int fd = -1; + int ok = -1; + struct usb_device_info udi; + + memset(di, 0, sizeof(*di)); + memset(&udi, 0, sizeof(udi)); + + if ((fd = open(path, O_RDWR)) == -1) { + if (errno != EBUSY && errno != ENOENT) + fido_log_debug("%s: open %s: %s", __func__, path, + strerror(errno)); + goto fail; + } + if (!is_fido(fd)) + goto fail; + + if (ioctl(fd, USB_GET_DEVICEINFO, &udi) == -1) + goto fail; + + if ((di->path = strdup(path)) == NULL || + (di->manufacturer = strdup(udi.udi_vendor)) == NULL || + (di->product = strdup(udi.udi_product)) == NULL) + goto fail; + + di->vendor_id = (int16_t)udi.udi_vendorNo; + di->product_id = (int16_t)udi.udi_productNo; + + ok = 0; +fail: + if (fd != -1) + close(fd); + + if (ok < 0) { + free(di->path); + free(di->manufacturer); + free(di->product); + explicit_bzero(di, sizeof(*di)); + } + + return (ok); +} + +int +fido_hid_manifest(fido_dev_info_t *devlist, size_t ilen, size_t *olen) +{ + char path[64]; + size_t i; + + *olen = 0; + + if (ilen == 0) + return (FIDO_OK); /* nothing to do */ + + if (devlist == NULL || olen == NULL) + return (FIDO_ERR_INVALID_ARGUMENT); + + for (i = *olen = 0; i < MAX_UHID && *olen < ilen; i++) { + snprintf(path, sizeof(path), "/dev/uhid%zu", i); + if (copy_info(&devlist[*olen], path) == 0) { + devlist[*olen].io = (fido_dev_io_t) { +fido_hid_open, +fido_hid_close, +fido_hid_read, +fido_hid_write, + }; + ++(*olen); + } + } + + return (FIDO_OK); +} + +/* + * Workaround for NetBSD (as of 201910) bug that loses + * sync of DATA0/DATA1 sequence bit across uhid open/close. + * Send pings until we get a response - early pings with incorrect + * sequence bits will be ignored as duplicate packets by the device. + */ +static int +terrible_ping_kludge(struct hid_netbsd *ctx) +{ + u_char data[256]; + int i, n; + struct pollfd pfd; + + if (sizeof(data) < ctx->report_out_len + 1) + return -1; + for (i = 0; i < 4; i++) { + memset(data, 0, sizeof(data)); + /* broadcast channel ID */ + data[1] = 0xff; + data[2] = 0xff; + data[3] = 0xff; + data[4] = 0xff; + /* Ping command */ + data[5] = 0x81; + /* One byte ping only, Vasili */ + data
CVS commit: src/sys/kern
Module Name:src Committed By: christos Date: Sat Dec 12 18:41:13 UTC 2020 Modified Files: src/sys/kern: vfs_cache.c Log Message: Be more clear and don't rely on cur being the first member. To generate a diff of this commit: cvs rdiff -u -r1.148 -r1.149 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.148 src/sys/kern/vfs_cache.c:1.149 --- src/sys/kern/vfs_cache.c:1.148 Sat Dec 12 13:35:59 2020 +++ src/sys/kern/vfs_cache.c Sat Dec 12 13:41:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.148 2020/12/12 18:35:59 uwe Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.149 2020/12/12 18:41:13 christos Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -172,7 +172,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.148 2020/12/12 18:35:59 uwe Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.149 2020/12/12 18:41:13 christos Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -244,7 +244,8 @@ static kmutex_t cache_stat_lock __cachel #define COUNT(f) do { \ lwp_t *l = curlwp; \ KPREEMPT_DISABLE(l); \ - ((struct nchstats_percpu *)curcpu()->ci_data.cpu_nch)->f++; \ + struct nchcpu *nchcpu = curcpu()->ci_data.cpu_nch; \ + nchcpu->cur.f++; \ KPREEMPT_ENABLE(l); \ } while (/* CONSTCOND */ 0);
CVS commit: src/sys/kern
Module Name:src Committed By: uwe Date: Sat Dec 12 18:35:59 UTC 2020 Modified Files: src/sys/kern: vfs_cache.c Log Message: vfs_cache - do not write outside allocated memory. In cache_cpu_init allocate struct nchcpu, not struct nchstats_percpu. cache_update_stats expects the former (that contains two percpu structs). Stat updates where smashing whatever was in the next pool allocation. Reported by martin@ as crashes in ptyfs on Krups. To generate a diff of this commit: cvs rdiff -u -r1.147 -r1.148 src/sys/kern/vfs_cache.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/kern/vfs_cache.c diff -u src/sys/kern/vfs_cache.c:1.147 src/sys/kern/vfs_cache.c:1.148 --- src/sys/kern/vfs_cache.c:1.147 Thu Jun 4 03:08:33 2020 +++ src/sys/kern/vfs_cache.c Sat Dec 12 18:35:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_cache.c,v 1.147 2020/06/04 03:08:33 riastradh Exp $ */ +/* $NetBSD: vfs_cache.c,v 1.148 2020/12/12 18:35:59 uwe Exp $ */ /*- * Copyright (c) 2008, 2019, 2020 The NetBSD Foundation, Inc. @@ -172,7 +172,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.147 2020/06/04 03:08:33 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_cache.c,v 1.148 2020/12/12 18:35:59 uwe Exp $"); #define __NAMECACHE_PRIVATE #ifdef _KERNEL_OPT @@ -1106,8 +1106,7 @@ cache_cpu_init(struct cpu_info *ci) void *p; size_t sz; - sz = roundup2(sizeof(struct nchstats_percpu), coherency_unit) + - coherency_unit; + sz = roundup2(sizeof(struct nchcpu), coherency_unit) + coherency_unit; p = kmem_zalloc(sz, KM_SLEEP); ci->ci_data.cpu_nch = (void *)roundup2((uintptr_t)p, coherency_unit); }
CVS commit: src/external/bsd/pkg_install/dist/lib
Module Name:src Committed By: christos Date: Sat Dec 12 18:19:34 UTC 2020 Modified Files: src/external/bsd/pkg_install/dist/lib: plist.c Log Message: Don't try to memcpy (size_t)-1 bytes! To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/external/bsd/pkg_install/dist/lib/plist.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/pkg_install/dist/lib/plist.c diff -u src/external/bsd/pkg_install/dist/lib/plist.c:1.4 src/external/bsd/pkg_install/dist/lib/plist.c:1.5 --- src/external/bsd/pkg_install/dist/lib/plist.c:1.4 Wed Dec 2 08:53:50 2020 +++ src/external/bsd/pkg_install/dist/lib/plist.c Sat Dec 12 13:19:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: plist.c,v 1.4 2020/12/02 13:53:50 wiz Exp $ */ +/* $NetBSD: plist.c,v 1.5 2020/12/12 18:19:34 christos Exp $ */ #if HAVE_CONFIG_H #include "config.h" @@ -7,7 +7,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: plist.c,v 1.4 2020/12/02 13:53:50 wiz Exp $"); +__RCSID("$NetBSD: plist.c,v 1.5 2020/12/12 18:19:34 christos Exp $"); /* * FreeBSD install - a package for the installation and maintainance @@ -637,15 +637,16 @@ delete_package(Boolean ign_err, package_ fail = FAIL; goto pkgdb_cleanup; } - } - memcpy(&buf[SymlinkHeaderLen], tmp2, cc); - buf[SymlinkHeaderLen + cc] = 0x0; - if (strcmp(buf, p->next->name) != 0) { -printf("symlink %s is not same as recorded value, %s: %s\n", -buf, Force ? "deleting anyway" : "not deleting", tmp); -if (!Force) { - fail = FAIL; - goto pkgdb_cleanup; + } else { +memcpy(&buf[SymlinkHeaderLen], tmp2, cc); +buf[SymlinkHeaderLen + cc] = 0x0; +if (strcmp(buf, p->next->name) != 0) { + printf("symlink %s is not same as recorded value, %s: %s\n", + buf, Force ? "deleting anyway" : "not deleting", tmp); + if (!Force) { + fail = FAIL; + goto pkgdb_cleanup; + } } } }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 18:11:42 UTC 2020 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: directive-unexport-env.exp directive-unexport-env.mk directive-unexport.exp directive-unexport.mk Log Message: make(1): error out on misspelled .export directives To generate a diff of this commit: cvs rdiff -u -r1.723 -r1.724 src/usr.bin/make/var.c cvs rdiff -u -r1.3 -r1.4 \ src/usr.bin/make/unit-tests/directive-unexport-env.exp cvs rdiff -u -r1.6 -r1.7 \ src/usr.bin/make/unit-tests/directive-unexport-env.mk cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/directive-unexport.exp cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/directive-unexport.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.723 src/usr.bin/make/var.c:1.724 --- src/usr.bin/make/var.c:1.723 Sat Dec 12 18:00:18 2020 +++ src/usr.bin/make/var.c Sat Dec 12 18:11:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.723 2020/12/12 18:00:18 rillig Exp $ */ +/* $NetBSD: var.c,v 1.724 2020/12/12 18:11:42 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -130,7 +130,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.723 2020/12/12 18:00:18 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.724 2020/12/12 18:11:42 rillig Exp $"); /* A string that may need to be freed after use. */ typedef struct FStr { @@ -770,11 +770,15 @@ GetVarnamesToUnexport(const char *direct } what = UNEXPORT_ENV; - } else { + } else if (*p == '\0' || ch_isspace(*p)) { cpp_skip_whitespace(&p); what = p[0] != '\0' ? UNEXPORT_NAMED : UNEXPORT_ALL; if (what == UNEXPORT_NAMED) FStr_Assign(&varnames, p, NULL); + } else { + Parse_Error(PARSE_FATAL, "Unknown directive \"%s\"", directive); + what = UNEXPORT_NAMED; + FStr_Assign(&varnames, "", NULL); } if (what != UNEXPORT_NAMED) { Index: src/usr.bin/make/unit-tests/directive-unexport-env.exp diff -u src/usr.bin/make/unit-tests/directive-unexport-env.exp:1.3 src/usr.bin/make/unit-tests/directive-unexport-env.exp:1.4 --- src/usr.bin/make/unit-tests/directive-unexport-env.exp:1.3 Sat Dec 12 18:00:18 2020 +++ src/usr.bin/make/unit-tests/directive-unexport-env.exp Sat Dec 12 18:11:42 2020 @@ -1,3 +1,4 @@ +make: "directive-unexport-env.mk" line 13: Unknown directive "unexport-en" make: "directive-unexport-env.mk" line 15: Unknown directive "unexport-environment" Global:UT_EXPORTED = value Global:UT_UNEXPORTED = value Index: src/usr.bin/make/unit-tests/directive-unexport-env.mk diff -u src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.6 src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.7 --- src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.6 Sat Dec 12 18:00:18 2020 +++ src/usr.bin/make/unit-tests/directive-unexport-env.mk Sat Dec 12 18:11:42 2020 @@ -1,4 +1,4 @@ -# $NetBSD: directive-unexport-env.mk,v 1.6 2020/12/12 18:00:18 rillig Exp $ +# $NetBSD: directive-unexport-env.mk,v 1.7 2020/12/12 18:11:42 rillig Exp $ # # Tests for the .unexport-env directive. # @@ -10,7 +10,7 @@ # TODO: Implementation -.unexport-en # oops: misspelled +.unexport-en # misspelled .unexport-env # ok .unexport-environment # misspelled Index: src/usr.bin/make/unit-tests/directive-unexport.exp diff -u src/usr.bin/make/unit-tests/directive-unexport.exp:1.4 src/usr.bin/make/unit-tests/directive-unexport.exp:1.5 --- src/usr.bin/make/unit-tests/directive-unexport.exp:1.4 Tue Nov 3 17:17:31 2020 +++ src/usr.bin/make/unit-tests/directive-unexport.exp Sat Dec 12 18:11:42 2020 @@ -1,8 +1,9 @@ -make: "directive-unexport.mk" line 14: UT_A=a UT_B=b UT_C=c -make: "directive-unexport.mk" line 15: UT_A UT_B UT_C -make: "directive-unexport.mk" line 23: UT_A=a UT_B=b UT_C=c -make: "directive-unexport.mk" line 24: -make: "directive-unexport.mk" line 26: Unknown directive "unexpor" +make: "directive-unexport.mk" line 15: UT_A=a UT_B=b UT_C=c +make: "directive-unexport.mk" line 16: UT_A UT_B UT_C +make: "directive-unexport.mk" line 24: UT_A=a UT_B=b UT_C=c +make: "directive-unexport.mk" line 25: +make: "directive-unexport.mk" line 27: Unknown directive "unexpor" +make: "directive-unexport.mk" line 29: Unknown directive "unexporting works" make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/directive-unexport.mk diff -u src/usr.bin/make/unit-tests/directive-unexport.mk:1.5 src/usr.bin/make/unit-tests/directive-unexport.mk:1.6 --- src/usr.bin/make/unit-tests/directive-unexport.mk:1.5 Tue Nov 3 17:17:31 2020 +++ src/usr.bin/make/unit-tests/directive-unexport.mk Sat Dec 12 18:11:42 2020 @@ -1,8 +1,9 @@ -# $NetBSD: directive-unexport.mk,v 1.5 2020/11/03 17:17:31 rillig Exp $ +# $NetBSD: directive-unexport.mk,v 1.6 20
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 18:00:18 UTC 2020 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: directive-unexport-env.exp directive-unexport-env.mk Log Message: make(1): error out on misspelled .unexport-env To generate a diff of this commit: cvs rdiff -u -r1.722 -r1.723 src/usr.bin/make/var.c cvs rdiff -u -r1.2 -r1.3 \ src/usr.bin/make/unit-tests/directive-unexport-env.exp cvs rdiff -u -r1.5 -r1.6 \ src/usr.bin/make/unit-tests/directive-unexport-env.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.722 src/usr.bin/make/var.c:1.723 --- src/usr.bin/make/var.c:1.722 Sat Dec 12 00:53:23 2020 +++ src/usr.bin/make/var.c Sat Dec 12 18:00:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.722 2020/12/12 00:53:23 rillig Exp $ */ +/* $NetBSD: var.c,v 1.723 2020/12/12 18:00:18 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -130,7 +130,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.722 2020/12/12 00:53:23 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.723 2020/12/12 18:00:18 rillig Exp $"); /* A string that may need to be freed after use. */ typedef struct FStr { @@ -751,20 +751,30 @@ ClearEnv(void) } static void -GetVarnamesToUnexport(const char *str, +GetVarnamesToUnexport(const char *directive, FStr *out_varnames, UnexportWhat *out_what) { UnexportWhat what; FStr varnames = FSTR_INIT; + const char *p = directive; - str += strlen("unexport"); - if (strncmp(str, "-env", 4) == 0) + p += strlen("unexport"); + if (strncmp(p, "-env", 4) == 0) { + if (ch_isspace(p[4])) { + Parse_Error(PARSE_FATAL, + "The directive .unexport-env does not take " + "arguments"); + } else if (p[4] != '\0') { + Parse_Error(PARSE_FATAL, + "Unknown directive \"%s\"", directive); + } what = UNEXPORT_ENV; - else { - cpp_skip_whitespace(&str); - what = str[0] != '\0' ? UNEXPORT_NAMED : UNEXPORT_ALL; + + } else { + cpp_skip_whitespace(&p); + what = p[0] != '\0' ? UNEXPORT_NAMED : UNEXPORT_ALL; if (what == UNEXPORT_NAMED) - FStr_Assign(&varnames, str, NULL); + FStr_Assign(&varnames, p, NULL); } if (what != UNEXPORT_NAMED) { Index: src/usr.bin/make/unit-tests/directive-unexport-env.exp diff -u src/usr.bin/make/unit-tests/directive-unexport-env.exp:1.2 src/usr.bin/make/unit-tests/directive-unexport-env.exp:1.3 --- src/usr.bin/make/unit-tests/directive-unexport-env.exp:1.2 Sun Dec 6 16:06:11 2020 +++ src/usr.bin/make/unit-tests/directive-unexport-env.exp Sat Dec 12 18:00:18 2020 @@ -1,6 +1,8 @@ +make: "directive-unexport-env.mk" line 15: Unknown directive "unexport-environment" Global:UT_EXPORTED = value Global:UT_UNEXPORTED = value Global:.MAKE.EXPORTED = UT_EXPORTED +make: "directive-unexport-env.mk" line 21: The directive .unexport-env does not take arguments Var_Parse: ${.MAKE.EXPORTED:O:u} with VARE_WANTRES Applying ${.MAKE.EXPORTED:O} to "UT_EXPORTED" (VARE_WANTRES, none, none) Result of ${.MAKE.EXPORTED:O} is "UT_EXPORTED" (VARE_WANTRES, none, none) @@ -10,4 +12,6 @@ Unexporting "UT_EXPORTED" Global:delete .MAKE.EXPORTED Global:.MAKEFLAGS = -r -k -d v -d Global:.MAKEFLAGS = -r -k -d v -d 0 -exit status 0 +make: Fatal errors encountered -- cannot continue +make: stopped in unit-tests +exit status 1 Index: src/usr.bin/make/unit-tests/directive-unexport-env.mk diff -u src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.5 src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.6 --- src/usr.bin/make/unit-tests/directive-unexport-env.mk:1.5 Sun Dec 6 17:29:27 2020 +++ src/usr.bin/make/unit-tests/directive-unexport-env.mk Sat Dec 12 18:00:18 2020 @@ -1,15 +1,19 @@ -# $NetBSD: directive-unexport-env.mk,v 1.5 2020/12/06 17:29:27 rillig Exp $ +# $NetBSD: directive-unexport-env.mk,v 1.6 2020/12/12 18:00:18 rillig Exp $ # # Tests for the .unexport-env directive. +# +# Before 2020-12-13, the directive unexport-env wrongly accepted arguments +# and ignored them. +# +# Before 2020-12-13, misspelled directive names like "unexport-environment" +# were not properly detected. # TODO: Implementation .unexport-en # oops: misspelled .unexport-env # ok -.unexport-environment # oops: misspelled +.unexport-environment # misspelled -# As of 2020-12-06, the directive unexport-env is not supposed to accept -# arguments, but it does without complaining about them. .MAKEFLAGS: -dv UT_EXPORTED= value UT_UNEXPORTED= value
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 16:54:21 UTC 2020 Modified Files: src/usr.bin/make: Makefile Log Message: make(1): add number of uncovered lines to coverage report To generate a diff of this commit: cvs rdiff -u -r1.110 -r1.111 src/usr.bin/make/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/Makefile diff -u src/usr.bin/make/Makefile:1.110 src/usr.bin/make/Makefile:1.111 --- src/usr.bin/make/Makefile:1.110 Sat Dec 12 16:06:27 2020 +++ src/usr.bin/make/Makefile Sat Dec 12 16:54:20 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.110 2020/12/12 16:06:27 rillig Exp $ +# $NetBSD: Makefile,v 1.111 2020/12/12 16:54:20 rillig Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make @@ -43,12 +43,16 @@ USE_COVERAGE?= no # works only with gcc .if ${USE_COVERAGE} == "yes" GCOV?= gcov COPTS+= --coverage -O0 -ggdb -GCOV_PERL= if (/^File '(\S+)'/) { +GCOV_PERL= if (/^File '(?:.*\/)?(\S+)'/) { GCOV_PERL+= $$file = $$1; $$func = ""; GCOV_PERL+= } elsif (/^Function '(\S+)'/) { GCOV_PERL+= $$func = $$1; -GCOV_PERL+= } elsif (/^Lines executed:(\d+\.\d+)% of (\d+)/) { -GCOV_PERL+= printf("%6.2f %5d %s%s\n", $$1, $$2, $$file, $$func); +GCOV_PERL+= } elsif (/^Lines executed:(\d+\.\d+)% of (\d+)/ && defined($$file)) { +GCOV_PERL+= my ($$percent, $$lines) = ($$1, $$2); +GCOV_PERL+= my $$uncovered = `grep -c '\#\#\#\#\#:' < \$$(basename $$file.gcov)`; +GCOV_PERL+= printf("%7.2f %4d/%4d %s%s\n", +GCOV_PERL+= $$percent, $$uncovered, $$lines, $$file, $$func); +GCOV_PERL+= $$file = undef; GCOV_PERL+= } LDADD+= --coverage .endif @@ -169,8 +173,7 @@ test: .MAKE cd ${.CURDIR}/unit-tests \ && MAKEFLAGS= ${TEST_MAKE} -r -m / TEST_MAKE=${TEST_MAKE} ${TESTS:DTESTS=${TESTS:Q}} ${.TARGET} .if ${USE_COVERAGE} == yes - @${GCOV} ${GCOV_OPTS} ${SRCS} | perl -ne ${GCOV_PERL:Q} | sort -nr - @sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov + ${MAKE} report-coverage .endif accept sync-mi: .MAKE @@ -195,6 +198,13 @@ test-coverage: .PHONY @env USE_COVERAGE=yes COPTS="-O0 -ggdb" USER_CPPFLAGS="-DCLEANUP" \ sh -c 'make -s all -j8 && make -s test' +report-coverage: .PHONY + @echo 'covered uncovered file' + @${GCOV} ${GCOV_OPTS} ${SRCS} 2>&1 \ + | perl -ne ${GCOV_PERL:Q} \ + | sort -nr + @sed -i 's,^\([^:]*\): *[0-9]*:,\1: ,' *.gcov + .include .include
CVS commit: src/usr.sbin/acpitools/acpidump
Module Name:src Committed By: jmcneill Date: Sat Dec 12 16:08:39 UTC 2020 Modified Files: src/usr.sbin/acpitools/acpidump: acpi.c Log Message: Add support for decoding Platform Communications Channel Tables ("PCCT"). To generate a diff of this commit: cvs rdiff -u -r1.47 -r1.48 src/usr.sbin/acpitools/acpidump/acpi.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.sbin/acpitools/acpidump/acpi.c diff -u src/usr.sbin/acpitools/acpidump/acpi.c:1.47 src/usr.sbin/acpitools/acpidump/acpi.c:1.48 --- src/usr.sbin/acpitools/acpidump/acpi.c:1.47 Sun Dec 6 18:38:58 2020 +++ src/usr.sbin/acpitools/acpidump/acpi.c Sat Dec 12 16:08:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: acpi.c,v 1.47 2020/12/06 18:38:58 jmcneill Exp $ */ +/* $NetBSD: acpi.c,v 1.48 2020/12/12 16:08:39 jmcneill Exp $ */ /*- * Copyright (c) 1998 Doug Rabson @@ -30,7 +30,7 @@ */ #include -__RCSID("$NetBSD: acpi.c,v 1.47 2020/12/06 18:38:58 jmcneill Exp $"); +__RCSID("$NetBSD: acpi.c,v 1.48 2020/12/12 16:08:39 jmcneill Exp $"); #include #include @@ -103,6 +103,7 @@ static void acpi_handle_msct(ACPI_TABLE_ static void acpi_handle_ecdt(ACPI_TABLE_HEADER *sdp); static void acpi_handle_hpet(ACPI_TABLE_HEADER *sdp); static void acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp); +static void acpi_handle_pcct(ACPI_TABLE_HEADER *sdp); static void acpi_handle_pptt(ACPI_TABLE_HEADER *sdp); static void acpi_handle_sbst(ACPI_TABLE_HEADER *sdp); static void acpi_handle_slit(ACPI_TABLE_HEADER *sdp); @@ -2532,6 +2533,222 @@ acpi_handle_mcfg(ACPI_TABLE_HEADER *sdp) } static void +acpi_print_pcct_subspace(ACPI_PCCT_SUBSPACE *subspace) +{ + printf("\tType=Generic Subspace\n"); + printf("\tBase Address=0x%016jx\n", subspace->BaseAddress); + printf("\tLength=%jd\n", subspace->Length); + printf("\tDoorbell Address="); + acpi_print_gas(&subspace->DoorbellRegister); + printf("\n"); + printf("\tDoorbell Preserve=0x%016jx\n", subspace->PreserveMask); + printf("\tDoorbell Write=0x%016jx\n", subspace->WriteMask); + printf("\tLatency=%u us\n", subspace->Latency); + printf("\tMax Access Rate=%u\n", subspace->MaxAccessRate); + printf("\tMin Turnaround Time=%u us\n", subspace->MinTurnaroundTime); +} + +static void +acpi_print_pcct_hw_reduced(ACPI_PCCT_HW_REDUCED *subspace) +{ + printf("\tType=HW-reduced Subspace\n"); + printf("\tPlatform Interrupt=%u", subspace->PlatformInterrupt); + if (subspace->Flags & ACPI_PCCT_INTERRUPT_POLARITY) { + printf(", Edge triggered"); + } else { + printf(", Level triggered"); + } + if (subspace->Flags & ACPI_PCCT_INTERRUPT_MODE) { + printf(", Active low"); + } else { + printf(", Active high"); + } + printf("\n"); + printf("\tBase Address=0x%016jx\n", subspace->BaseAddress); + printf("\tLength=%jd\n", subspace->Length); + printf("\tDoorbell Register="); + acpi_print_gas(&subspace->DoorbellRegister); + printf("\n"); + printf("\tDoorbell Preserve=0x%016jx\n", subspace->PreserveMask); + printf("\tDoorbell Write=0x%016jx\n", subspace->WriteMask); + printf("\tLatency=%u us\n", subspace->Latency); + printf("\tMax Access Rate=%u\n", subspace->MaxAccessRate); + printf("\tMin Turnaround Time=%u us\n", subspace->MinTurnaroundTime); +} + +static void +acpi_print_pcct_hw_reduced_type2(ACPI_PCCT_HW_REDUCED_TYPE2 *subspace) +{ + printf("\tType=HW-reduced Subspace Type 2\n"); + printf("\tPlatform Interrupt=%u", subspace->PlatformInterrupt); + if (subspace->Flags & ACPI_PCCT_INTERRUPT_POLARITY) { + printf(", Edge triggered"); + } else { + printf(", Level triggered"); + } + if (subspace->Flags & ACPI_PCCT_INTERRUPT_MODE) { + printf(", Active low"); + } else { + printf(", Active high"); + } + printf("\n"); + printf("\tBase Address=0x%016jx\n", subspace->BaseAddress); + printf("\tLength=%jd\n", subspace->Length); + printf("\tDoorbell Register="); + acpi_print_gas(&subspace->DoorbellRegister); + printf("\n"); + printf("\tDoorbell Preserve=0x%016jx\n", subspace->PreserveMask); + printf("\tDoorbell Write=0x%016jx\n", subspace->WriteMask); + printf("\tLatency=%u us\n", subspace->Latency); + printf("\tMax Access Rate=%u\n", subspace->MaxAccessRate); + printf("\tMin Turnaround Time=%u us\n", subspace->MinTurnaroundTime); + printf("\tPlatform Interrupt Ack Register="); + acpi_print_gas(&subspace->PlatformAckRegister); + printf("\n"); + printf("\tPlatform Interrupt Ack Preserve=0x%016jx\n", subspace->AckPreserveMask); + printf("\tPlatform Interrupt Ack Write=0x%016jx\n", subspace->AckWriteMask); +} + +static void +acpi_print_pcct_ext_pcc_master(ACPI_PCCT_EXT_PCC_MASTER *subspace) +{ + printf("\tType=Extended PCC Master Subspace\n"); + printf("\tPlatform Interrupt=%u", subspace->PlatformInterrupt); + if (subspace->Flags & ACPI_PCCT_INTERRUPT_POLARITY) { + printf(", Edge triggered"); + } else { + printf(", Level triggered"); + } + if (subspace->Flags & ACPI_PCCT_INTERRUPT_MODE) { + printf(", Active low"); + } else { + printf(", Active h
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 16:06:27 UTC 2020 Modified Files: src/usr.bin/make: Makefile Log Message: make(1): add target test-coverage To generate a diff of this commit: cvs rdiff -u -r1.109 -r1.110 src/usr.bin/make/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/Makefile diff -u src/usr.bin/make/Makefile:1.109 src/usr.bin/make/Makefile:1.110 --- src/usr.bin/make/Makefile:1.109 Sun Dec 6 13:29:34 2020 +++ src/usr.bin/make/Makefile Sat Dec 12 16:06:27 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.109 2020/12/06 13:29:34 rillig Exp $ +# $NetBSD: Makefile,v 1.110 2020/12/12 16:06:27 rillig Exp $ # @(#)Makefile 5.2 (Berkeley) 12/28/90 PROG= make @@ -190,6 +190,11 @@ retest: .c.casm: ${COMPILE.c:S,^-c$,-S,} ${COPTS.${.IMPSRC}} ${.IMPSRC} -o ${.TARGET} +test-coverage: .PHONY + @make -s clean cleandir + @env USE_COVERAGE=yes COPTS="-O0 -ggdb" USER_CPPFLAGS="-DCLEANUP" \ + sh -c 'make -s all -j8 && make -s test' + .include .include
CVS commit: src
Module Name:src Committed By: rillig Date: Sat Dec 12 15:06:11 UTC 2020 Modified Files: src/distrib/sets/lists/tests: mi src/usr.bin/make/unit-tests: Makefile Added Files: src/usr.bin/make/unit-tests: sh-errctl.exp sh-errctl.mk Log Message: make(1): add test for a shell with error control None of the predefined shells has error control, and the corresponding code had not been covered by the existing unit tests. To generate a diff of this commit: cvs rdiff -u -r1.989 -r1.990 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.244 -r1.245 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/sh-errctl.exp \ src/usr.bin/make/unit-tests/sh-errctl.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.989 src/distrib/sets/lists/tests/mi:1.990 --- src/distrib/sets/lists/tests/mi:1.989 Sat Dec 12 03:03:14 2020 +++ src/distrib/sets/lists/tests/mi Sat Dec 12 15:06:11 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.989 2020/12/12 03:03:14 pgoyette Exp $ +# $NetBSD: mi,v 1.990 2020/12/12 15:06:11 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5278,6 +5278,8 @@ ./usr/tests/usr.bin/make/unit-tests/recursive.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/sh-dots.exp tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/sh-dots.mk tests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/sh-errctl.exptests-usr.bin-tests compattestfile,atf +./usr/tests/usr.bin/make/unit-tests/sh-errctl.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/sh-flags.exptests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/sh-flags.mk tests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/sh-jobs-error.exptests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.244 src/usr.bin/make/unit-tests/Makefile:1.245 --- src/usr.bin/make/unit-tests/Makefile:1.244 Thu Dec 10 17:06:13 2020 +++ src/usr.bin/make/unit-tests/Makefile Sat Dec 12 15:06:11 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.244 2020/12/10 17:06:13 rillig Exp $ +# $NetBSD: Makefile,v 1.245 2020/12/12 15:06:11 rillig Exp $ # # Unit tests for make(1) # @@ -262,6 +262,7 @@ TESTS+= # posix1 # broken by reverting TESTS+= recursive TESTS+= sh TESTS+= sh-dots +TESTS+= sh-errctl TESTS+= sh-flags TESTS+= sh-jobs TESTS+= sh-jobs-error @@ -484,6 +485,7 @@ SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,,' SED_CMDS.sh-dots+= -e 's,^\(\*\*\* Error code \)[1-9][0-9]*,\1,' +SED_CMDS.sh-errctl= ${STD_SED_CMDS.dj} SED_CMDS.sh-flags= ${STD_SED_CMDS.hide-from-output} SED_CMDS.suff-main+= ${STD_SED_CMDS.dg1} SED_CMDS.suff-main-several+= ${STD_SED_CMDS.dg1} @@ -521,7 +523,7 @@ unexport-env.rawout: export.mk # Some standard sed commands, to be used in the SED_CMDS above. -# Omit details from the output of the -dg1 option such as process IDs. +# Omit details such as process IDs from the output of the -dg1 option. STD_SED_CMDS.dg1= -e 's,${.CURDIR}$$,,' STD_SED_CMDS.dg1+= -e 's, ${DEFSYSPATH:U/usr/share/mk}$$, ,' STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE *=\) .*,\1 ,' @@ -529,6 +531,15 @@ STD_SED_CMDS.dg1+= -e 's,^\(\.MAKE\.[A-Z STD_SED_CMDS.dg1+= -e 's,^\(MACHINE[_ARCH]* *=\) .*,\1 ,' STD_SED_CMDS.dg1+= -e 's,^\(MAKE *=\) .*,\1 ,' +# Omit details such as process IDs from the output of the -dj option. +STD_SED_CMDS.dj= \ + -e 's,^\(Job_TokenWithdraw\)([0-9]*),\1(),' \ + -e 's,^([0-9][0-9]*) \(withdrew token\),() \1,' \ + -e 's, \(pid\) [0-9][0-9]*, \1 ,' \ + -e 's,^\(Process\) [0-9][0-9]*,\1 ,' \ + -e 's,^\(JobFinish:\) [0-9][0-9]*,\1 ,' \ + -e 's,^\( Command:\) .*,\1 ,' + # Reduce the noise for tests running with the -n option, since there is no # other way to suppress the echoing of the commands. STD_SED_CMDS.hide-from-output= \ Added files: Index: src/usr.bin/make/unit-tests/sh-errctl.exp diff -u /dev/null src/usr.bin/make/unit-tests/sh-errctl.exp:1.1 --- /dev/null Sat Dec 12 15:06:11 2020 +++ src/usr.bin/make/unit-tests/sh-errctl.exp Sat Dec 12 15:06:11 2020 @@ -0,0 +1,29 @@ +job_pipe -1 -1, maxjobs 1, tokens 1, compat 0 +Job_TokenWithdraw(): aborting 0, running 0 +() withdrew token +# echo off +echo silent +# echo on +# echo off +# error checking off +set +e +# echo on +echo ignerr; false +# echo off +# error checking on +set -e +# echo on +echo always +Running all + Command: +JobExec(all): pid added to jobs table +job table @ job started +job 0, status 3, flags ---, pid +silent +ignerr +always +Process exited/stopped status 0. +JobFinish: [all], status 0 +Job_TokenWithdraw(): aborting 0, running 0 +() withdrew token +exit status 0 Index: src/usr.bin/ma
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 13:13:34 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): clean up comments around JobPrintSpecials To generate a diff of this commit: cvs rdiff -u -r1.383 -r1.384 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.383 src/usr.bin/make/job.c:1.384 --- src/usr.bin/make/job.c:1.383 Sat Dec 12 12:56:56 2020 +++ src/usr.bin/make/job.c Sat Dec 12 13:13:34 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.383 2020/12/12 12:56:56 rillig Exp $ */ +/* $NetBSD: job.c,v 1.384 2020/12/12 13:13:34 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.383 2020/12/12 12:56:56 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.384 2020/12/12 13:13:34 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -819,11 +819,9 @@ ShellWriter_ErrOn(ShellWriter *wr, Boole } /* - * The shell has no error control, so we need to be weird to get it to - * ignore any errors from the command. If echoing is turned on, we turn it - * off and use the echoTmpl template to echo the command. Leave echoing - * off so the user doesn't see the weirdness we go through to ignore errors. - * Set cmdTemplate to use the weirdness instead of the simple "%s\n" template. + * The shell has no built-in error control, so emulate error control by + * enclosing each shell command in a template like "{ %s \n } || exit $?" + * (configurable per shell). */ static void JobPrintSpecialsEchoCtl(Job *job, ShellWriter *wr, CommandFlags *inout_cmdFlags, @@ -835,6 +833,11 @@ JobPrintSpecialsEchoCtl(Job *job, ShellW if (job->echo && inout_cmdFlags->echo) { ShellWriter_EchoOff(wr); ShellWriter_EchoCmd(wr, escCmd); + + /* + * Leave echoing off so the user doesn't see the commands + * for toggling the error checking. + */ inout_cmdFlags->echo = FALSE; } else { if (inout_cmdFlags->echo) @@ -854,9 +857,13 @@ static void JobPrintSpecials(Job *job, ShellWriter *wr, const char *escCmd, Boolean run, CommandFlags *inout_cmdFlags, const char **inout_cmdTemplate) { - if (!run) + if (!run) { + /* + * If there is no command to run, there is no need to switch + * error checking off and on again for nothing. + */ inout_cmdFlags->ignerr = FALSE; - else if (shell->hasErrCtl) + } else if (shell->hasErrCtl) ShellWriter_ErrOff(wr, job->echo && inout_cmdFlags->echo); else if (shell->runIgnTmpl != NULL && shell->runIgnTmpl[0] != '\0') { JobPrintSpecialsEchoCtl(job, wr, inout_cmdFlags, escCmd,
CVS commit: [netbsd-9] src/doc
Module Name:src Committed By: martin Date: Sat Dec 12 13:04:48 UTC 2020 Modified Files: src/doc [netbsd-9]: CHANGES-9.2 Log Message: Tickets #1147 - #1149 To generate a diff of this commit: cvs rdiff -u -r1.1.2.20 -r1.1.2.21 src/doc/CHANGES-9.2 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-9.2 diff -u src/doc/CHANGES-9.2:1.1.2.20 src/doc/CHANGES-9.2:1.1.2.21 --- src/doc/CHANGES-9.2:1.1.2.20 Fri Dec 11 15:44:07 2020 +++ src/doc/CHANGES-9.2 Sat Dec 12 13:04:48 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-9.2,v 1.1.2.20 2020/12/11 15:44:07 martin Exp $ +# $NetBSD: CHANGES-9.2,v 1.1.2.21 2020/12/12 13:04:48 martin Exp $ A complete list of changes from the NetBSD 9.1 release to the NetBSD 9.2 release: @@ -1194,3 +1194,20 @@ sys/dev/hyperv/if_hvn.c1.19 hvn(4): fix handling of generic ioctls, including ifconfig up/down. [nonaka, ticket #1146] +sys/dev/usb/ucom.c1.128 + + Properly wait for refcounts to drain to avoid potential panics + when detaching the device. + [mrg, ticket #1147] + +sbin/atactl/atactl.c1.84 + + Micron SMART 202 is percent lifetime used not remaining. + [mrg, ticket #1148] + +sys/dev/fdt/pwm_backlight.c 1.7 + + Save the new current level when set by the user, so it is properly + restored after dpms blanking. + [mrg, ticket #1149] +
CVS commit: [netbsd-9] src/sys/dev/fdt
Module Name:src Committed By: martin Date: Sat Dec 12 13:03:47 UTC 2020 Modified Files: src/sys/dev/fdt [netbsd-9]: pwm_backlight.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1149): sys/dev/fdt/pwm_backlight.c: revision 1.7 save the new current level when set by the user. stops PBP display from going back to default brightness after dpms, etc. ok jmcneill. To generate a diff of this commit: cvs rdiff -u -r1.4.10.1 -r1.4.10.2 src/sys/dev/fdt/pwm_backlight.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/fdt/pwm_backlight.c diff -u src/sys/dev/fdt/pwm_backlight.c:1.4.10.1 src/sys/dev/fdt/pwm_backlight.c:1.4.10.2 --- src/sys/dev/fdt/pwm_backlight.c:1.4.10.1 Tue Jan 21 10:39:58 2020 +++ src/sys/dev/fdt/pwm_backlight.c Sat Dec 12 13:03:46 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: pwm_backlight.c,v 1.4.10.1 2020/01/21 10:39:58 martin Exp $ */ +/* $NetBSD: pwm_backlight.c,v 1.4.10.2 2020/12/12 13:03:46 martin Exp $ */ /*- * Copyright (c) 2018 Jared McNeill @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: pwm_backlight.c,v 1.4.10.1 2020/01/21 10:39:58 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: pwm_backlight.c,v 1.4.10.2 2020/12/12 13:03:46 martin Exp $"); #include #include @@ -60,7 +60,7 @@ static void pwm_backlight_attach(device_ static void pwm_backlight_sysctl_init(struct pwm_backlight_softc *); static void pwm_backlight_pmf_init(struct pwm_backlight_softc *); -static void pwm_backlight_set(struct pwm_backlight_softc *, u_int); +static void pwm_backlight_set(struct pwm_backlight_softc *, u_int, bool); static u_int pwm_backlight_get(struct pwm_backlight_softc *); static const char *compatible[] = { @@ -129,7 +129,7 @@ pwm_backlight_attach(device_t parent, de if (of_getprop_uint32(phandle, "default-brightness-level", &default_level) == 0) { /* set the default level now */ - pwm_backlight_set(sc, default_level); + pwm_backlight_set(sc, default_level, true); } sc->sc_curlevel = pwm_backlight_get(sc); @@ -139,7 +139,7 @@ pwm_backlight_attach(device_t parent, de } static void -pwm_backlight_set(struct pwm_backlight_softc *sc, u_int index) +pwm_backlight_set(struct pwm_backlight_softc *sc, u_int index, bool set_cur) { struct pwm_config conf; @@ -153,6 +153,9 @@ pwm_backlight_set(struct pwm_backlight_s conf.duty_cycle = (conf.period * sc->sc_levels[index]) / sc->sc_levels[sc->sc_nlevels - 1]; pwm_set_config(sc->sc_pwm, &conf); pwm_enable(sc->sc_pwm); + + if (set_cur) + sc->sc_curlevel = index; } static u_int @@ -193,7 +196,7 @@ pwm_backlight_sysctl_helper(SYSCTLFN_ARG for (n = 0; n < sc->sc_nlevels; n++) { if (sc->sc_levels[n] == level) { - pwm_backlight_set(sc, n); + pwm_backlight_set(sc, n, true); return 0; } } @@ -255,7 +258,7 @@ pwm_backlight_enable(struct pwm_backligh if (sc->sc_pin) fdtbus_gpio_write(sc->sc_pin, enable); else - pwm_backlight_set(sc, enable ? sc->sc_curlevel : 0); + pwm_backlight_set(sc, enable ? sc->sc_curlevel : 0, false); } static void @@ -303,7 +306,7 @@ pwm_backlight_display_brightness_up(devi n = pwm_backlight_get(sc); if (n < sc->sc_nlevels - 1) - pwm_backlight_set(sc, n + 1); + pwm_backlight_set(sc, n + 1, true); } static void @@ -314,7 +317,7 @@ pwm_backlight_display_brightness_down(de n = pwm_backlight_get(sc); if (n > 0) - pwm_backlight_set(sc, n - 1); + pwm_backlight_set(sc, n - 1, true); } static void
CVS commit: [netbsd-9] src/sbin/atactl
Module Name:src Committed By: martin Date: Sat Dec 12 13:01:18 UTC 2020 Modified Files: src/sbin/atactl [netbsd-9]: atactl.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1148): sbin/atactl/atactl.c: revision 1.84 micron SMART 202 is percent lifetime used not remaining. almost gave myself a heart attack when my server said 7% remaining! To generate a diff of this commit: cvs rdiff -u -r1.83 -r1.83.2.1 src/sbin/atactl/atactl.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sbin/atactl/atactl.c diff -u src/sbin/atactl/atactl.c:1.83 src/sbin/atactl/atactl.c:1.83.2.1 --- src/sbin/atactl/atactl.c:1.83 Thu May 30 21:32:08 2019 +++ src/sbin/atactl/atactl.c Sat Dec 12 13:01:18 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: atactl.c,v 1.83 2019/05/30 21:32:08 mlelstv Exp $ */ +/* $NetBSD: atactl.c,v 1.83.2.1 2020/12/12 13:01:18 martin Exp $ */ /*- * Copyright (c) 1998, 2019 The NetBSD Foundation, Inc. @@ -35,7 +35,7 @@ #include #ifndef lint -__RCSID("$NetBSD: atactl.c,v 1.83 2019/05/30 21:32:08 mlelstv Exp $"); +__RCSID("$NetBSD: atactl.c,v 1.83.2.1 2020/12/12 13:01:18 martin Exp $"); #endif @@ -418,7 +418,7 @@ static const struct attr_table micron_sm { 189, "Factory bad block count", NULL }, { 197, "Current pending ECC count", NULL }, { 198, "SMART offline scan uncorrectable error count", NULL }, - { 202, "Percent lifetime remaining", NULL }, + { 202, "Percent lifetime used", NULL }, { 206, "Write error rate", NULL }, { 247, "Number of NAND pages of data written by the host", NULL }, { 248, "Number of NAND pages written by the FTL", NULL },
CVS commit: [netbsd-8] src/doc
Module Name:src Committed By: martin Date: Sat Dec 12 13:00:18 UTC 2020 Modified Files: src/doc [netbsd-8]: CHANGES-8.3 Log Message: Ticket #1636 To generate a diff of this commit: cvs rdiff -u -r1.1.2.57 -r1.1.2.58 src/doc/CHANGES-8.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/CHANGES-8.3 diff -u src/doc/CHANGES-8.3:1.1.2.57 src/doc/CHANGES-8.3:1.1.2.58 --- src/doc/CHANGES-8.3:1.1.2.57 Fri Dec 11 19:35:16 2020 +++ src/doc/CHANGES-8.3 Sat Dec 12 13:00:18 2020 @@ -1,4 +1,4 @@ -# $NetBSD: CHANGES-8.3,v 1.1.2.57 2020/12/11 19:35:16 martin Exp $ +# $NetBSD: CHANGES-8.3,v 1.1.2.58 2020/12/12 13:00:18 martin Exp $ A complete list of changes from the NetBSD 8.2 release to the NetBSD 8.3 release: @@ -1444,3 +1444,9 @@ sys/dev/hyperv/if_hvn.c1.19 (via pat hvn(4): fix SIOCSIFFLAGS ioctl handling to make ifconfig up/down work. [nonaka, ticket #1635] +sys/dev/usb/ucom.c1.128 + + Properly wait for refcounts to drain to avoid potential panics + when detaching the device. + [mrg, ticket #1636] +
CVS commit: [netbsd-8] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sat Dec 12 12:58:51 UTC 2020 Modified Files: src/sys/dev/usb [netbsd-8]: ucom.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1636): sys/dev/usb/ucom.c: revision 1.128 properly wait for refcounts to drain. fixes panic at detach that jmnceill saw. XXX: pullup-[89]. To generate a diff of this commit: cvs rdiff -u -r1.118.8.4 -r1.118.8.5 src/sys/dev/usb/ucom.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/ucom.c diff -u src/sys/dev/usb/ucom.c:1.118.8.4 src/sys/dev/usb/ucom.c:1.118.8.5 --- src/sys/dev/usb/ucom.c:1.118.8.4 Tue May 7 18:47:01 2019 +++ src/sys/dev/usb/ucom.c Sat Dec 12 12:58:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ucom.c,v 1.118.8.4 2019/05/07 18:47:01 martin Exp $ */ +/* $NetBSD: ucom.c,v 1.118.8.5 2020/12/12 12:58:51 martin Exp $ */ /* * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.118.8.4 2019/05/07 18:47:01 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.118.8.5 2020/12/12 12:58:51 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -431,7 +431,7 @@ ucom_detach(device_t self, int flags) } sc->sc_refcnt--; - while (sc->sc_refcnt > 0) { + while (sc->sc_refcnt >= 0) { /* Wake up anyone waiting */ if (tp != NULL) { mutex_spin_enter(&tty_lock);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 12:56:56 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): rename ParseRunOptions to ParseCommandFlags To generate a diff of this commit: cvs rdiff -u -r1.382 -r1.383 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.382 src/usr.bin/make/job.c:1.383 --- src/usr.bin/make/job.c:1.382 Sat Dec 12 12:54:58 2020 +++ src/usr.bin/make/job.c Sat Dec 12 12:56:56 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.382 2020/12/12 12:54:58 rillig Exp $ */ +/* $NetBSD: job.c,v 1.383 2020/12/12 12:56:56 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.382 2020/12/12 12:54:58 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.383 2020/12/12 12:56:56 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -710,7 +710,7 @@ JobFindPid(int pid, JobStatus status, Bo /* Parse leading '@', '-' and '+', which control the exact execution mode. */ static void -ParseRunOptions(char **pp, CommandFlags *out_cmdFlags) +ParseCommandFlags(char **pp, CommandFlags *out_cmdFlags) { char *p = *pp; out_cmdFlags->echo = TRUE; @@ -900,7 +900,7 @@ JobPrintCommand(Job *job, ShellWriter *w cmdTemplate = "%s\n"; - ParseRunOptions(&xcmd, &cmdFlags); + ParseCommandFlags(&xcmd, &cmdFlags); /* The '+' command flag overrides the -n or -N options. */ if (cmdFlags.always && !run) {
CVS commit: [netbsd-9] src/sys/dev/usb
Module Name:src Committed By: martin Date: Sat Dec 12 12:56:40 UTC 2020 Modified Files: src/sys/dev/usb [netbsd-9]: ucom.c Log Message: Pull up following revision(s) (requested by mrg in ticket #1147): sys/dev/usb/ucom.c: revision 1.128 properly wait for refcounts to drain. fixes panic at detach that jmnceill saw. XXX: pullup-[89]. To generate a diff of this commit: cvs rdiff -u -r1.125 -r1.125.2.1 src/sys/dev/usb/ucom.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/dev/usb/ucom.c diff -u src/sys/dev/usb/ucom.c:1.125 src/sys/dev/usb/ucom.c:1.125.2.1 --- src/sys/dev/usb/ucom.c:1.125 Thu May 9 02:43:35 2019 +++ src/sys/dev/usb/ucom.c Sat Dec 12 12:56:40 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ucom.c,v 1.125 2019/05/09 02:43:35 mrg Exp $ */ +/* $NetBSD: ucom.c,v 1.125.2.1 2020/12/12 12:56:40 martin Exp $ */ /* * Copyright (c) 1998, 2000 The NetBSD Foundation, Inc. @@ -34,7 +34,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.125 2019/05/09 02:43:35 mrg Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ucom.c,v 1.125.2.1 2020/12/12 12:56:40 martin Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -434,7 +434,7 @@ ucom_detach(device_t self, int flags) } sc->sc_refcnt--; - while (sc->sc_refcnt > 0) { + while (sc->sc_refcnt >= 0) { /* Wake up anyone waiting */ if (tp != NULL) { mutex_spin_enter(&tty_lock);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 12:54:58 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): extract ShellWriter_ErrOn from JobPrintCommand It had been conceptually wrong to modify cmdFlags.echo just to suppress echoing while enabling error checking. Now the code in JobPrintCommand speaks for itself and no longer needs any comments. The few lines at the end have the sole purpose of restoring the default state (echo + errChk) in the shell file. To generate a diff of this commit: cvs rdiff -u -r1.381 -r1.382 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.381 src/usr.bin/make/job.c:1.382 --- src/usr.bin/make/job.c:1.381 Sat Dec 12 12:28:06 2020 +++ src/usr.bin/make/job.c Sat Dec 12 12:54:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.381 2020/12/12 12:28:06 rillig Exp $ */ +/* $NetBSD: job.c,v 1.382 2020/12/12 12:54:58 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.381 2020/12/12 12:28:06 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.382 2020/12/12 12:54:58 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -798,22 +798,24 @@ ShellWriter_TraceOn(ShellWriter *wr) } } -/* - * We don't want the error-control commands showing up either, so we turn - * off echoing while executing them. We could put another field in the shell - * structure to tell JobDoOutput to look for this string too, but why make - * it any more complex than it already is? - */ static void ShellWriter_ErrOff(ShellWriter *wr, Boolean echo) { - if (echo && shell->hasEchoCtl) { + if (echo) ShellWriter_EchoOff(wr); - ShellWriter_Println(wr, shell->errOff); + ShellWriter_Println(wr, shell->errOff); + if (echo) + ShellWriter_EchoOn(wr); +} + +static void +ShellWriter_ErrOn(ShellWriter *wr, Boolean echo) +{ + if (echo) + ShellWriter_EchoOff(wr); + ShellWriter_Println(wr, shell->errOn); + if (echo) ShellWriter_EchoOn(wr); - } else { - ShellWriter_Println(wr, shell->errOff); - } } /* @@ -962,18 +964,10 @@ JobPrintCommand(Job *job, ShellWriter *w ShellWriter_PrintFmt(wr, cmdTemplate, xcmd); free(xcmdStart); free(escCmd); - if (cmdFlags.ignerr) { - /* - * If echoing is already off, there's no point in issuing the - * echoOff command. Otherwise we issue it and pretend it was on - * for the whole command... - */ - if (cmdFlags.echo && job->echo && shell->hasEchoCtl) { - ShellWriter_EchoOff(wr); - cmdFlags.echo = FALSE; - } - ShellWriter_Println(wr, shell->errOn); - } + + if (cmdFlags.ignerr) + ShellWriter_ErrOn(wr, cmdFlags.echo && job->echo); + if (!cmdFlags.echo) ShellWriter_EchoOn(wr); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 12:28:07 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): fix typo in comment of JobPrintCommand To generate a diff of this commit: cvs rdiff -u -r1.380 -r1.381 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.380 src/usr.bin/make/job.c:1.381 --- src/usr.bin/make/job.c:1.380 Sat Dec 12 11:33:10 2020 +++ src/usr.bin/make/job.c Sat Dec 12 12:28:06 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.380 2020/12/12 11:33:10 rillig Exp $ */ +/* $NetBSD: job.c,v 1.381 2020/12/12 12:28:06 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.380 2020/12/12 11:33:10 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.381 2020/12/12 12:28:06 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -946,7 +946,7 @@ JobPrintCommand(Job *job, ShellWriter *w } /* * If it's a comment line or blank, avoid the possible - * syntax error generated by "{\n} || exit 0". + * syntax error generated by "{\n} || exit $?". */ cmdTemplate = escCmd[0] == shell->commentChar || escCmd[0] == '\0'
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Sat Dec 12 12:13:12 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: sh-flags.mk Log Message: make(1): demonstrate that -s and .SILENT have the same effect To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/sh-flags.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/unit-tests/sh-flags.mk diff -u src/usr.bin/make/unit-tests/sh-flags.mk:1.2 src/usr.bin/make/unit-tests/sh-flags.mk:1.3 --- src/usr.bin/make/unit-tests/sh-flags.mk:1.2 Thu Dec 10 17:55:30 2020 +++ src/usr.bin/make/unit-tests/sh-flags.mk Sat Dec 12 12:13:12 2020 @@ -1,4 +1,4 @@ -# $NetBSD: sh-flags.mk,v 1.2 2020/12/10 17:55:30 rillig Exp $ +# $NetBSD: sh-flags.mk,v 1.3 2020/12/12 12:13:12 rillig Exp $ # # Tests for the effective RunFlags of a shell command (run/skip, echo/silent, # error check, trace), which are controlled by 12 different switches. These @@ -111,7 +111,7 @@ ${target}: .MAKE .if ${tgt-ignerr} == yes ${target}: .IGNORE .endif -.if ${tgt-silent} == yes +.if ${tgt-silent} == yes || ${OPT_TARGET:M*s*} ${target}: .SILENT .endif
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 11:33:10 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): make Job_Touch simpler To generate a diff of this commit: cvs rdiff -u -r1.379 -r1.380 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.379 src/usr.bin/make/job.c:1.380 --- src/usr.bin/make/job.c:1.379 Sat Dec 12 11:28:29 2020 +++ src/usr.bin/make/job.c Sat Dec 12 11:33:10 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.379 2020/12/12 11:28:29 rillig Exp $ */ +/* $NetBSD: job.c,v 1.380 2020/12/12 11:33:10 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.379 2020/12/12 11:28:29 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.380 2020/12/12 11:33:10 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1253,17 +1253,12 @@ Job_Touch(GNode *gn, Boolean echo) if (!GNode_ShouldExecute(gn)) return; - if (gn->type & OP_ARCHV) { + if (gn->type & OP_ARCHV) Arch_Touch(gn); - return; - } - - if (gn->type & OP_LIB) { + else if (gn->type & OP_LIB) Arch_TouchLib(gn); - return; - } - - TouchRegular(gn); + else + TouchRegular(gn); } /* Make sure the given node has all the commands it needs.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 11:28:29 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): split JobFinishDone into smaller functions To generate a diff of this commit: cvs rdiff -u -r1.378 -r1.379 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.378 src/usr.bin/make/job.c:1.379 --- src/usr.bin/make/job.c:1.378 Sat Dec 12 11:03:43 2020 +++ src/usr.bin/make/job.c Sat Dec 12 11:28:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.378 2020/12/12 11:03:43 rillig Exp $ */ +/* $NetBSD: job.c,v 1.379 2020/12/12 11:28:29 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.378 2020/12/12 11:03:43 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.379 2020/12/12 11:28:29 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1042,49 +1042,60 @@ JobClosePipes(Job *job) } static void -JobFinishDone(Job *job, int *inout_status) +JobFinishDoneExitedError(Job *job, int *inout_status) { - int status = *inout_status; - - if (WIFEXITED(status)) { - DEBUG2(JOB, "Process %d [%s] exited.\n", - job->pid, job->node->name); - if (WEXITSTATUS(status) != 0) { - SwitchOutputTo(job->node); + SwitchOutputTo(job->node); #ifdef USE_META - if (useMeta) { -meta_job_error(job, job->node, -job->ignerr, WEXITSTATUS(status)); - } + if (useMeta) { + meta_job_error(job, job->node, + job->ignerr, WEXITSTATUS(*inout_status)); + } #endif - if (!shouldDieQuietly(job->node, -1)) -(void)printf( -"*** [%s] Error code %d%s\n", -job->node->name, -WEXITSTATUS(status), -job->ignerr ? " (ignored)" : ""); - if (job->ignerr) { -*inout_status = 0; - } else { -if (deleteOnError) { - JobDeleteTarget(job->node); -} -PrintOnError(job->node, NULL); - } - } else if (DEBUG(JOB)) { - SwitchOutputTo(job->node); - (void)printf( - "*** [%s] Completed successfully\n", - job->node->name); - } - } else { - SwitchOutputTo(job->node); - (void)printf("*** [%s] Signal %d\n", - job->node->name, WTERMSIG(status)); - if (deleteOnError) { + if (!shouldDieQuietly(job->node, -1)) { + (void)printf("*** [%s] Error code %d%s\n", + job->node->name, WEXITSTATUS(*inout_status), + job->ignerr ? " (ignored)" : ""); + } + + if (job->ignerr) + *inout_status = 0; + else { + if (deleteOnError) JobDeleteTarget(job->node); - } + PrintOnError(job->node, NULL); } +} + +static void +JobFinishDoneExited(Job *job, int *inout_status) +{ + DEBUG2(JOB, "Process %d [%s] exited.\n", job->pid, job->node->name); + + if (WEXITSTATUS(*inout_status) != 0) + JobFinishDoneExitedError(job, inout_status); + else if (DEBUG(JOB)) { + SwitchOutputTo(job->node); + (void)printf("*** [%s] Completed successfully\n", + job->node->name); + } +} + +static void +JobFinishDoneSignaled(Job *job, int status) +{ + SwitchOutputTo(job->node); + (void)printf("*** [%s] Signal %d\n", job->node->name, WTERMSIG(status)); + if (deleteOnError) + JobDeleteTarget(job->node); +} + +static void +JobFinishDone(Job *job, int *inout_status) +{ + if (WIFEXITED(*inout_status)) + JobFinishDoneExited(job, inout_status); + else + JobFinishDoneSignaled(job, *inout_status); (void)fflush(stdout); }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 11:03:43 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): extract JobFinishDone from JobFinish To generate a diff of this commit: cvs rdiff -u -r1.377 -r1.378 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.377 src/usr.bin/make/job.c:1.378 --- src/usr.bin/make/job.c:1.377 Sat Dec 12 10:58:13 2020 +++ src/usr.bin/make/job.c Sat Dec 12 11:03:43 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.377 2020/12/12 10:58:13 rillig Exp $ */ +/* $NetBSD: job.c,v 1.378 2020/12/12 11:03:43 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.377 2020/12/12 10:58:13 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.378 2020/12/12 11:03:43 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1041,6 +1041,54 @@ JobClosePipes(Job *job) job->inPipe = -1; } +static void +JobFinishDone(Job *job, int *inout_status) +{ + int status = *inout_status; + + if (WIFEXITED(status)) { + DEBUG2(JOB, "Process %d [%s] exited.\n", + job->pid, job->node->name); + if (WEXITSTATUS(status) != 0) { + SwitchOutputTo(job->node); +#ifdef USE_META + if (useMeta) { +meta_job_error(job, job->node, +job->ignerr, WEXITSTATUS(status)); + } +#endif + if (!shouldDieQuietly(job->node, -1)) +(void)printf( +"*** [%s] Error code %d%s\n", +job->node->name, +WEXITSTATUS(status), +job->ignerr ? " (ignored)" : ""); + if (job->ignerr) { +*inout_status = 0; + } else { +if (deleteOnError) { + JobDeleteTarget(job->node); +} +PrintOnError(job->node, NULL); + } + } else if (DEBUG(JOB)) { + SwitchOutputTo(job->node); + (void)printf( + "*** [%s] Completed successfully\n", + job->node->name); + } + } else { + SwitchOutputTo(job->node); + (void)printf("*** [%s] Signal %d\n", + job->node->name, WTERMSIG(status)); + if (deleteOnError) { + JobDeleteTarget(job->node); + } + } + + (void)fflush(stdout); +} + /* * Do final processing for the given job including updating parent nodes and * starting new jobs as available/necessary. @@ -1089,48 +1137,8 @@ JobFinish(Job *job, int status) done = FALSE; } - if (done) { - if (WIFEXITED(status)) { - DEBUG2(JOB, "Process %d [%s] exited.\n", - job->pid, job->node->name); - if (WEXITSTATUS(status) != 0) { -SwitchOutputTo(job->node); -#ifdef USE_META -if (useMeta) { - meta_job_error(job, job->node, - job->ignerr, WEXITSTATUS(status)); -} -#endif -if (!shouldDieQuietly(job->node, -1)) - (void)printf( - "*** [%s] Error code %d%s\n", - job->node->name, - WEXITSTATUS(status), - job->ignerr ? " (ignored)" : ""); -if (job->ignerr) { - status = 0; -} else { - if (deleteOnError) { - JobDeleteTarget(job->node); - } - PrintOnError(job->node, NULL); -} - } else if (DEBUG(JOB)) { -SwitchOutputTo(job->node); -(void)printf( -"*** [%s] Completed successfully\n", -job->node->name); - } - } else { - SwitchOutputTo(job->node); - (void)printf("*** [%s] Signal %d\n", - job->node->name, WTERMSIG(status)); - if (deleteOnError) { -JobDeleteTarget(job->node); - } - } - (void)fflush(stdout); - } + if (done) + JobFinishDone(job, &status); #ifdef USE_META if (useMeta) {
CVS commit: src/doc
Module Name:src Committed By: wiz Date: Sat Dec 12 11:02:06 UTC 2020 Modified Files: src/doc: 3RDPARTY CHANGES Log Message: Mention pkg_install-20201212 To generate a diff of this commit: cvs rdiff -u -r1.1768 -r1.1769 src/doc/3RDPARTY cvs rdiff -u -r1.2765 -r1.2766 src/doc/CHANGES Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/doc/3RDPARTY diff -u src/doc/3RDPARTY:1.1768 src/doc/3RDPARTY:1.1769 --- src/doc/3RDPARTY:1.1768 Thu Dec 10 00:36:22 2020 +++ src/doc/3RDPARTY Sat Dec 12 11:02:06 2020 @@ -1,4 +1,4 @@ -# $NetBSD: 3RDPARTY,v 1.1768 2020/12/10 00:36:22 christos Exp $ +# $NetBSD: 3RDPARTY,v 1.1769 2020/12/12 11:02:06 wiz Exp $ # # This file contains a list of the software that has been integrated into # NetBSD where we are not the primary maintainer. @@ -1192,11 +1192,11 @@ definition (files.pf). userland code is reachover Makefiles are in src/usr.sbin/pf. Package: pkg_install -Version: 20201205 -Current Vers: 20201205 +Version: 20201212 +Current Vers: 20201212 Maintainer: The pkgsrc developers Home Page: http://www.pkgsrc.org/ -Date: 2020-12-05 +Date: 2020-12-12 Mailing List: tech-...@netbsd.org Responsible: joerg License: BSD Index: src/doc/CHANGES diff -u src/doc/CHANGES:1.2765 src/doc/CHANGES:1.2766 --- src/doc/CHANGES:1.2765 Thu Dec 10 00:36:23 2020 +++ src/doc/CHANGES Sat Dec 12 11:02:06 2020 @@ -1,4 +1,4 @@ -# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2765 $> +# LIST OF CHANGES FROM LAST RELEASE: <$Revision: 1.2766 $> # # # [Note: This file does not mention every change made to the NetBSD source tree. @@ -315,3 +315,4 @@ Changes from NetBSD 9.0 to NetBSD 10.0: pkg_install: Updated to 20201205. [wiz 20201205] acpicpu(4): Add support for Arm CPUs. [jmcneill 20201207] OpenSSL: Imported 1.1.1i. [christos 20201209] + pkg_install: Updated to 20201212. [wiz 20201212]
CVS commit: src/external/bsd/pkg_install/dist
Module Name:src Committed By: wiz Date: Sat Dec 12 11:00:57 UTC 2020 Modified Files: src/external/bsd/pkg_install/dist/add: perform.c src/external/bsd/pkg_install/dist/lib: lib.h parse-config.c pkg_install.conf.5.in version.h Log Message: merge pkg_install-20201212 To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/external/bsd/pkg_install/dist/add/perform.c cvs rdiff -u -r1.10 -r1.11 src/external/bsd/pkg_install/dist/lib/lib.h cvs rdiff -u -r1.3 -r1.4 src/external/bsd/pkg_install/dist/lib/parse-config.c \ src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in cvs rdiff -u -r1.17 -r1.18 src/external/bsd/pkg_install/dist/lib/version.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/external/bsd/pkg_install/dist/add/perform.c diff -u src/external/bsd/pkg_install/dist/add/perform.c:1.7 src/external/bsd/pkg_install/dist/add/perform.c:1.8 --- src/external/bsd/pkg_install/dist/add/perform.c:1.7 Wed Dec 2 13:53:50 2020 +++ src/external/bsd/pkg_install/dist/add/perform.c Sat Dec 12 11:00:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: perform.c,v 1.7 2020/12/02 13:53:50 wiz Exp $ */ +/* $NetBSD: perform.c,v 1.8 2020/12/12 11:00:57 wiz Exp $ */ #if HAVE_CONFIG_H #include "config.h" #endif @@ -6,7 +6,7 @@ #if HAVE_SYS_CDEFS_H #include #endif -__RCSID("$NetBSD: perform.c,v 1.7 2020/12/02 13:53:50 wiz Exp $"); +__RCSID("$NetBSD: perform.c,v 1.8 2020/12/12 11:00:57 wiz Exp $"); /*- * Copyright (c) 2003 Grant Beattie @@ -151,6 +151,15 @@ compatible_platform(const char *opsys, c { int i = 0; +/* + * If the user has set the CHECK_OS_VERSION variable to "no" then skip any + * uname version checks and assume they know what they are doing. This can + * be useful on OS where the kernel version is not a good indicator of + * userland compatibility, or differs but retains ABI compatibility. + */ +if (strcasecmp(check_os_version, "no") == 0) + return 1; + /* returns 1 if host and package operating system match */ if (strcmp(host, package) == 0) return 1; @@ -1179,6 +1188,10 @@ check_dependencies(struct pkg_task *pkg) continue; best_installed = find_best_matching_installed_pkg(p->name, 0); + if (best_installed == NULL) { + warnx("Expected dependency %s still missing", p->name); + return -1; + } for (i = 0; i < pkg->dep_length; ++i) { if (strcmp(best_installed, pkg->dependencies[i]) == 0) @@ -1225,6 +1238,8 @@ preserve_meta_data_file(struct pkg_task static int start_replacing(struct pkg_task *pkg) { + int result = -1; + if (preserve_meta_data_file(pkg, REQUIRED_BY_FNAME)) return -1; @@ -1241,14 +1256,19 @@ start_replacing(struct pkg_task *pkg) Destdir ? " -P ": "", Destdir ? Destdir : "", pkg->other_version); } - if (!Fake) - fexec_skipempty(BINDIR "/pkg_delete", "-K", pkgdb_get_dir(), + if (!Fake) { + result = fexec_skipempty(BINDIR "/pkg_delete", "-K", pkgdb_get_dir(), "-p", pkg->prefix, Destdir ? "-P": "", Destdir ? Destdir : "", pkg->other_version, NULL); + if (result != 0) { + warnx("command failed: %s/pkg_delete -K %s -p %s %s%s%s", + BINDIR, pkgdb_get_dir(), pkg->prefix, Destdir ? "-P" : " ", + Destdir ? Destdir : "", pkg->other_version); + } + } - /* XXX Check return value and do what? */ - return 0; + return result; } static int check_input(const char *line, size_t len) Index: src/external/bsd/pkg_install/dist/lib/lib.h diff -u src/external/bsd/pkg_install/dist/lib/lib.h:1.10 src/external/bsd/pkg_install/dist/lib/lib.h:1.11 --- src/external/bsd/pkg_install/dist/lib/lib.h:1.10 Wed Dec 2 13:53:50 2020 +++ src/external/bsd/pkg_install/dist/lib/lib.h Sat Dec 12 11:00:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: lib.h,v 1.10 2020/12/02 13:53:50 wiz Exp $ */ +/* $NetBSD: lib.h,v 1.11 2020/12/12 11:00:57 wiz Exp $ */ /* from FreeBSD Id: lib.h,v 1.25 1997/10/08 07:48:03 charnier Exp */ @@ -447,6 +447,7 @@ extern const char *cert_chain_file; extern const char *certs_packages; extern const char *certs_pkg_vulnerabilities; extern const char *check_eol; +extern const char *check_os_version; extern const char *check_vulnerabilities; extern const char *config_file; extern const char *config_pkg_dbdir; Index: src/external/bsd/pkg_install/dist/lib/parse-config.c diff -u src/external/bsd/pkg_install/dist/lib/parse-config.c:1.3 src/external/bsd/pkg_install/dist/lib/parse-config.c:1.4 --- src/external/bsd/pkg_install/dist/lib/parse-config.c:1.3 Sat Apr 6 00:05:47 2019 +++ src/external/bsd/pkg_install/dist/lib/parse-config.c Sat Dec 12 11:00:57 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: parse-config.c,v
CVS import: src/external/bsd/pkg_install/dist
Module Name:src Committed By: wiz Date: Sat Dec 12 10:59:13 UTC 2020 Update of /cvsroot/src/external/bsd/pkg_install/dist In directory ivanova.netbsd.org:/tmp/cvs-serv25140 Log Message: pkg_install: import version 20201212 from pkgsrc Two bugfixes and a check_os_version config variable. Addresses PR 55865 Status: Vendor Tag: PKGSRC Release Tags: pkg_install-20201212 U src/external/bsd/pkg_install/dist/add/add.h U src/external/bsd/pkg_install/dist/add/main.c C src/external/bsd/pkg_install/dist/add/perform.c U src/external/bsd/pkg_install/dist/add/pkg_add.1 U src/external/bsd/pkg_install/dist/admin/audit-packages.8 U src/external/bsd/pkg_install/dist/admin/admin.h U src/external/bsd/pkg_install/dist/admin/audit-packages.sh.in U src/external/bsd/pkg_install/dist/admin/audit.c U src/external/bsd/pkg_install/dist/admin/check.c U src/external/bsd/pkg_install/dist/admin/download-vulnerability-list.sh.in U src/external/bsd/pkg_install/dist/admin/download-vulnerability-list.8 U src/external/bsd/pkg_install/dist/admin/main.c U src/external/bsd/pkg_install/dist/admin/pkg_admin.1 C src/external/bsd/pkg_install/dist/lib/parse-config.c U src/external/bsd/pkg_install/dist/lib/automatic.c U src/external/bsd/pkg_install/dist/lib/config.h.in U src/external/bsd/pkg_install/dist/lib/conflicts.c U src/external/bsd/pkg_install/dist/lib/defs.h U src/external/bsd/pkg_install/dist/lib/dewey.c U src/external/bsd/pkg_install/dist/lib/dewey.h U src/external/bsd/pkg_install/dist/lib/fexec.c U src/external/bsd/pkg_install/dist/lib/file.c U src/external/bsd/pkg_install/dist/lib/global.c U src/external/bsd/pkg_install/dist/lib/gpgsig.c U src/external/bsd/pkg_install/dist/lib/iterate.c C src/external/bsd/pkg_install/dist/lib/lib.h U src/external/bsd/pkg_install/dist/lib/license.c U src/external/bsd/pkg_install/dist/lib/lpkg.c U src/external/bsd/pkg_install/dist/lib/opattern.c U src/external/bsd/pkg_install/dist/lib/pkcs7.c U src/external/bsd/pkg_install/dist/lib/pkg_io.c U src/external/bsd/pkg_install/dist/lib/vulnerabilities-file.c C src/external/bsd/pkg_install/dist/lib/pkg_install.conf.5.in U src/external/bsd/pkg_install/dist/lib/pkg_signature.c U src/external/bsd/pkg_install/dist/lib/pkg_summary.5 U src/external/bsd/pkg_install/dist/lib/pkgdb.c U src/external/bsd/pkg_install/dist/lib/pkgsrc.7 U src/external/bsd/pkg_install/dist/lib/plist.c U src/external/bsd/pkg_install/dist/lib/remove.c U src/external/bsd/pkg_install/dist/lib/str.c U src/external/bsd/pkg_install/dist/lib/var.c U src/external/bsd/pkg_install/dist/lib/version.c C src/external/bsd/pkg_install/dist/lib/version.h U src/external/bsd/pkg_install/dist/lib/xwrapper.c U src/external/bsd/pkg_install/dist/create/build.c U src/external/bsd/pkg_install/dist/create/create.h U src/external/bsd/pkg_install/dist/create/main.c U src/external/bsd/pkg_install/dist/create/perform.c U src/external/bsd/pkg_install/dist/create/pkg_create.1 U src/external/bsd/pkg_install/dist/create/util.c U src/external/bsd/pkg_install/dist/create/pl.c U src/external/bsd/pkg_install/dist/delete/pkg_delete.1 U src/external/bsd/pkg_install/dist/delete/pkg_delete.c U src/external/bsd/pkg_install/dist/info/info.h U src/external/bsd/pkg_install/dist/info/main.c U src/external/bsd/pkg_install/dist/info/perform.c U src/external/bsd/pkg_install/dist/info/pkg_info.1 U src/external/bsd/pkg_install/dist/info/show.c U src/external/bsd/pkg_install/dist/x509/pkgsrc.cnf U src/external/bsd/pkg_install/dist/x509/pkgsrc.sh U src/external/bsd/pkg_install/dist/x509/signing.txt 5 conflicts created by this import. Use the following command to help the merge: cvs checkout -jPKGSRC:yesterday -jPKGSRC src/external/bsd/pkg_install/dist
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 10:58:14 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): clean up comments in JobFinish To generate a diff of this commit: cvs rdiff -u -r1.376 -r1.377 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.376 src/usr.bin/make/job.c:1.377 --- src/usr.bin/make/job.c:1.376 Sat Dec 12 10:45:24 2020 +++ src/usr.bin/make/job.c Sat Dec 12 10:58:13 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.376 2020/12/12 10:45:24 rillig Exp $ */ +/* $NetBSD: job.c,v 1.377 2020/12/12 10:58:13 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.376 2020/12/12 10:45:24 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.377 2020/12/12 10:58:13 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1065,20 +1065,15 @@ JobFinish(Job *job, int status) if ((WIFEXITED(status) && ((WEXITSTATUS(status) != 0 && !job->ignerr))) || WIFSIGNALED(status)) { - /* - * If it exited non-zero and either we're doing things our - * way or we're not ignoring errors, the job is finished. - * Similarly, if the shell died because of a signal - * the job is also finished. In these - * cases, finish out the job's output before printing the exit - * status... - */ + /* Finished because of an error. */ + JobClosePipes(job); if (job->cmdFILE != NULL && job->cmdFILE != stdout) { (void)fclose(job->cmdFILE); job->cmdFILE = NULL; } done = TRUE; + } else if (WIFEXITED(status)) { /* * Deal with ignored errors in -B mode. We need to print a @@ -1086,11 +1081,11 @@ JobFinish(Job *job, int status) * the next command. */ done = WEXITSTATUS(status) != 0; + JobClosePipes(job); + } else { - /* - * No need to close things down or anything. - */ + /* No need to close things down or anything. */ done = FALSE; }
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 10:45:25 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): inline ShellWriter_PrintCmd The parameter name escCmd was wrong for the call in JobPrintCommand. To generate a diff of this commit: cvs rdiff -u -r1.375 -r1.376 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.375 src/usr.bin/make/job.c:1.376 --- src/usr.bin/make/job.c:1.375 Sat Dec 12 10:40:42 2020 +++ src/usr.bin/make/job.c Sat Dec 12 10:45:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.375 2020/12/12 10:40:42 rillig Exp $ */ +/* $NetBSD: job.c,v 1.376 2020/12/12 10:45:24 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.375 2020/12/12 10:40:42 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.376 2020/12/12 10:45:24 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -764,12 +764,6 @@ ShellWriter_PrintFmt(ShellWriter *wr, co } static void -ShellWriter_PrintCmd(ShellWriter *wr, const char *tmpl, const char *escCmd) -{ - ShellWriter_PrintFmt(wr, tmpl, escCmd); -} - -static void ShellWriter_Println(ShellWriter *wr, const char *line) { ShellWriter_PrintFmt(wr, "%s\n", line); @@ -785,7 +779,7 @@ ShellWriter_EchoOff(ShellWriter *wr) static void ShellWriter_EchoCmd(ShellWriter *wr, const char *escCmd) { - ShellWriter_PrintCmd(wr, shell->echoTmpl, escCmd); + ShellWriter_PrintFmt(wr, shell->echoTmpl, escCmd); } static void @@ -965,7 +959,7 @@ JobPrintCommand(Job *job, ShellWriter *w if (DEBUG(SHELL) && strcmp(shellName, "sh") == 0) ShellWriter_TraceOn(wr); - ShellWriter_PrintCmd(wr, cmdTemplate, xcmd); + ShellWriter_PrintFmt(wr, cmdTemplate, xcmd); free(xcmdStart); free(escCmd); if (cmdFlags.ignerr) {
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 10:40:42 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): rename Shell.exitFlag to errFlag Now its name matches the user-visible .SHELL parameter again, reducing a tiny bit of that mapping chaos. To generate a diff of this commit: cvs rdiff -u -r1.374 -r1.375 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.374 src/usr.bin/make/job.c:1.375 --- src/usr.bin/make/job.c:1.374 Sat Dec 12 10:21:50 2020 +++ src/usr.bin/make/job.c Sat Dec 12 10:40:42 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.374 2020/12/12 10:21:50 rillig Exp $ */ +/* $NetBSD: job.c,v 1.375 2020/12/12 10:40:42 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.374 2020/12/12 10:21:50 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.375 2020/12/12 10:40:42 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -189,15 +189,15 @@ typedef struct Shell { */ const char *name; - Boolean hasEchoCtl; /* True if both echoOff and echoOn defined */ + Boolean hasEchoCtl; /* whether both echoOff and echoOn are there */ const char *echoOff; /* command to turn echoing off */ const char *echoOn; /* command to turn echoing back on */ - const char *noPrint; /* text to skip when printing output from + const char *noPrint; /* text to skip when printing output from the * shell. This is usually the same as echoOff */ size_t noPrintLen; /* length of noPrint command */ - Boolean hasErrCtl; /* set if can control error checking for - * individual commands */ + Boolean hasErrCtl; /* whether error checking can be controlled + * for individual commands */ const char *errOn; /* command to turn on error checking */ const char *errOff; /* command to turn off error checking */ @@ -213,7 +213,7 @@ typedef struct Shell { char commentChar; /* character used by shell for comment lines */ const char *echoFlag; /* shell flag to echo commands */ - const char *exitFlag; /* shell flag to exit on error */ + const char *errFlag; /* shell flag to exit on error */ } Shell; typedef struct CommandFlags { @@ -322,8 +322,8 @@ static Shell shells[] = { "{ %s \n} || exit $?\n", /* .runChkTmpl */ "'\n'", /* .newline */ '#', /* .commentChar */ - "", /* .echo */ - "", /* .exit */ + "", /* .echoFlag */ + "", /* .errFlag */ }, #endif /* DEFSHELL_CUSTOM */ /* @@ -346,11 +346,12 @@ static Shell shells[] = { "'\n'", /* .newline */ '#', /* .commentChar*/ #if defined(MAKE_NATIVE) && defined(__NetBSD__) - "q", /* .echo */ + /* XXX: -q is not really echoFlag, it's more like noEchoInSysFlag. */ + "q", /* .echoFlag */ #else - "", /* .echo */ + "", /* .echoFlag */ #endif - "", /* .exit */ + "", /* .errFlag */ }, /* * KSH description. @@ -370,8 +371,8 @@ static Shell shells[] = { "{ %s \n} || exit $?\n", /* .runChkTmpl */ "'\n'", /* .newline */ '#', /* .commentChar */ - "v", /* .echo */ - "", /* .exit */ + "v", /* .echoFlag */ + "", /* .errFlag */ }, /* * CSH description. The csh can do echo control by playing @@ -393,8 +394,8 @@ static Shell shells[] = { "", /* .runChkTmpl */ "'\\\n'", /* .newline */ '#', /* .commentChar */ - "v", /* .echo */ - "e", /* .exit */ + "v", /* .echoFlag */ + "e", /* .errFlag */ } }; @@ -1505,7 +1506,7 @@ JobMakeArgv(Job *job, char **argv) argv[0] = UNCONST(shellName); argc = 1; - if ((shell->exitFlag != NULL && shell->exitFlag[0] != '-') || + if ((shell->errFlag != NULL && shell->errFlag[0] != '-') || (shell->echoFlag != NULL && shell->echoFlag[0] != '-')) { /* * At least one of the flags doesn't have a minus before it, @@ -1519,7 +1520,7 @@ JobMakeArgv(Job *job, char **argv) */ (void)snprintf(args, sizeof args, "-%s%s", (job->ignerr ? "" : - (shell->exitFlag != NULL ? shell->exitFlag : "")), + (shell->errFlag != NULL ? shell->errFlag : "")), (!job->echo ? "" : (shell->echoFlag != NULL ? shell->echoFlag : ""))); @@ -1528,8 +1529,8 @@ JobMakeArgv(Job *job, char **argv) argc++; } } else { - if (!job->ignerr && shell->exitFlag) { - argv[argc] = UNCONST(shell->exitFlag); + if (!job->ignerr && shell->errFlag) { + argv[argc] = UNCONST(shell->errFlag); argc++; } if (job->echo && shell->echoFlag) { @@ -2121,23 +2122,23 @@ Shell_Init(void) InitShellNameAndPath(); Var_SetWithFlags(".SHELL", shellPath, VAR_CMDLINE, VAR_SET_READONLY); - if (shell->exitFlag == NULL) - shell->exitFlag = ""; + if (shell->errFlag == NULL) + shell->errFlag = ""; if (shell->echoFlag == N
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 10:21:50 UTC 2020 Modified Files: src/usr.bin/make: job.c job.h trace.c src/usr.bin/make/unit-tests: opt-debug-jobs.exp Log Message: make(1): move Job.xtraced to ShellWriter This flag was placed wrong in the Job since it is only necessary as long as the shell commands are written to the shell file. Resetting it in JobStart and JobExec was completely misguided since that is far away from writing the shell commands; this should have been done in JobPrintCommands instead. The status of this flag doesn't need to be printed in debugging mode since it is controlled by a single command line option (-dx) and does not interact with all the other switches. To generate a diff of this commit: cvs rdiff -u -r1.373 -r1.374 src/usr.bin/make/job.c cvs rdiff -u -r1.68 -r1.69 src/usr.bin/make/job.h cvs rdiff -u -r1.23 -r1.24 src/usr.bin/make/trace.c cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/opt-debug-jobs.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.373 src/usr.bin/make/job.c:1.374 --- src/usr.bin/make/job.c:1.373 Sat Dec 12 10:05:15 2020 +++ src/usr.bin/make/job.c Sat Dec 12 10:21:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.373 2020/12/12 10:05:15 rillig Exp $ */ +/* $NetBSD: job.c,v 1.374 2020/12/12 10:21:50 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.373 2020/12/12 10:05:15 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.374 2020/12/12 10:21:50 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -238,6 +238,10 @@ typedef struct CommandFlags { */ typedef struct ShellWriter { FILE *f; + + /* we've sent 'set -x' */ + Boolean xtraced; + } ShellWriter; /* @@ -465,18 +469,17 @@ nfds_per_job(void) void Job_FlagsToString(const Job *job, char *buf, size_t bufsize) { - snprintf(buf, bufsize, "%c%c%c%c", + snprintf(buf, bufsize, "%c%c%c", job->ignerr ? 'i' : '-', !job->echo ? 's' : '-', - job->special ? 'S' : '-', - job->xtraced ? 'x' : '-'); + job->special ? 'S' : '-'); } static void job_table_dump(const char *where) { Job *job; - char flags[5]; + char flags[4]; debug_printf("job table @ %s\n", where); for (job = job_table; job < job_table_end; job++) { @@ -791,6 +794,15 @@ ShellWriter_EchoOn(ShellWriter *wr) ShellWriter_Println(wr, shell->echoOn); } +static void +ShellWriter_TraceOn(ShellWriter *wr) +{ + if (!wr->xtraced) { + ShellWriter_Println(wr, "set -x"); + wr->xtraced = TRUE; + } +} + /* * We don't want the error-control commands showing up either, so we turn * off echoing while executing them. We could put another field in the shell @@ -949,10 +961,8 @@ JobPrintCommand(Job *job, ShellWriter *w } } - if (DEBUG(SHELL) && strcmp(shellName, "sh") == 0 && !job->xtraced) { - ShellWriter_Println(wr, "set -x"); - job->xtraced = TRUE; - } + if (DEBUG(SHELL) && strcmp(shellName, "sh") == 0) + ShellWriter_TraceOn(wr); ShellWriter_PrintCmd(wr, cmdTemplate, xcmd); free(xcmdStart); @@ -986,7 +996,7 @@ JobPrintCommands(Job *job) { StringListNode *ln; Boolean seen = FALSE; - ShellWriter wr = { job->cmdFILE }; + ShellWriter wr = { job->cmdFILE, FALSE }; for (ln = job->node->commands.first; ln != NULL; ln = ln->next) { const char *cmd = ln->datum; @@ -1337,8 +1347,6 @@ JobExec(Job *job, char **argv) int cpid; /* ID of new child */ sigset_t mask; - job->xtraced = FALSE; - if (DEBUG(JOB)) { int i; @@ -1628,7 +1636,6 @@ JobStart(GNode *gn, Boolean special) job->special = special || gn->type & OP_SPECIAL; job->ignerr = opts.ignoreErrors || gn->type & OP_IGNORE; job->echo = !(opts.beSilent || gn->type & OP_SILENT); - job->xtraced = FALSE; /* * Check the commands now so any attributes from .DEFAULT have a Index: src/usr.bin/make/job.h diff -u src/usr.bin/make/job.h:1.68 src/usr.bin/make/job.h:1.69 --- src/usr.bin/make/job.h:1.68 Sat Dec 12 01:42:33 2020 +++ src/usr.bin/make/job.h Sat Dec 12 10:21:50 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.h,v 1.68 2020/12/12 01:42:33 rillig Exp $ */ +/* $NetBSD: job.h,v 1.69 2020/12/12 10:21:50 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -163,8 +163,6 @@ typedef struct Job { Boolean echo; /* Target is a special one. */ Boolean special; -/* we've sent 'set -x' */ -Boolean xtraced; int inPipe; /* Pipe for reading output from job */ int outPipe; /* Pipe for writing control commands */ Index: src/usr.bin/make/trace.c diff -u src/usr.bin/make/trace.c:1.23 src/usr.bin/make/trace.c:1.24 --- src/usr.bin/make/trace.c:1.23 Thu Dec 10 2
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Dec 12 10:05:15 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): in jobs mode, extract echo control into separate functions This removes the clutter from the code that calls these functions. That code is still complicated enough since it modifies variables it shouldn't. To generate a diff of this commit: cvs rdiff -u -r1.372 -r1.373 src/usr.bin/make/job.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.372 src/usr.bin/make/job.c:1.373 --- src/usr.bin/make/job.c:1.372 Sat Dec 12 02:03:36 2020 +++ src/usr.bin/make/job.c Sat Dec 12 10:05:15 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.372 2020/12/12 02:03:36 rillig Exp $ */ +/* $NetBSD: job.c,v 1.373 2020/12/12 10:05:15 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990 The Regents of the University of California. @@ -143,7 +143,7 @@ #include "trace.h" /* "@(#)job.c 8.2 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: job.c,v 1.372 2020/12/12 02:03:36 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.373 2020/12/12 10:05:15 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -771,6 +771,26 @@ ShellWriter_Println(ShellWriter *wr, con ShellWriter_PrintFmt(wr, "%s\n", line); } +static void +ShellWriter_EchoOff(ShellWriter *wr) +{ + if (shell->hasEchoCtl) + ShellWriter_Println(wr, shell->echoOff); +} + +static void +ShellWriter_EchoCmd(ShellWriter *wr, const char *escCmd) +{ + ShellWriter_PrintCmd(wr, shell->echoTmpl, escCmd); +} + +static void +ShellWriter_EchoOn(ShellWriter *wr) +{ + if (shell->hasEchoCtl) + ShellWriter_Println(wr, shell->echoOn); +} + /* * We don't want the error-control commands showing up either, so we turn * off echoing while executing them. We could put another field in the shell @@ -778,12 +798,12 @@ ShellWriter_Println(ShellWriter *wr, con * it any more complex than it already is? */ static void -ShellWriter_PrintIgnoreErrors(ShellWriter *wr, Boolean echo) +ShellWriter_ErrOff(ShellWriter *wr, Boolean echo) { if (echo && shell->hasEchoCtl) { - ShellWriter_Println(wr, shell->echoOff); + ShellWriter_EchoOff(wr); ShellWriter_Println(wr, shell->errOff); - ShellWriter_Println(wr, shell->echoOn); + ShellWriter_EchoOn(wr); } else { ShellWriter_Println(wr, shell->errOff); } @@ -804,13 +824,12 @@ JobPrintSpecialsEchoCtl(Job *job, ShellW job->ignerr = TRUE; if (job->echo && inout_cmdFlags->echo) { - if (shell->hasEchoCtl) - ShellWriter_Println(wr, shell->echoOff); - ShellWriter_PrintCmd(wr, shell->echoTmpl, escCmd); + ShellWriter_EchoOff(wr); + ShellWriter_EchoCmd(wr, escCmd); inout_cmdFlags->echo = FALSE; } else { if (inout_cmdFlags->echo) - ShellWriter_PrintCmd(wr, shell->echoTmpl, escCmd); + ShellWriter_EchoCmd(wr, escCmd); } *inout_cmdTemplate = shell->runIgnTmpl; @@ -829,8 +848,7 @@ JobPrintSpecials(Job *job, ShellWriter * if (!run) inout_cmdFlags->ignerr = FALSE; else if (shell->hasErrCtl) - ShellWriter_PrintIgnoreErrors(wr, - job->echo && inout_cmdFlags->echo); + ShellWriter_ErrOff(wr, job->echo && inout_cmdFlags->echo); else if (shell->runIgnTmpl != NULL && shell->runIgnTmpl[0] != '\0') { JobPrintSpecialsEchoCtl(job, wr, inout_cmdFlags, escCmd, inout_cmdTemplate); @@ -895,7 +913,7 @@ JobPrintCommand(Job *job, ShellWriter *w if (!cmdFlags.echo) { if (job->echo && run && shell->hasEchoCtl) { - ShellWriter_Println(wr, shell->echoOff); + ShellWriter_EchoOff(wr); } else { if (shell->hasErrCtl) cmdFlags.echo = TRUE; @@ -915,10 +933,8 @@ JobPrintCommand(Job *job, ShellWriter *w if (!shell->hasErrCtl && shell->runChkTmpl && shell->runChkTmpl[0] != '\0') { if (job->echo && cmdFlags.echo) { -if (shell->hasEchoCtl) - ShellWriter_Println(wr, shell->echoOff); -ShellWriter_PrintCmd(wr, -shell->echoTmpl, escCmd); +ShellWriter_EchoOff(wr); +ShellWriter_EchoCmd(wr, escCmd); cmdFlags.echo = FALSE; } /* @@ -948,13 +964,13 @@ JobPrintCommand(Job *job, ShellWriter *w * for the whole command... */ if (cmdFlags.echo && job->echo && shell->hasEchoCtl) { - ShellWriter_Println(wr, shell->echoOff); + ShellWriter_EchoOff(wr); cmdFlags.echo = FALSE; } ShellWriter_Println(wr, shell->errOn); } - if (!cmdFlags.echo && shell->hasEchoCtl) - ShellWriter_Println(wr, shell->echoOn); + if (!cmdFlags.echo) + ShellWriter_EchoOn(wr); } /*
CVS commit: src/sys
Module Name:src Committed By: skrll Date: Sat Dec 12 09:27:32 UTC 2020 Modified Files: src/sys/arch/aarch64/aarch64: aarch64_machdep.c src/sys/arch/arm/arm32: arm32_kvminit.c src/sys/arch/evbarm/conf: files.fdt src/sys/arch/evbarm/fdt: fdt_machdep.c platform.h src/sys/dev/fdt: files.fdt Added Files: src/sys/dev/fdt: fdt_memory.c fdt_memory.h Removed Files: src/sys/arch/evbarm/fdt: fdt_memory.c fdt_memory.h Log Message: Move evbarm/fdt/fdt_memory.[ch] to sys/dev/fdt and simplify the api and some operations. This allows other architectures to use it. To generate a diff of this commit: cvs rdiff -u -r1.55 -r1.56 src/sys/arch/aarch64/aarch64/aarch64_machdep.c cvs rdiff -u -r1.66 -r1.67 src/sys/arch/arm/arm32/arm32_kvminit.c cvs rdiff -u -r1.6 -r1.7 src/sys/arch/evbarm/conf/files.fdt cvs rdiff -u -r1.82 -r1.83 src/sys/arch/evbarm/fdt/fdt_machdep.c cvs rdiff -u -r1.4 -r0 src/sys/arch/evbarm/fdt/fdt_memory.c cvs rdiff -u -r1.1 -r0 src/sys/arch/evbarm/fdt/fdt_memory.h cvs rdiff -u -r1.9 -r1.10 src/sys/arch/evbarm/fdt/platform.h cvs rdiff -u -r0 -r1.1 src/sys/dev/fdt/fdt_memory.c \ src/sys/dev/fdt/fdt_memory.h cvs rdiff -u -r1.56 -r1.57 src/sys/dev/fdt/files.fdt Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/sys/arch/aarch64/aarch64/aarch64_machdep.c diff -u src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.55 src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.56 --- src/sys/arch/aarch64/aarch64/aarch64_machdep.c:1.55 Wed Dec 9 08:51:05 2020 +++ src/sys/arch/aarch64/aarch64/aarch64_machdep.c Sat Dec 12 09:27:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: aarch64_machdep.c,v 1.55 2020/12/09 08:51:05 skrll Exp $ */ +/* $NetBSD: aarch64_machdep.c,v 1.56 2020/12/12 09:27:31 skrll Exp $ */ /*- * Copyright (c) 2014 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.55 2020/12/09 08:51:05 skrll Exp $"); +__KERNEL_RCSID(1, "$NetBSD: aarch64_machdep.c,v 1.56 2020/12/12 09:27:31 skrll Exp $"); #include "opt_arm_debug.h" #include "opt_cpuoptions.h" @@ -72,8 +72,8 @@ __KERNEL_RCSID(1, "$NetBSD: aarch64_mach #include #include -#include #include +#include #ifdef VERBOSE_INIT_ARM #define VPRINTF(...) printf(__VA_ARGS__) @@ -193,7 +193,7 @@ cpu_kernel_vm_init(uint64_t memory_start VPRINTF("%s: kernel phys start %lx end %lx+%lx\n", __func__, kernstart_phys, kernend_phys, kernend_extra); - fdt_add_reserved_memory_range(kernstart_phys, + fdt_memory_remove_range(kernstart_phys, kernend_phys - kernstart_phys + kernend_extra); } Index: src/sys/arch/arm/arm32/arm32_kvminit.c diff -u src/sys/arch/arm/arm32/arm32_kvminit.c:1.66 src/sys/arch/arm/arm32/arm32_kvminit.c:1.67 --- src/sys/arch/arm/arm32/arm32_kvminit.c:1.66 Fri Oct 30 18:54:36 2020 +++ src/sys/arch/arm/arm32/arm32_kvminit.c Sat Dec 12 09:27:31 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: arm32_kvminit.c,v 1.66 2020/10/30 18:54:36 skrll Exp $ */ +/* $NetBSD: arm32_kvminit.c,v 1.67 2020/12/12 09:27:31 skrll Exp $ */ /* * Copyright (c) 2002, 2003, 2005 Genetec Corporation. All rights reserved. @@ -127,7 +127,7 @@ #include "opt_multiprocessor.h" #include -__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.66 2020/10/30 18:54:36 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: arm32_kvminit.c,v 1.67 2020/12/12 09:27:31 skrll Exp $"); #include @@ -150,6 +150,7 @@ __KERNEL_RCSID(0, "$NetBSD: arm32_kvmini #if defined(FDT) #include #include +#include #endif #ifdef MULTIPROCESSOR @@ -251,7 +252,7 @@ arm32_bootmem_init(paddr_t memstart, psi bmi->bmi_kernelend = kernelend; #if defined(FDT) - fdt_add_reserved_memory_range(bmi->bmi_kernelstart, + fdt_memory_remove_range(bmi->bmi_kernelstart, bmi->bmi_kernelend - bmi->bmi_kernelstart); #endif @@ -400,7 +401,7 @@ valloc_pages(struct bootmem_info *bmi, p KASSERT((armreg_ttbr_read() & ~(L1_TABLE_SIZE - 1)) != free_pv->pv_pa); #if defined(FDT) - fdt_add_reserved_memory_range(free_pv->pv_pa, nbytes); + fdt_memory_remove_range(free_pv->pv_pa, nbytes); #endif pv->pv_pa = free_pv->pv_pa; pv->pv_va = free_pv->pv_va; Index: src/sys/arch/evbarm/conf/files.fdt diff -u src/sys/arch/evbarm/conf/files.fdt:1.6 src/sys/arch/evbarm/conf/files.fdt:1.7 --- src/sys/arch/evbarm/conf/files.fdt:1.6 Thu Feb 20 01:35:55 2020 +++ src/sys/arch/evbarm/conf/files.fdt Sat Dec 12 09:27:31 2020 @@ -1,10 +1,9 @@ -# $NetBSD: files.fdt,v 1.6 2020/02/20 01:35:55 jmcneill Exp $ +# $NetBSD: files.fdt,v 1.7 2020/12/12 09:27:31 skrll Exp $ # # FDT-based kernel configuration info # file arch/evbarm/fdt/fdt_dma_machdep.c fdt file arch/evbarm/fdt/fdt_machdep.c fdt -file arch/evbarm/fdt/fdt_memory.c fdt include "arch/arm/fdt/files.fdt" Index: src/sys/arch/evbarm/fdt/fdt_machdep.c diff -u src/sys/arch/evbarm/fdt/fdt_machdep.c:1.82 src/sys/arch/evbarm/fdt/fdt_machdep.c:1.83 ---