CVS commit: src/sys/arch/x86/pci
Module Name:src Committed By: knakahara Date: Fri Dec 11 07:49:40 UTC 2020 Modified Files: src/sys/arch/x86/pci: msipic.c Log Message: Not pic->pic_addroute but pic->pic_hwunmask should enable interrupts for MSI-X. pic->pic_addroute should not enable interrupt, because callers expect interrupts have been disabled until they call pic->pic_hwunmask. By the way, the old implement writes zero to Vector Control for MSI-X Table Entries, howerver it must be read and updated. Because, there are not only Mask Bit but also ST lower and ST upper. To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/sys/arch/x86/pci/msipic.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/arch/x86/pci/msipic.c diff -u src/sys/arch/x86/pci/msipic.c:1.23 src/sys/arch/x86/pci/msipic.c:1.24 --- src/sys/arch/x86/pci/msipic.c:1.23 Mon May 4 15:55:56 2020 +++ src/sys/arch/x86/pci/msipic.c Fri Dec 11 07:49:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: msipic.c,v 1.23 2020/05/04 15:55:56 jdolecek Exp $ */ +/* $NetBSD: msipic.c,v 1.24 2020/12/11 07:49:39 knakahara Exp $ */ /* * Copyright (c) 2015 Internet Initiative Japan Inc. @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.23 2020/05/04 15:55:56 jdolecek Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msipic.c,v 1.24 2020/12/11 07:49:39 knakahara Exp $"); #include "opt_intrdebug.h" @@ -598,8 +598,6 @@ msix_addroute(struct pic *pic, struct cp bus_space_write_4(bstag, bshandle, entry_base + PCI_MSIX_TABLE_ENTRY_DATA, data); #endif /* !XENPV */ - bus_space_write_4(bstag, bshandle, - entry_base + PCI_MSIX_TABLE_ENTRY_VECTCTL, 0); BUS_SPACE_WRITE_FLUSH(bstag, bshandle); ctl = pci_conf_read(pc, tag, off + PCI_MSIX_CTL);
CVS commit: src/usr.bin/systat
Module Name:src Committed By: simonb Date: Fri Dec 11 07:24:38 UTC 2020 Modified Files: src/usr.bin/systat: Makefile Log Message: Add ${LIBUTIL} to DPADD. To generate a diff of this commit: cvs rdiff -u -r1.43 -r1.44 src/usr.bin/systat/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/systat/Makefile diff -u src/usr.bin/systat/Makefile:1.43 src/usr.bin/systat/Makefile:1.44 --- src/usr.bin/systat/Makefile:1.43 Sun Oct 13 07:28:17 2019 +++ src/usr.bin/systat/Makefile Fri Dec 11 07:24:38 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.43 2019/10/13 07:28:17 mrg Exp $ +# $NetBSD: Makefile,v 1.44 2020/12/11 07:24:38 simonb Exp $ # @(#)Makefile 8.1 (Berkeley) 6/6/93 .include @@ -15,7 +15,7 @@ SRCS= bufcache.c cmds.c cmdtab.c convtbl fetch.c globalcmds.c icmp.c ifcmds.c ifstat.c iostat.c ip.c \ keyboard.c main.c mbufs.c netcmds.c netstat.c pigs.c ps.c swap.c \ tcp.c vmstat.c utmpentry.c syscall.c -DPADD= ${LIBCURSES} ${LIBTERMINFO} ${LIBM} ${LIBKVM} +DPADD= ${LIBUTIL} ${LIBCURSES} ${LIBTERMINFO} ${LIBM} ${LIBKVM} LDADD= -lutil -lcurses -lterminfo -lm -lkvm BINGRP= kmem BINMODE=2555
CVS commit: src/sys/dev/acpi
Module Name:src Committed By: martin Date: Fri Dec 11 07:01:27 UTC 2020 Modified Files: src/sys/dev/acpi: atppc_acpi.c Log Message: Fix editor mishap in r1.18 To generate a diff of this commit: cvs rdiff -u -r1.19 -r1.20 src/sys/dev/acpi/atppc_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/sys/dev/acpi/atppc_acpi.c diff -u src/sys/dev/acpi/atppc_acpi.c:1.19 src/sys/dev/acpi/atppc_acpi.c:1.20 --- src/sys/dev/acpi/atppc_acpi.c:1.19 Mon Dec 7 10:02:51 2020 +++ src/sys/dev/acpi/atppc_acpi.c Fri Dec 11 07:01:27 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: atppc_acpi.c,v 1.19 2020/12/07 10:02:51 jmcneill Exp $ */ +/* $NetBSD: atppc_acpi.c,v 1.20 2020/12/11 07:01:27 martin Exp $ */ /*- * Copyright (c) 2004 The NetBSD Foundation, Inc. @@ -30,7 +30,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: atppc_acpi.c,v 1.19 2020/12/07 10:02:51 jmcneill Exp $"); +__KERNEL_RCSID(0, "$NetBSD: atppc_acpi.c,v 1.20 2020/12/11 07:01:27 martin Exp $"); #include "opt_atppc.h" @@ -142,7 +142,7 @@ atppc_acpi_attach(device_t parent, devic sc->sc_ieh = acpi_intr_establish(self, (uint64_t)(uintptr_t)aa->aa_node->ad_handle, - IPL_TTY, false, atppcintr, self device_xname(self)); + IPL_TTY, false, atppcintr, self, device_xname(self)); if (sc->sc_ieh == NULL) { aprint_error_dev(self, "unable to establish interrupt\n"); goto out;
CVS commit: src/sys/dev/pci/ixgbe
Module Name:src Committed By: msaitoh Date: Fri Dec 11 05:01:19 UTC 2020 Modified Files: src/sys/dev/pci/ixgbe: ixgbe.c ixgbe_type.h Log Message: Don't use EIMC_OTHER bit because it's read only other than 82598. Documents say: 82598: All of bit 31(OTHER bit) of EIxx are reserved. In reality, at least EIMS_OTHER and EIMC_OTHER exist and the OTHER interrupt doesn't work without EIMS_OTHER. Other than 82598: EIMS_OTHER is read only and EIMC_OTHER doesn't exist. If one of bit 29..16 is set, EIMS_OTHER is set to 1 (Note that bit 30(TCP timer isn't included)). Even if write bit 31 of EIMC to 1, it's ignored (EIMS_OTHER doesn't set). We introduced new spin mutex in ixgbe.c rev. 1.260, so it's OK to remove EIMC_OTHER stuff. We already set EIMS_OTHER in if_init(), so keep it for 82598. No functional change other than 82598. Another solution is to control bit 30..16 directly to mask/unmask interrupt instead of the mutex. TODO: Some MSI-X interrupt(LSC, module insertion/removal etc.)'s mask/unmask code between ixgbe_msix_admin() and ixgbe_handle_admin() may be wrong. It'll be fixed later. To generate a diff of this commit: cvs rdiff -u -r1.261 -r1.262 src/sys/dev/pci/ixgbe/ixgbe.c cvs rdiff -u -r1.45 -r1.46 src/sys/dev/pci/ixgbe/ixgbe_type.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/pci/ixgbe/ixgbe.c diff -u src/sys/dev/pci/ixgbe/ixgbe.c:1.261 src/sys/dev/pci/ixgbe/ixgbe.c:1.262 --- src/sys/dev/pci/ixgbe/ixgbe.c:1.261 Mon Nov 30 07:53:42 2020 +++ src/sys/dev/pci/ixgbe/ixgbe.c Fri Dec 11 05:01:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe.c,v 1.261 2020/11/30 07:53:42 msaitoh Exp $ */ +/* $NetBSD: ixgbe.c,v 1.262 2020/12/11 05:01:19 msaitoh Exp $ */ /** @@ -3095,9 +3095,6 @@ ixgbe_msix_admin(void *arg) ++adapter->admin_irqev.ev_count; - /* Pause other interrupts */ - IXGBE_WRITE_REG(hw, IXGBE_EIMC, IXGBE_EIMC_OTHER); - /* First get the cause */ /* * The specifications of 82598, 82599, X540 and X550 say EICS register @@ -3219,9 +3216,6 @@ ixgbe_msix_admin(void *arg) adapter->task_requests |= task_requests; ixgbe_schedule_admin_tasklet(adapter); mutex_exit(&adapter->admin_mtx); - } else { - /* Re-enable other interrupts */ - IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_OTHER); } return 1; @@ -4809,7 +4803,6 @@ ixgbe_handle_admin(struct work *wk, void { struct adapter *adapter = context; struct ifnet *ifp = adapter->ifp; - struct ixgbe_hw *hw = &adapter->hw; u32 task_requests; mutex_enter(&adapter->admin_mtx); @@ -4848,11 +4841,12 @@ ixgbe_handle_admin(struct work *wk, void } #endif if ((task_requests & IXGBE_REQUEST_TASK_NEED_ACKINTR) != 0) { - if ((adapter->feat_en & IXGBE_FEATURE_MSIX) != 0) { - /* Re-enable other interrupts */ - IXGBE_WRITE_REG(hw, IXGBE_EIMS, IXGBE_EIMS_OTHER); - } else - ixgbe_enable_intr(adapter); + /* + * XXX FIXME. + * ixgbe_enable_intr() enables all interrupts. It might enable + * an interrupt which should not be enabled. + */ + ixgbe_enable_intr(adapter); } IXGBE_CORE_UNLOCK(adapter); Index: src/sys/dev/pci/ixgbe/ixgbe_type.h diff -u src/sys/dev/pci/ixgbe/ixgbe_type.h:1.45 src/sys/dev/pci/ixgbe/ixgbe_type.h:1.46 --- src/sys/dev/pci/ixgbe/ixgbe_type.h:1.45 Mon Aug 31 11:19:54 2020 +++ src/sys/dev/pci/ixgbe/ixgbe_type.h Fri Dec 11 05:01:19 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ixgbe_type.h,v 1.45 2020/08/31 11:19:54 msaitoh Exp $ */ +/* $NetBSD: ixgbe_type.h,v 1.46 2020/12/11 05:01:19 msaitoh Exp $ */ /** SPDX-License-Identifier: BSD-3-Clause @@ -1998,6 +1998,13 @@ enum { #define IXGBE_EIMS_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ #define IXGBE_EIMS_DHER IXGBE_EICR_DHER /* Descr Handler Error */ #define IXGBE_EIMS_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ +/* + * EIMS_OTHER is R/W on 82598 though the document says it's reserved. + * It MUST be required to set this bit to get OTHER interrupt. + * + * On other chips, it's read only. It's set if any bits of 29..16 is not zero. + * Bit 30 (TCP_TIMER) doesn't affect to EIMS_OTHER. + */ #define IXGBE_EIMS_OTHER IXGBE_EICR_OTHER /* INT Cause Active */ /* Extended Interrupt Mask Clear */ @@ -2019,6 +2026,7 @@ enum { #define IXGBE_EIMC_PBUR IXGBE_EICR_PBUR /* Pkt Buf Handler Err */ #define IXGBE_EIMC_DHER IXGBE_EICR_DHER /* Desc Handler Err */ #define IXGBE_EIMC_TCP_TIMER IXGBE_EICR_TCP_TIMER /* TCP Timer */ +/* EIMC_OTHER works only on 82598. See EIMS_OTHER's comment */ #define IXGBE_EIMC_OTHER IXGBE_EICR_OTHER /* INT Cause Active */ #define IXGBE_EIMS_ENABLE_MASK ( \
CVS commit: src/sys/kern
Module Name:src Committed By: thorpej Date: Fri Dec 11 03:00:10 UTC 2020 Modified Files: src/sys/kern: kern_entropy.c kern_event.c subr_log.c sys_pipe.c tty.c tty_pty.c uipc_socket.c Log Message: Use sel{record,remove}_knote(). To generate a diff of this commit: cvs rdiff -u -r1.24 -r1.25 src/sys/kern/kern_entropy.c cvs rdiff -u -r1.108 -r1.109 src/sys/kern/kern_event.c cvs rdiff -u -r1.59 -r1.60 src/sys/kern/subr_log.c cvs rdiff -u -r1.150 -r1.151 src/sys/kern/sys_pipe.c cvs rdiff -u -r1.294 -r1.295 src/sys/kern/tty.c cvs rdiff -u -r1.145 -r1.146 src/sys/kern/tty_pty.c cvs rdiff -u -r1.293 -r1.294 src/sys/kern/uipc_socket.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/kern_entropy.c diff -u src/sys/kern/kern_entropy.c:1.24 src/sys/kern/kern_entropy.c:1.25 --- src/sys/kern/kern_entropy.c:1.24 Tue Sep 29 07:51:01 2020 +++ src/sys/kern/kern_entropy.c Fri Dec 11 03:00:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_entropy.c,v 1.24 2020/09/29 07:51:01 gson Exp $ */ +/* $NetBSD: kern_entropy.c,v 1.25 2020/12/11 03:00:09 thorpej Exp $ */ /*- * Copyright (c) 2019 The NetBSD Foundation, Inc. @@ -75,7 +75,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.24 2020/09/29 07:51:01 gson Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_entropy.c,v 1.25 2020/12/11 03:00:09 thorpej Exp $"); #include #include @@ -1409,7 +1409,7 @@ filt_entropy_read_detach(struct knote *k KASSERT(E->stage >= ENTROPY_WARM); mutex_enter(&E->lock); - SLIST_REMOVE(&E->selq.sel_klist, kn, knote, kn_selnext); + selremove_knote(&E->selq, kn); mutex_exit(&E->lock); } @@ -1480,7 +1480,7 @@ entropy_kqfilter(struct knote *kn) /* Enter into the global select queue. */ mutex_enter(&E->lock); kn->kn_fop = &entropy_read_filtops; - SLIST_INSERT_HEAD(&E->selq.sel_klist, kn, kn_selnext); + selrecord_knote(&E->selq, kn); mutex_exit(&E->lock); return 0; case EVFILT_WRITE: Index: src/sys/kern/kern_event.c diff -u src/sys/kern/kern_event.c:1.108 src/sys/kern/kern_event.c:1.109 --- src/sys/kern/kern_event.c:1.108 Sat Oct 31 01:08:32 2020 +++ src/sys/kern/kern_event.c Fri Dec 11 03:00:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: kern_event.c,v 1.108 2020/10/31 01:08:32 christos Exp $ */ +/* $NetBSD: kern_event.c,v 1.109 2020/12/11 03:00:09 thorpej Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -59,7 +59,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.108 2020/10/31 01:08:32 christos Exp $"); +__KERNEL_RCSID(0, "$NetBSD: kern_event.c,v 1.109 2020/12/11 03:00:09 thorpej Exp $"); #include #include @@ -481,7 +481,7 @@ filt_kqdetach(struct knote *kn) kq = ((file_t *)kn->kn_obj)->f_kqueue; mutex_spin_enter(&kq->kq_lock); - SLIST_REMOVE(&kq->kq_sel.sel_klist, kn, knote, kn_selnext); + selremove_knote(&kq->kq_sel, kn); mutex_spin_exit(&kq->kq_lock); } @@ -1780,7 +1780,7 @@ kqueue_kqfilter(file_t *fp, struct knote kn->kn_fop = &kqread_filtops; mutex_enter(&kq->kq_lock); - SLIST_INSERT_HEAD(&kq->kq_sel.sel_klist, kn, kn_selnext); + selrecord_knote(&kq->kq_sel, kn); mutex_exit(&kq->kq_lock); return 0; Index: src/sys/kern/subr_log.c diff -u src/sys/kern/subr_log.c:1.59 src/sys/kern/subr_log.c:1.60 --- src/sys/kern/subr_log.c:1.59 Mon Sep 3 16:29:35 2018 +++ src/sys/kern/subr_log.c Fri Dec 11 03:00:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: subr_log.c,v 1.59 2018/09/03 16:29:35 riastradh Exp $ */ +/* $NetBSD: subr_log.c,v 1.60 2020/12/11 03:00:09 thorpej Exp $ */ /*- * Copyright (c) 2007, 2008 The NetBSD Foundation, Inc. @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: subr_log.c,v 1.59 2018/09/03 16:29:35 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: subr_log.c,v 1.60 2020/12/11 03:00:09 thorpej Exp $"); #include #include @@ -262,7 +262,7 @@ filt_logrdetach(struct knote *kn) { mutex_spin_enter(&log_lock); - SLIST_REMOVE(&log_selp.sel_klist, kn, knote, kn_selnext); + selremove_knote(&log_selp, kn); mutex_spin_exit(&log_lock); } @@ -299,11 +299,9 @@ static const struct filterops logread_fi static int logkqfilter(dev_t dev, struct knote *kn) { - struct klist *klist; switch (kn->kn_filter) { case EVFILT_READ: - klist = &log_selp.sel_klist; kn->kn_fop = &logread_filtops; break; @@ -311,9 +309,10 @@ logkqfilter(dev_t dev, struct knote *kn) return (EINVAL); } - mutex_spin_enter(&log_lock); kn->kn_hook = NULL; - SLIST_INSERT_HEAD(klist, kn, kn_selnext); + + mutex_spin_enter(&log_lock); + selrecord_knote(&log_selp, kn); mutex_spin_exit(&log_lock); return (0); Index: src/sys/kern/sys_pipe.c diff -u src/sys/kern/sys_pipe.c:1.150 src/sys/kern/sys_pipe.c:1.151 --- src/sys/kern/sys_pipe.c:1.150 Thu Jun 25 16:19:07 2020 +++ src/sys/kern/sys_pipe.c Fri Dec 11 03:00:09 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_pipe.c,v 1.150 2020/06/25 16:19:07 maxv Exp $ */ +/* $Ne
CVS commit: src/sys
Module Name:src Committed By: thorpej Date: Fri Dec 11 01:25:29 UTC 2020 Modified Files: src/sys/kern: sys_select.c src/sys/sys: select.h Log Message: Add sel{record,remove}_knote(), so hide some of the details surrounding knote / kevent registration in the selinfo structure. To generate a diff of this commit: cvs rdiff -u -r1.54 -r1.55 src/sys/kern/sys_select.c cvs rdiff -u -r1.37 -r1.38 src/sys/sys/select.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/kern/sys_select.c diff -u src/sys/kern/sys_select.c:1.54 src/sys/kern/sys_select.c:1.55 --- src/sys/kern/sys_select.c:1.54 Sun Apr 19 20:35:29 2020 +++ src/sys/kern/sys_select.c Fri Dec 11 01:25:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: sys_select.c,v 1.54 2020/04/19 20:35:29 ad Exp $ */ +/* $NetBSD: sys_select.c,v 1.55 2020/12/11 01:25:29 thorpej Exp $ */ /*- * Copyright (c) 2007, 2008, 2009, 2010, 2019, 2020 The NetBSD Foundation, Inc. @@ -84,7 +84,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.54 2020/04/19 20:35:29 ad Exp $"); +__KERNEL_RCSID(0, "$NetBSD: sys_select.c,v 1.55 2020/12/11 01:25:29 thorpej Exp $"); #include #include @@ -668,6 +668,28 @@ selrecord(lwp_t *selector, struct selinf } /* + * Record a knote. + * + * The caller holds the same lock as for selrecord(). + */ +void +selrecord_knote(struct selinfo *sip, struct knote *kn) +{ + SLIST_INSERT_HEAD(&sip->sel_klist, kn, kn_selnext); +} + +/* + * Remove a knote. + * + * The caller holds the same lock as for selrecord(). + */ +void +selremove_knote(struct selinfo *sip, struct knote *kn) +{ + SLIST_REMOVE(&sip->sel_klist, kn, knote, kn_selnext); +} + +/* * sel_setevents: a helper function for selnotify(), to set the events * for LWP sleeping in selcommon() or pollcommon(). */ Index: src/sys/sys/select.h diff -u src/sys/sys/select.h:1.37 src/sys/sys/select.h:1.38 --- src/sys/sys/select.h:1.37 Fri Apr 25 15:52:45 2014 +++ src/sys/sys/select.h Fri Dec 11 01:25:29 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: select.h,v 1.37 2014/04/25 15:52:45 pooka Exp $ */ +/* $NetBSD: select.h,v 1.38 2020/12/11 01:25:29 thorpej Exp $ */ /*- * Copyright (c) 1992, 1993 @@ -47,10 +47,13 @@ struct proc; struct timespec; struct cpu_info; struct socket; +struct knote; int selcommon(register_t *, int, fd_set *, fd_set *, fd_set *, struct timespec *, sigset_t *); void selrecord(struct lwp *selector, struct selinfo *); +void selrecord_knote(struct selinfo *, struct knote *); +void selremove_knote(struct selinfo *, struct knote *); void selnotify(struct selinfo *, int, long); void selsysinit(struct cpu_info *); void selinit(struct selinfo *);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Dec 11 01:08:51 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): document why runIgnImpl is used in jobs mode To generate a diff of this commit: cvs rdiff -u -r1.366 -r1.367 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.366 src/usr.bin/make/job.c:1.367 --- src/usr.bin/make/job.c:1.366 Fri Dec 11 00:29:01 2020 +++ src/usr.bin/make/job.c Fri Dec 11 01:08:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.366 2020/12/11 00:29:01 rillig Exp $ */ +/* $NetBSD: job.c,v 1.367 2020/12/11 01:08:51 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.366 2020/12/11 00:29:01 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.367 2020/12/11 01:08:51 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -903,14 +903,13 @@ JobPrintCommand(Job *job, const char * c cmdFlags.echo = FALSE; } /* - * If it's a comment line or blank, treat as an - * ignored error. + * If it's a comment line or blank, avoid the possible + * syntax error generated by "{\n} || exit 0". */ - if (escCmd[0] == shell->commentChar || - (escCmd[0] == '\0')) -cmdTemplate = shell->runIgnTmpl; - else -cmdTemplate = shell->runChkTmpl; + cmdTemplate = escCmd[0] == shell->commentChar || + escCmd[0] == '\0' + ? shell->runIgnTmpl + : shell->runChkTmpl; cmdFlags.ignerr = FALSE; } }
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Fri Dec 11 01:06:10 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: sh-jobs.exp sh-jobs.mk Log Message: make(1): add tests for comments and non-comments in jobs mode To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/sh-jobs.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/sh-jobs.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-jobs.exp diff -u src/usr.bin/make/unit-tests/sh-jobs.exp:1.1 src/usr.bin/make/unit-tests/sh-jobs.exp:1.2 --- src/usr.bin/make/unit-tests/sh-jobs.exp:1.1 Sun Aug 16 12:07:51 2020 +++ src/usr.bin/make/unit-tests/sh-jobs.exp Fri Dec 11 01:06:10 2020 @@ -1 +1,6 @@ -exit status 0 +comment-with-followup-line: This is printed. +no-comment: This is printed. +*** [no-comment] Error code 1 + +make: stopped in unit-tests +exit status 1 Index: src/usr.bin/make/unit-tests/sh-jobs.mk diff -u src/usr.bin/make/unit-tests/sh-jobs.mk:1.2 src/usr.bin/make/unit-tests/sh-jobs.mk:1.3 --- src/usr.bin/make/unit-tests/sh-jobs.mk:1.2 Sun Aug 16 14:25:16 2020 +++ src/usr.bin/make/unit-tests/sh-jobs.mk Fri Dec 11 01:06:10 2020 @@ -1,9 +1,35 @@ -# $NetBSD: sh-jobs.mk,v 1.2 2020/08/16 14:25:16 rillig Exp $ +# $NetBSD: sh-jobs.mk,v 1.3 2020/12/11 01:06:10 rillig Exp $ # # Tests for the "run in jobs mode" part of the "Shell Commands" section # from the manual page. -# TODO: Implementation +# TODO: Tutorial -all: - @:; +.MAKEFLAGS: -j1 + +all: .PHONY comment .WAIT comment-with-followup-line .WAIT no-comment + +# If a shell command starts with a comment character after stripping the +# leading '@', it is run in ignore-errors mode since the default runChkTmpl +# would lead to a syntax error in the generated shell file, at least for +# bash and dash, but not for NetBSD sh and ksh. +# +# See JobPrintCommand, cmdTemplate, runIgnTmpl +comment: .PHONY + @# comment + +# If a shell command starts with a comment character after stripping the +# leading '@', it is run in ignore-errors mode. +# +# See JobPrintCommand, cmdTemplate, runIgnTmpl +comment-with-followup-line: .PHONY + @# comment${.newline}echo '$@: This is printed.'; false + @true + +# Without the comment, the commands are run in the default mode, which checks +# the exit status of every makefile line. +# +# See JobPrintCommand, cmdTemplate, runChkTmpl +no-comment: .PHONY + @echo '$@: This is printed.'; false + @true
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Dec 11 00:29:01 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): rename shell flags in struct Shell The previous name 'echo' was too unspecific, given that the other fields in the same struct are called echoOff, echoOn, echoTmpl. To generate a diff of this commit: cvs rdiff -u -r1.365 -r1.366 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.365 src/usr.bin/make/job.c:1.366 --- src/usr.bin/make/job.c:1.365 Fri Dec 11 00:22:23 2020 +++ src/usr.bin/make/job.c Fri Dec 11 00:29:01 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.365 2020/12/11 00:22:23 rillig Exp $ */ +/* $NetBSD: job.c,v 1.366 2020/12/11 00:29:01 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.365 2020/12/11 00:22:23 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.366 2020/12/11 00:29:01 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -212,11 +212,8 @@ typedef struct Shell { const char *newline; char commentChar; /* character used by shell for comment lines */ - /* - * command-line flags - */ - const char *echo; /* echo commands */ - const char *exit; /* exit on error */ + const char *echoFlag; /* shell flag to echo commands */ + const char *exitFlag; /* shell flag to exit on error */ } Shell; typedef struct CommandFlags { @@ -1465,8 +1462,8 @@ JobMakeArgv(Job *job, char **argv) argv[0] = UNCONST(shellName); argc = 1; - if ((shell->exit && shell->exit[0] != '-') || - (shell->echo && shell->echo[0] != '-')) { + if ((shell->exitFlag != NULL && shell->exitFlag[0] != '-') || + (shell->echoFlag != NULL && shell->echoFlag[0] != '-')) { /* * At least one of the flags doesn't have a minus before it, * so merge them together. Have to do this because the Bourne @@ -1479,21 +1476,21 @@ JobMakeArgv(Job *job, char **argv) */ (void)snprintf(args, sizeof args, "-%s%s", (job->ignerr ? "" : - (shell->exit ? shell->exit : "")), + (shell->exitFlag != NULL ? shell->exitFlag : "")), (!job->echo ? "" : - (shell->echo ? shell->echo : ""))); + (shell->echoFlag != NULL ? shell->echoFlag : ""))); if (args[1]) { argv[argc] = args; argc++; } } else { - if (!job->ignerr && shell->exit) { - argv[argc] = UNCONST(shell->exit); + if (!job->ignerr && shell->exitFlag) { + argv[argc] = UNCONST(shell->exitFlag); argc++; } - if (job->echo && shell->echo) { - argv[argc] = UNCONST(shell->echo); + if (job->echo && shell->echoFlag) { + argv[argc] = UNCONST(shell->echoFlag); argc++; } } @@ -2082,22 +2079,23 @@ Shell_Init(void) InitShellNameAndPath(); Var_SetWithFlags(".SHELL", shellPath, VAR_CMDLINE, VAR_SET_READONLY); - if (shell->exit == NULL) - shell->exit = ""; - if (shell->echo == NULL) - shell->echo = ""; - if (shell->hasErrCtl && shell->exit[0] != '\0') { + if (shell->exitFlag == NULL) + shell->exitFlag = ""; + if (shell->echoFlag == NULL) + shell->echoFlag = ""; + if (shell->hasErrCtl && shell->exitFlag[0] != '\0') { if (shellErrFlag && - strcmp(shell->exit, &shellErrFlag[1]) != 0) { + strcmp(shell->exitFlag, &shellErrFlag[1]) != 0) { free(shellErrFlag); shellErrFlag = NULL; } if (shellErrFlag == NULL) { - size_t n = strlen(shell->exit) + 2; + size_t n = strlen(shell->exitFlag) + 2; shellErrFlag = bmake_malloc(n); if (shellErrFlag != NULL) -snprintf(shellErrFlag, n, "-%s", shell->exit); +snprintf(shellErrFlag, n, "-%s", +shell->exitFlag); } } else if (shellErrFlag != NULL) { free(shellErrFlag); @@ -2343,9 +2341,9 @@ Job_ParseShell(char *line) newShell.noPrint = arg + 7; newShell.noPrintLen = strlen(newShell.noPrint); } else if (strncmp(arg, "echoFlag=", 9) == 0) { -newShell.echo = arg + 9; +newShell.echoFlag = arg + 9; } else if (strncmp(arg, "errFlag=", 8) == 0) { -newShell.exit = arg + 8; +newShell.exitFlag = arg + 8; } else if (strncmp(arg, "hasErrCtl=", 10) == 0) { char c = arg[10]; newShell.hasErrCtl = c == 'Y' || c == 'y' ||
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Fri Dec 11 00:22:23 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): clean up comments for struct Shell To generate a diff of this commit: cvs rdiff -u -r1.364 -r1.365 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.364 src/usr.bin/make/job.c:1.365 --- src/usr.bin/make/job.c:1.364 Thu Dec 10 23:54:41 2020 +++ src/usr.bin/make/job.c Fri Dec 11 00:22:23 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.364 2020/12/10 23:54:41 rillig Exp $ */ +/* $NetBSD: job.c,v 1.365 2020/12/11 00:22:23 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.364 2020/12/10 23:54:41 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.365 2020/12/11 00:22:23 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -190,8 +190,8 @@ typedef struct Shell { const char *name; Boolean hasEchoCtl; /* True if both echoOff and echoOn defined */ - const char *echoOff; /* command to turn off echo */ - const char *echoOn; /* command to turn it back on again */ + 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 * shell. This is usually the same as echoOff */ size_t noPrintLen; /* length of noPrint command */
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 23:54:41 UTC 2020 Modified Files: src/usr.bin/make: job.c src/usr.bin/make/unit-tests: opt-jobs-no-action.exp opt-jobs-no-action.mk Log Message: make(1): name Shell fields consistently They are all templates with a single %s placeholder, so embed this unambiguously in the variable name. The previous variable names didn't provide any clue that echoCmd, execIgnore and errExit had a lot in common. To generate a diff of this commit: cvs rdiff -u -r1.363 -r1.364 src/usr.bin/make/job.c cvs rdiff -u -r1.5 -r1.6 src/usr.bin/make/unit-tests/opt-jobs-no-action.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/opt-jobs-no-action.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/job.c diff -u src/usr.bin/make/job.c:1.363 src/usr.bin/make/job.c:1.364 --- src/usr.bin/make/job.c:1.363 Thu Dec 10 23:36:20 2020 +++ src/usr.bin/make/job.c Thu Dec 10 23:54:41 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.363 2020/12/10 23:36:20 rillig Exp $ */ +/* $NetBSD: job.c,v 1.364 2020/12/10 23:54:41 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.363 2020/12/10 23:36:20 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.364 2020/12/10 23:54:41 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -162,12 +162,12 @@ MAKE_RCSID("$NetBSD: job.c,v 1.363 2020/ * it is filtered out using noPrint and noPrintLen. * * The error checking for individual commands is controlled using hasErrCtl, - * errOnOrEcho, errOffOrExecIgnore and errExit. + * errOn, errOff and runChkTmpl. * - * If a shell doesn't have error control, errOnOrEcho becomes a printf template - * for echoing the command, should echoing be on; errOffOrExecIgnore becomes + * If a shell doesn't have error control, echoTmpl becomes a printf template + * for echoing the command, should echoing be on; runIgnTmpl becomes * another printf template for executing the command while ignoring the return - * status. Finally errExit is a printf template for running the command and + * status. Finally runChkTmpl is a printf template for running the command and * causing the shell to exit on error. If any of these strings are empty when * hasErrCtl is FALSE, the command will be executed anyway as is, and if it * causes an error, so be it. Any templates set up to echo the command will @@ -200,9 +200,12 @@ typedef struct Shell { * individual commands */ const char *errOn; /* command to turn on error checking */ const char *errOff; /* command to turn off error checking */ - const char *echoCmd; /* template to echo a command */ - const char *execIgnore; /* template to run a command with ignerr */ - const char *errExit; /* template to use for testing exit code */ + + const char *echoTmpl; /* template to echo a command */ + const char *runIgnTmpl; /* template to run a command + * without error checking */ + const char *runChkTmpl; /* template to run a command + * with error checking */ /* string literal that results in a newline character when it appears * outside of any 'quote' or "quote" characters */ @@ -303,9 +306,9 @@ static Shell shells[] = { FALSE, /* .hasErrCtl */ "", /* .errOn */ "", /* .errOff */ - "echo \"%s\"\n", /* .echoCmd */ - "%s\n", /* .execIgnore */ - "{ %s \n} || exit $?\n", /* .errExit */ + "echo \"%s\"\n", /* .echoTmpl */ + "%s\n", /* .runIgnTmpl */ + "{ %s \n} || exit $?\n", /* .runChkTmpl */ "'\n'", /* .newline */ '#', /* .commentChar */ "", /* .echo */ @@ -326,9 +329,9 @@ static Shell shells[] = { FALSE, /* .hasErrCtl */ "", /* .errOn */ "", /* .errOff */ - "echo \"%s\"\n", /* .echoCmd */ - "%s\n", /* .execIgnore */ - "{ %s \n} || exit $?\n", /* .errExit */ + "echo \"%s\"\n", /* .echoTmpl */ + "%s\n", /* .runIgnTmpl */ + "{ %s \n} || exit $?\n", /* .runChkTmpl */ "'\n'", /* .newline */ '#', /* .commentChar*/ #if defined(MAKE_NATIVE) && defined(__NetBSD__) @@ -351,9 +354,9 @@ static Shell shells[] = { FALSE, /* .hasErrCtl */ "", /* .errOn */ "", /* .errOff */ - "echo \"%s\"\n", /* .echoCmd */ - "%s\n", /* .execIgnore */ - "{ %s \n} || exit $?\n", /* .errExit */ + "echo \"%s\"\n", /* .echoTmpl */ + "%s\n", /* .runIgnTmpl */ + "{ %s \n} || exit $?\n", /* .runChkTmpl */ "'\n'", /* .newline */ '#', /* .commentChar */ "v", /* .echo */ @@ -374,9 +377,9 @@ static Shell shells[] = { FALSE, /* .hasErrCtl */ "", /* .errOn */ "", /* .errOff */ - "echo \"%s\"\n", /* .echoCmd */ - "csh -c \"%s || exit 0\"\n", /* .execIgnore */ - "", /* .errExit */ + "echo \"%s\"\n", /* .echoTmpl */ + "csh -c \"%s || exit 0\"\n", /* .runIgnTmpl */ + "", /
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 23:36:20 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): clean up JobPrintCommand The local variable 'cmd' had been used for both the unexpanded and the expanded command. This in turn had required the parameter to be non-const. To generate a diff of this commit: cvs rdiff -u -r1.362 -r1.363 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.362 src/usr.bin/make/job.c:1.363 --- src/usr.bin/make/job.c:1.362 Thu Dec 10 23:12:59 2020 +++ src/usr.bin/make/job.c Thu Dec 10 23:36:20 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.362 2020/12/10 23:12:59 rillig Exp $ */ +/* $NetBSD: job.c,v 1.363 2020/12/10 23:36:20 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.362 2020/12/10 23:12:59 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.363 2020/12/10 23:36:20 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -830,32 +830,31 @@ JobPrintSpecials(Job *const job, const c * XXX: Why ignore errors for the entire job? * XXX: Even ignore errors for the commands before this command? * - * If the command is just "...", all further commands for this job will be - * executed once the entire graph has been made. These commands are later - * attached to the .END node and executed by Job_End when all things are done. + * If the command is just "...", all further commands of this job are skipped + * for now. They are attached to the .END node and will be run by Job_Finish + * after all other targets have been made. */ static void -JobPrintCommand(Job *job, char *cmd) +JobPrintCommand(Job *job, const char * const ucmd) { - const char *const cmdp = cmd; - Boolean run; CommandFlags cmdFlags; - /* Template to use when printing the command */ + /* Template for printing a command to the shell file */ const char *cmdTemplate; - char *cmdStart; /* Start of expanded command */ - char *escCmd = NULL; /* Command with quotes/backticks escaped */ + char *xcmd; /* The expanded command */ + char *xcmdStart; + char *escCmd; /* xcmd escaped to be used in double quotes */ run = GNode_ShouldExecute(job->node); - Var_Subst(cmd, job->node, VARE_WANTRES, &cmd); + Var_Subst(ucmd, job->node, VARE_WANTRES, &xcmd); /* TODO: handle errors */ - cmdStart = cmd; + xcmdStart = xcmd; cmdTemplate = "%s\n"; - ParseRunOptions(&cmd, &cmdFlags); + ParseRunOptions(&xcmd, &cmdFlags); /* The '+' command flag overrides the -n or -N options. */ if (cmdFlags.always && !run) { @@ -863,19 +862,17 @@ JobPrintCommand(Job *job, char *cmd) * We're not actually executing anything... * but this one needs to be - use compat mode just for it. */ - Compat_RunCommand(cmdp, job->node); - free(cmdStart); + Compat_RunCommand(ucmd, job->node); + free(xcmdStart); return; } /* - * If the shell doesn't have error control the alternate echo'ing will - * be done (to avoid showing additional error checking code) - * and this will need the characters '$ ` \ "' escaped + * If the shell doesn't have error control, the alternate echoing + * will be done (to avoid showing additional error checking code) + * and this needs some characters escaped. */ - - if (!shell->hasErrCtl) - escCmd = EscapeShellDblQuot(cmd); + escCmd = shell->hasErrCtl ? NULL : EscapeShellDblQuot(xcmd); if (!cmdFlags.echo) { if (job->echo && run && shell->hasEchoCtl) { @@ -922,8 +919,8 @@ JobPrintCommand(Job *job, char *cmd) job->xtraced = TRUE; } - JobPrintf(job, cmdTemplate, cmd); - free(cmdStart); + JobPrintf(job, cmdTemplate, xcmd); + free(xcmdStart); free(escCmd); if (cmdFlags.ignerr) { /*
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 23:12:59 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): eliminate global variable numCommands It had only been used in a very small scope. The elimination of Lst_ForEach made it easy to turn this global variable into a local variable. To generate a diff of this commit: cvs rdiff -u -r1.361 -r1.362 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.361 src/usr.bin/make/job.c:1.362 --- src/usr.bin/make/job.c:1.361 Thu Dec 10 23:03:00 2020 +++ src/usr.bin/make/job.c Thu Dec 10 23:12:59 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.361 2020/12/10 23:03:00 rillig Exp $ */ +/* $NetBSD: job.c,v 1.362 2020/12/10 23:12:59 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.361 2020/12/10 23:03:00 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.362 2020/12/10 23:12:59 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -248,10 +248,6 @@ static AbortReason aborting = ABORT_NONE */ int jobTokensRunning = 0; -/* The number of commands actually printed to the shell commands file for - * the current job. Should this number be 0, no shell will be executed. */ -static int numCommands; - typedef enum JobStartResult { JOB_RUNNING, /* Job is running */ JOB_ERROR, /* Error in starting the job */ @@ -853,8 +849,6 @@ JobPrintCommand(Job *job, char *cmd) run = GNode_ShouldExecute(job->node); - numCommands++; - Var_Subst(cmd, job->node, VARE_WANTRES, &cmd); /* TODO: handle errors */ cmdStart = cmd; @@ -952,11 +946,14 @@ JobPrintCommand(Job *job, char *cmd) * * The special command "..." stops printing and saves the remaining commands * to be executed later. + * + * Return whether at least one command was written to the shell file. */ -static void +static Boolean JobPrintCommands(Job *job) { StringListNode *ln; + Boolean seen = FALSE; for (ln = job->node->commands.first; ln != NULL; ln = ln->next) { const char *cmd = ln->datum; @@ -968,7 +965,10 @@ JobPrintCommands(Job *job) } JobPrintCommand(job, ln->datum); + seen = TRUE; } + + return seen; } /* Save the delayed commands, to be executed when everything else is done. */ @@ -1544,15 +1544,9 @@ JobOpenTmpFile(Job *job, GNode *gn, Bool job->echo = FALSE; } #endif - /* We can do all the commands at once. hooray for sanity */ - numCommands = 0; - JobPrintCommands(job); - /* - * If we didn't print out any commands to the shell script, - * there's no point in executing the shell. - */ - if (numCommands == 0) + /* We can do all the commands at once. hooray for sanity */ + if (!JobPrintCommands(job)) *out_run = FALSE; free(tfile);
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 23:03:00 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): extract JobOpenTmpFile from JobStart To generate a diff of this commit: cvs rdiff -u -r1.360 -r1.361 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.360 src/usr.bin/make/job.c:1.361 --- src/usr.bin/make/job.c:1.360 Thu Dec 10 22:45:30 2020 +++ src/usr.bin/make/job.c Thu Dec 10 23:03:00 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.360 2020/12/10 22:45:30 rillig Exp $ */ +/* $NetBSD: job.c,v 1.361 2020/12/10 23:03:00 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.360 2020/12/10 22:45:30 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.361 2020/12/10 23:03:00 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1499,6 +1499,65 @@ JobMakeArgv(Job *job, char **argv) argv[argc] = NULL; } +static void +JobOpenTmpFile(Job *job, GNode *gn, Boolean cmdsOK, Boolean *out_run) +{ + /* + * tfile is the name of a file into which all shell commands + * are put. It is removed before the child shell is executed, + * unless DEBUG(SCRIPT) is set. + */ + char *tfile; + sigset_t mask; + int tfd; /* File descriptor to the temp file */ + + /* + * We're serious here, but if the commands were bogus, we're + * also dead... + */ + if (!cmdsOK) { + PrintOnError(gn, NULL); /* provide some clue */ + DieHorribly(); + } + + JobSigLock(&mask); + tfd = mkTempFile(TMPPAT, &tfile); + if (!DEBUG(SCRIPT)) + (void)eunlink(tfile); + JobSigUnlock(&mask); + + job->cmdFILE = fdopen(tfd, "w+"); + if (job->cmdFILE == NULL) + Punt("Could not fdopen %s", tfile); + + (void)fcntl(fileno(job->cmdFILE), F_SETFD, FD_CLOEXEC); + /* + * Send the commands to the command file, flush all its + * buffers then rewind and remove the thing. + */ + *out_run = TRUE; + +#ifdef USE_META + if (useMeta) { + meta_job_start(job, gn); + if (Targ_Silent(gn)) /* might have changed */ + job->echo = FALSE; + } +#endif + /* We can do all the commands at once. hooray for sanity */ + numCommands = 0; + JobPrintCommands(job); + + /* + * If we didn't print out any commands to the shell script, + * there's no point in executing the shell. + */ + if (numCommands == 0) + *out_run = FALSE; + + free(tfile); +} + /* * Start a target-creation process going for the target described by the * graph node gn. @@ -1526,7 +1585,6 @@ JobStart(GNode *gn, Boolean special) char *argv[10]; /* Argument vector to shell */ Boolean cmdsOK; /* true if the nodes commands were all right */ Boolean run; - int tfd; /* File descriptor to the temp file */ for (job = job_table; job < job_table_end; job++) { if (job->status == JOB_ST_FREE) @@ -1560,58 +1618,7 @@ JobStart(GNode *gn, Boolean special) */ if (((gn->type & OP_MAKE) && !opts.noRecursiveExecute) || (!opts.noExecute && !opts.touchFlag)) { - /* - * tfile is the name of a file into which all shell commands - * are put. It is removed before the child shell is executed, - * unless DEBUG(SCRIPT) is set. - */ - char *tfile; - sigset_t mask; - /* - * We're serious here, but if the commands were bogus, we're - * also dead... - */ - if (!cmdsOK) { - PrintOnError(gn, NULL); /* provide some clue */ - DieHorribly(); - } - - JobSigLock(&mask); - tfd = mkTempFile(TMPPAT, &tfile); - if (!DEBUG(SCRIPT)) - (void)eunlink(tfile); - JobSigUnlock(&mask); - - job->cmdFILE = fdopen(tfd, "w+"); - if (job->cmdFILE == NULL) - Punt("Could not fdopen %s", tfile); - - (void)fcntl(fileno(job->cmdFILE), F_SETFD, FD_CLOEXEC); - /* - * Send the commands to the command file, flush all its - * buffers then rewind and remove the thing. - */ - run = TRUE; - -#ifdef USE_META - if (useMeta) { - meta_job_start(job, gn); - if (Targ_Silent(gn)) /* might have changed */ -job->echo = FALSE; - } -#endif - /* We can do all the commands at once. hooray for sanity */ - numCommands = 0; - JobPrintCommands(job); - - /* - * If we didn't print out any commands to the shell script, - * there's no point in executing the shell. - */ - if (numCommands == 0) - run = FALSE; - - free(tfile); + JobOpenTmpFile(job, gn, cmdsOK, &run); } else if (!GNode_ShouldExecute(gn)) { /* * Not executing anything -- just print all the commands to
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 22:45:30 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): rename RunFlags to CommandFlags Flags of similar names are also available in CmdOpts (global command line options) and Job. The new name CommandFlags emphasizes that these flags apply to the smallest scope possible, which is a single command, as opposed to the whole GNode/Job. To generate a diff of this commit: cvs rdiff -u -r1.359 -r1.360 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.359 src/usr.bin/make/job.c:1.360 --- src/usr.bin/make/job.c:1.359 Thu Dec 10 22:34:39 2020 +++ src/usr.bin/make/job.c Thu Dec 10 22:45:30 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.359 2020/12/10 22:34:39 rillig Exp $ */ +/* $NetBSD: job.c,v 1.360 2020/12/10 22:45:30 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.359 2020/12/10 22:34:39 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.360 2020/12/10 22:45:30 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -216,10 +216,11 @@ typedef struct Shell { const char *exit; /* exit on error */ } Shell; -typedef struct RunFlags { +typedef struct CommandFlags { /* Whether to echo the command before running it. */ Boolean echo; + /* Run the command even in -n or -N mode. */ Boolean always; /* @@ -227,7 +228,7 @@ typedef struct RunFlags { * and need to turn it back on */ Boolean ignerr; -} RunFlags; +} CommandFlags; /* * error handling variables @@ -699,20 +700,20 @@ JobFindPid(int pid, JobStatus status, Bo /* Parse leading '@', '-' and '+', which control the exact execution mode. */ static void -ParseRunOptions(char **pp, RunFlags *out_runFlags) +ParseRunOptions(char **pp, CommandFlags *out_cmdFlags) { char *p = *pp; - out_runFlags->echo = TRUE; - out_runFlags->ignerr = FALSE; - out_runFlags->always = FALSE; + out_cmdFlags->echo = TRUE; + out_cmdFlags->ignerr = FALSE; + out_cmdFlags->always = FALSE; for (;;) { if (*p == '@') - out_runFlags->echo = DEBUG(LOUD); + out_cmdFlags->echo = DEBUG(LOUD); else if (*p == '-') - out_runFlags->ignerr = TRUE; + out_cmdFlags->ignerr = TRUE; else if (*p == '+') - out_runFlags->always = TRUE; + out_cmdFlags->always = TRUE; else break; p++; @@ -783,18 +784,18 @@ JobPrintSpecialsErrCtl(Job *job, Boolean * Set cmdTemplate to use the weirdness instead of the simple "%s\n" template. */ static void -JobPrintSpecialsEchoCtl(Job *job, RunFlags *inout_runFlags, const char *escCmd, - const char **inout_cmdTemplate) +JobPrintSpecialsEchoCtl(Job *job, CommandFlags *inout_cmdFlags, + const char *escCmd, const char **inout_cmdTemplate) { job->ignerr = TRUE; - if (job->echo && inout_runFlags->echo) { + if (job->echo && inout_cmdFlags->echo) { if (shell->hasEchoCtl) JobPrintln(job, shell->echoOff); JobPrintf(job, shell->echoCmd, escCmd); - inout_runFlags->echo = FALSE; + inout_cmdFlags->echo = FALSE; } else { - if (inout_runFlags->echo) + if (inout_cmdFlags->echo) JobPrintf(job, shell->echoCmd, escCmd); } *inout_cmdTemplate = shell->execIgnore; @@ -803,23 +804,23 @@ JobPrintSpecialsEchoCtl(Job *job, RunFla * The error ignoration (hee hee) is already taken care of by the * errOffOrExecIgnore template, so pretend error checking is still on. */ - inout_runFlags->ignerr = FALSE; + inout_cmdFlags->ignerr = FALSE; } static void JobPrintSpecials(Job *const job, const char *const escCmd, - Boolean const run, RunFlags *const inout_runFlags, + Boolean const run, CommandFlags *const inout_cmdFlags, const char **const inout_cmdTemplate) { if (!run) - inout_runFlags->ignerr = FALSE; + inout_cmdFlags->ignerr = FALSE; else if (shell->hasErrCtl) - JobPrintSpecialsErrCtl(job, inout_runFlags->echo); + JobPrintSpecialsErrCtl(job, inout_cmdFlags->echo); else if (shell->execIgnore != NULL && shell->execIgnore[0] != '\0') { - JobPrintSpecialsEchoCtl(job, inout_runFlags, escCmd, + JobPrintSpecialsEchoCtl(job, inout_cmdFlags, escCmd, inout_cmdTemplate); } else - inout_runFlags->ignerr = FALSE; + inout_cmdFlags->ignerr = FALSE; } /* @@ -844,7 +845,7 @@ JobPrintCommand(Job *job, char *cmd) Boolean run; - RunFlags runFlags; + CommandFlags cmdFlags; /* Template to use when printing the command */ const char *cmdTemplate; char *cmdStart; /* Start of expanded command */ @@ -860,10 +861,10 @@ JobPrintCommand(Job *job, char *cmd) cmdTemplate = "%s\n"; - ParseRunOptions(&cmd, &runFlags); + ParseRunOptions(&cmd, &cmdFlags); /* The '+' command flag overrides the -n or -N option
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 22:34:39 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): split Job.errOffOrExecIgnore into separate fields Like errOnOrEcho, these two fields were completely unrelated. One of them expected a %s placeholder, the other didn't. To generate a diff of this commit: cvs rdiff -u -r1.358 -r1.359 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.358 src/usr.bin/make/job.c:1.359 --- src/usr.bin/make/job.c:1.358 Thu Dec 10 22:17:37 2020 +++ src/usr.bin/make/job.c Thu Dec 10 22:34:39 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.358 2020/12/10 22:17:37 rillig Exp $ */ +/* $NetBSD: job.c,v 1.359 2020/12/10 22:34:39 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.358 2020/12/10 22:17:37 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.359 2020/12/10 22:34:39 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -198,13 +198,10 @@ typedef struct Shell { Boolean hasErrCtl; /* set if can control error checking for * individual commands */ - const char *errOn; /* template to turn on error checking */ - const char *echoCmd; - /* - * template to turn off error checking - * XXX: split into errOff and execIgnore - */ - const char *errOffOrExecIgnore; + const char *errOn; /* command to turn on error checking */ + const char *errOff; /* command to turn off error checking */ + const char *echoCmd; /* template to echo a command */ + const char *execIgnore; /* template to run a command with ignerr */ const char *errExit; /* template to use for testing exit code */ /* string literal that results in a newline character when it appears @@ -308,8 +305,9 @@ static Shell shells[] = { 0, /* .noPrintLen */ FALSE, /* .hasErrCtl */ "", /* .errOn */ + "", /* .errOff */ "echo \"%s\"\n", /* .echoCmd */ - "%s\n", /* .errOffOrExecIgnore */ + "%s\n", /* .execIgnore */ "{ %s \n} || exit $?\n", /* .errExit */ "'\n'", /* .newline */ '#', /* .commentChar */ @@ -330,8 +328,9 @@ static Shell shells[] = { 0, /* .noPrintLen */ FALSE, /* .hasErrCtl */ "", /* .errOn */ + "", /* .errOff */ "echo \"%s\"\n", /* .echoCmd */ - "%s\n", /* .errOffOrExecIgnore */ + "%s\n", /* .execIgnore */ "{ %s \n} || exit $?\n", /* .errExit */ "'\n'", /* .newline */ '#', /* .commentChar*/ @@ -354,8 +353,9 @@ static Shell shells[] = { 6, /* .noPrintLen */ FALSE, /* .hasErrCtl */ "", /* .errOn */ + "", /* .errOff */ "echo \"%s\"\n", /* .echoCmd */ - "%s\n", /* .errOffOrExecIgnore */ + "%s\n", /* .execIgnore */ "{ %s \n} || exit $?\n", /* .errExit */ "'\n'", /* .newline */ '#', /* .commentChar */ @@ -376,9 +376,9 @@ static Shell shells[] = { 13, /* .noPrintLen */ FALSE, /* .hasErrCtl */ "", /* .errOn */ + "", /* .errOff */ "echo \"%s\"\n", /* .echoCmd */ - /* XXX: Mismatch between errOn and execIgnore */ - "csh -c \"%s || exit 0\"\n", /* .errOffOrExecIgnore */ + "csh -c \"%s || exit 0\"\n", /* .execIgnore */ "", /* .errExit */ "'\\\n'", /* .newline */ '#', /* .commentChar */ @@ -768,10 +768,10 @@ JobPrintSpecialsErrCtl(Job *job, Boolean { if (job->echo && cmdEcho && shell->hasEchoCtl) { JobPrintln(job, shell->echoOff); - JobPrintln(job, shell->errOffOrExecIgnore); + JobPrintln(job, shell->errOff); JobPrintln(job, shell->echoOn); } else { - JobPrintln(job, shell->errOffOrExecIgnore); + JobPrintln(job, shell->errOff); } } @@ -797,7 +797,7 @@ JobPrintSpecialsEchoCtl(Job *job, RunFla if (inout_runFlags->echo) JobPrintf(job, shell->echoCmd, escCmd); } - *inout_cmdTemplate = shell->errOffOrExecIgnore; + *inout_cmdTemplate = shell->execIgnore; /* * The error ignoration (hee hee) is already taken care of by the @@ -815,8 +815,7 @@ JobPrintSpecials(Job *const job, const c inout_runFlags->ignerr = FALSE; else if (shell->hasErrCtl) JobPrintSpecialsErrCtl(job, inout_runFlags->echo); - else if (shell->errOffOrExecIgnore != NULL && - shell->errOffOrExecIgnore[0] != '\0') { + else if (shell->execIgnore != NULL && shell->execIgnore[0] != '\0') { JobPrintSpecialsEchoCtl(job, inout_runFlags, escCmd, inout_cmdTemplate); } else @@ -916,7 +915,7 @@ JobPrintCommand(Job *job, char *cmd) */ if (escCmd[0] == shell->commentChar || (escCmd[0] == '\0')) -cmdTemplate = shell->errOffOrExecIgnore; +cmdTemplate = shell->execIgnore; else cmdTemplate = shell->errExit; runFlags.ignerr = FALSE; @@ -2351,12 +2350,15 @@ Job_ParseShell(char *line) } else if (strncmp(arg, "newline=", 8) == 0) { newShell.ne
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 22:17:37 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): split Job.errOnOrEcho into separate fields They have never been related. Furthermore, Job.errOn is really tricky to reach at all. To do that, one has to define a custom shell and set hasErrCtl=true. The manual page has an example for that, but it's probably not use in practice, just like the possibility to use the C shell for all commands. To generate a diff of this commit: cvs rdiff -u -r1.357 -r1.358 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.357 src/usr.bin/make/job.c:1.358 --- src/usr.bin/make/job.c:1.357 Thu Dec 10 21:41:35 2020 +++ src/usr.bin/make/job.c Thu Dec 10 22:17:37 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.357 2020/12/10 21:41:35 rillig Exp $ */ +/* $NetBSD: job.c,v 1.358 2020/12/10 22:17:37 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.357 2020/12/10 21:41:35 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.358 2020/12/10 22:17:37 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -198,8 +198,8 @@ typedef struct Shell { Boolean hasErrCtl; /* set if can control error checking for * individual commands */ - /* XXX: split into errOn and echoCmd */ - const char *errOnOrEcho; /* template to turn on error checking */ + const char *errOn; /* template to turn on error checking */ + const char *echoCmd; /* * template to turn off error checking * XXX: split into errOff and execIgnore @@ -307,7 +307,8 @@ static Shell shells[] = { "", /* .noPrint */ 0, /* .noPrintLen */ FALSE, /* .hasErrCtl */ - "echo \"%s\"\n", /* .errOnOrEcho */ + "", /* .errOn */ + "echo \"%s\"\n", /* .echoCmd */ "%s\n", /* .errOffOrExecIgnore */ "{ %s \n} || exit $?\n", /* .errExit */ "'\n'", /* .newline */ @@ -328,7 +329,8 @@ static Shell shells[] = { "", /* .noPrint */ 0, /* .noPrintLen */ FALSE, /* .hasErrCtl */ - "echo \"%s\"\n", /* .errOnOrEcho */ + "", /* .errOn */ + "echo \"%s\"\n", /* .echoCmd */ "%s\n", /* .errOffOrExecIgnore */ "{ %s \n} || exit $?\n", /* .errExit */ "'\n'", /* .newline */ @@ -351,7 +353,8 @@ static Shell shells[] = { "set +v", /* .noPrint */ 6, /* .noPrintLen */ FALSE, /* .hasErrCtl */ - "echo \"%s\"\n", /* .errOnOrEcho */ + "", /* .errOn */ + "echo \"%s\"\n", /* .echoCmd */ "%s\n", /* .errOffOrExecIgnore */ "{ %s \n} || exit $?\n", /* .errExit */ "'\n'", /* .newline */ @@ -372,7 +375,8 @@ static Shell shells[] = { "unset verbose", /* .noPrint */ 13, /* .noPrintLen */ FALSE, /* .hasErrCtl */ - "echo \"%s\"\n", /* .errOnOrEcho */ + "", /* .errOn */ + "echo \"%s\"\n", /* .echoCmd */ /* XXX: Mismatch between errOn and execIgnore */ "csh -c \"%s || exit 0\"\n", /* .errOffOrExecIgnore */ "", /* .errExit */ @@ -787,11 +791,11 @@ JobPrintSpecialsEchoCtl(Job *job, RunFla if (job->echo && inout_runFlags->echo) { if (shell->hasEchoCtl) JobPrintln(job, shell->echoOff); - JobPrintf(job, shell->errOnOrEcho, escCmd); + JobPrintf(job, shell->echoCmd, escCmd); inout_runFlags->echo = FALSE; } else { if (inout_runFlags->echo) - JobPrintf(job, shell->errOnOrEcho, escCmd); + JobPrintf(job, shell->echoCmd, escCmd); } *inout_cmdTemplate = shell->errOffOrExecIgnore; @@ -820,22 +824,19 @@ JobPrintSpecials(Job *const job, const c } /* - * Put out another command for the given job. If the command starts with an - * '@' or a '-' we process it specially. In the former case, so long as the - * -s and -n flags weren't given to make, we stick a shell-specific echoOff - * command in the script. In the latter, we ignore errors for the entire job, - * unless the shell has error control. - * - * If the command is just "..." we take all future commands for this job to - * be commands to be executed once the entire graph has been made and return - * non-zero to signal that the end of the commands was reached. These commands - * are later attached to the .END node and executed by Job_End when all things - * are done. + * Put out another command for the given job. * - * Side Effects: - * If the command begins with a '-' and the shell has no error control, - * the JOB_IGNERR flag is set in the job descriptor. - * numCommands is incremented if the command is actually printed. + * If the command starts with '@' and neither the -s nor the -n flag was + * given to make, we stick a shell-specific echoOff command in the script. + * + * If the command starts with '-' and the shell has no error control (none + * of the predefined shells has that), we ignore
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 21:41:35 UTC 2020 Modified Files: src/usr.bin/make: job.c job.h Log Message: make(1): negate Job.silent to echo This gets rid of a few explicit negations and an implicit negation in the variable name. To generate a diff of this commit: cvs rdiff -u -r1.356 -r1.357 src/usr.bin/make/job.c cvs rdiff -u -r1.66 -r1.67 src/usr.bin/make/job.h 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.356 src/usr.bin/make/job.c:1.357 --- src/usr.bin/make/job.c:1.356 Thu Dec 10 21:33:25 2020 +++ src/usr.bin/make/job.c Thu Dec 10 21:41:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.356 2020/12/10 21:33:25 rillig Exp $ */ +/* $NetBSD: job.c,v 1.357 2020/12/10 21:41:35 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.356 2020/12/10 21:33:25 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.357 2020/12/10 21:41:35 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -456,7 +456,7 @@ Job_FlagsToString(const Job *job, char * { snprintf(buf, bufsize, "%c%c%c%c", job->ignerr ? 'i' : '-', - job->silent ? 's' : '-', + !job->echo ? 's' : '-', job->special ? 'S' : '-', job->xtraced ? 'x' : '-'); } @@ -760,9 +760,9 @@ JobPrintln(Job *job, const char *line) * it any more complex than it already is? */ static void -JobPrintSpecialsErrCtl(Job *job, Boolean echo) +JobPrintSpecialsErrCtl(Job *job, Boolean cmdEcho) { - if (!job->silent && echo && shell->hasEchoCtl) { + if (job->echo && cmdEcho && shell->hasEchoCtl) { JobPrintln(job, shell->echoOff); JobPrintln(job, shell->errOffOrExecIgnore); JobPrintln(job, shell->echoOn); @@ -784,7 +784,7 @@ JobPrintSpecialsEchoCtl(Job *job, RunFla { job->ignerr = TRUE; - if (!job->silent && inout_runFlags->echo) { + if (job->echo && inout_runFlags->echo) { if (shell->hasEchoCtl) JobPrintln(job, shell->echoOff); JobPrintf(job, shell->errOnOrEcho, escCmd); @@ -883,7 +883,7 @@ JobPrintCommand(Job *job, char *cmd) escCmd = EscapeShellDblQuot(cmd); if (!runFlags.echo) { - if (!job->silent && run && shell->hasEchoCtl) { + if (job->echo && run && shell->hasEchoCtl) { JobPrintln(job, shell->echoOff); } else { if (shell->hasErrCtl) @@ -903,7 +903,7 @@ JobPrintCommand(Job *job, char *cmd) if (!shell->hasErrCtl && shell->errExit && shell->errExit[0] != '\0') { - if (!job->silent && runFlags.echo) { + if (job->echo && runFlags.echo) { if (shell->hasEchoCtl) JobPrintln(job, shell->echoOff); JobPrintf(job, shell->errOnOrEcho, @@ -937,7 +937,7 @@ JobPrintCommand(Job *job, char *cmd) * echoOff command. Otherwise we issue it and pretend it was on * for the whole command... */ - if (runFlags.echo && !job->silent && shell->hasEchoCtl) { + if (runFlags.echo && job->echo && shell->hasEchoCtl) { JobPrintln(job, shell->echoOff); runFlags.echo = FALSE; } @@ -1181,7 +1181,7 @@ TouchRegular(GNode *gn) * The modification date of the file is changed. * If the file did not exist, it is created. */ void -Job_Touch(GNode *gn, Boolean silent) +Job_Touch(GNode *gn, Boolean echo) { if (gn->type & (OP_JOIN | OP_USE | OP_USEBEFORE | OP_EXEC | OP_OPTIONAL | @@ -1193,7 +1193,7 @@ Job_Touch(GNode *gn, Boolean silent) return; } - if (!silent || !GNode_ShouldExecute(gn)) { + if (echo || !GNode_ShouldExecute(gn)) { (void)fprintf(stdout, "touch %s\n", gn->name); (void)fflush(stdout); } @@ -1323,7 +1323,7 @@ JobExec(Job *job, char **argv) * banner with their name in it never appears). This is an attempt to * provide that feedback, even if nothing follows it. */ - if (!job->silent) + if (job->echo) SwitchOutputTo(job->node); /* No interruptions until this job is on the `jobs' list */ @@ -1479,7 +1479,7 @@ JobMakeArgv(Job *job, char **argv) (void)snprintf(args, sizeof args, "-%s%s", (job->ignerr ? "" : (shell->exit ? shell->exit : "")), - (job->silent ? "" : + (!job->echo ? "" : (shell->echo ? shell->echo : ""))); if (args[1]) { @@ -1491,7 +1491,7 @@ JobMakeArgv(Job *job, char **argv) argv[argc] = UNCONST(shell->exit); argc++; } - if (!job->silent && shell->echo) { + if (job->echo && shell->echo) { argv[argc] = UNCONST(shell->echo); argc++; } @@ -1542,7 +1542,7 @@ JobStart(GNode *gn, Boolean special) job->special = special || (gn->type & OP_SPECIAL); job->ignerr = Targ_Ignore(gn); - job->silent = Targ_Silent(gn); + job->echo = !Targ_Silent(gn); job->xtraced = FALSE; /* @@ -1597,7 +1597,7 @@ JobStart(GNode *gn, Boolean special) if (useMeta) { meta_job_start(job, gn)
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 21:33:25 UTC 2020 Modified Files: src/usr.bin/make: job.c job.h trace.c Log Message: make(1): unpack struct JobFlags The job flags are only used individually. To generate a diff of this commit: cvs rdiff -u -r1.355 -r1.356 src/usr.bin/make/job.c cvs rdiff -u -r1.65 -r1.66 src/usr.bin/make/job.h cvs rdiff -u -r1.22 -r1.23 src/usr.bin/make/trace.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.355 src/usr.bin/make/job.c:1.356 --- src/usr.bin/make/job.c:1.355 Thu Dec 10 21:09:58 2020 +++ src/usr.bin/make/job.c Thu Dec 10 21:33:25 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.355 2020/12/10 21:09:58 rillig Exp $ */ +/* $NetBSD: job.c,v 1.356 2020/12/10 21:33:25 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.355 2020/12/10 21:09:58 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.356 2020/12/10 21:33:25 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -452,13 +452,13 @@ nfds_per_job(void) } void -Job_FlagsToString(char *buf, size_t bufsize, const JobFlags *flags) +Job_FlagsToString(const Job *job, char *buf, size_t bufsize) { snprintf(buf, bufsize, "%c%c%c%c", - flags->ignerr ? 'i' : '-', - flags->silent ? 's' : '-', - flags->special ? 'S' : '-', - flags->xtraced ? 'x' : '-'); + job->ignerr ? 'i' : '-', + job->silent ? 's' : '-', + job->special ? 'S' : '-', + job->xtraced ? 'x' : '-'); } static void @@ -469,7 +469,7 @@ job_table_dump(const char *where) debug_printf("job table @ %s\n", where); for (job = job_table; job < job_table_end; job++) { - Job_FlagsToString(flags, sizeof flags, &job->flags); + Job_FlagsToString(job, flags, sizeof flags); debug_printf("job %d, status %d, flags %s, pid %d\n", (int)(job - job_table), job->status, flags, job->pid); } @@ -762,7 +762,7 @@ JobPrintln(Job *job, const char *line) static void JobPrintSpecialsErrCtl(Job *job, Boolean echo) { - if (!job->flags.silent && echo && shell->hasEchoCtl) { + if (!job->silent && echo && shell->hasEchoCtl) { JobPrintln(job, shell->echoOff); JobPrintln(job, shell->errOffOrExecIgnore); JobPrintln(job, shell->echoOn); @@ -782,9 +782,9 @@ static void JobPrintSpecialsEchoCtl(Job *job, RunFlags *inout_runFlags, const char *escCmd, const char **inout_cmdTemplate) { - job->flags.ignerr = TRUE; + job->ignerr = TRUE; - if (!job->flags.silent && inout_runFlags->echo) { + if (!job->silent && inout_runFlags->echo) { if (shell->hasEchoCtl) JobPrintln(job, shell->echoOff); JobPrintf(job, shell->errOnOrEcho, escCmd); @@ -883,7 +883,7 @@ JobPrintCommand(Job *job, char *cmd) escCmd = EscapeShellDblQuot(cmd); if (!runFlags.echo) { - if (!job->flags.silent && run && shell->hasEchoCtl) { + if (!job->silent && run && shell->hasEchoCtl) { JobPrintln(job, shell->echoOff); } else { if (shell->hasErrCtl) @@ -903,7 +903,7 @@ JobPrintCommand(Job *job, char *cmd) if (!shell->hasErrCtl && shell->errExit && shell->errExit[0] != '\0') { - if (!job->flags.silent && runFlags.echo) { + if (!job->silent && runFlags.echo) { if (shell->hasEchoCtl) JobPrintln(job, shell->echoOff); JobPrintf(job, shell->errOnOrEcho, @@ -923,10 +923,9 @@ JobPrintCommand(Job *job, char *cmd) } } - if (DEBUG(SHELL) && strcmp(shellName, "sh") == 0 && - !job->flags.xtraced) { + if (DEBUG(SHELL) && strcmp(shellName, "sh") == 0 && !job->xtraced) { JobPrintln(job, "set -x"); - job->flags.xtraced = TRUE; + job->xtraced = TRUE; } JobPrintf(job, cmdTemplate, cmd); @@ -938,7 +937,7 @@ JobPrintCommand(Job *job, char *cmd) * echoOff command. Otherwise we issue it and pretend it was on * for the whole command... */ - if (runFlags.echo && !job->flags.silent && shell->hasEchoCtl) { + if (runFlags.echo && !job->silent && shell->hasEchoCtl) { JobPrintln(job, shell->echoOff); runFlags.echo = FALSE; } @@ -1026,7 +1025,7 @@ JobFinish(Job *job, int status) job->pid, job->node->name, status); if ((WIFEXITED(status) && - ((WEXITSTATUS(status) != 0 && !job->flags.ignerr))) || + ((WEXITSTATUS(status) != 0 && !job->ignerr))) || WIFSIGNALED(status)) { /* * If it exited non-zero and either we're doing things our @@ -1066,8 +1065,7 @@ JobFinish(Job *job, int status) #ifdef USE_META if (useMeta) { meta_job_error(job, job->node, - job->flags.ignerr, - WEXITSTATUS(status)); + job->ignerr, WEXITSTATUS(status)); } #endif if (!shouldDieQuietly(job->node, -1)) @@ -1075,9 +1073,8 @@ JobFinish(Job *job, int status) "***
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 21:09:58 UTC 2020 Modified Files: src/usr.bin/make: job.c src/usr.bin/make/unit-tests: shell-csh.mk Log Message: make(1): rename commandShell to shell The word 'command' was not necessary for understanding the variable. To generate a diff of this commit: cvs rdiff -u -r1.354 -r1.355 src/usr.bin/make/job.c cvs rdiff -u -r1.5 -r1.6 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/job.c diff -u src/usr.bin/make/job.c:1.354 src/usr.bin/make/job.c:1.355 --- src/usr.bin/make/job.c:1.354 Thu Dec 10 20:49:11 2020 +++ src/usr.bin/make/job.c Thu Dec 10 21:09:58 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.354 2020/12/10 20:49:11 rillig Exp $ */ +/* $NetBSD: job.c,v 1.355 2020/12/10 21:09: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.354 2020/12/10 20:49:11 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.355 2020/12/10 21:09:58 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -385,7 +385,7 @@ static Shell shells[] = { /* This is the shell to which we pass all commands in the Makefile. * It is set by the Job_ParseShell function. */ -static Shell *commandShell = &shells[DEFSHELL_INDEX]; +static Shell *shell = &shells[DEFSHELL_INDEX]; const char *shellPath = NULL; /* full pathname of executable image */ const char *shellName = NULL; /* last component of shellPath */ char *shellErrFlag = NULL; @@ -762,12 +762,12 @@ JobPrintln(Job *job, const char *line) static void JobPrintSpecialsErrCtl(Job *job, Boolean echo) { - if (!job->flags.silent && echo && commandShell->hasEchoCtl) { - JobPrintln(job, commandShell->echoOff); - JobPrintln(job, commandShell->errOffOrExecIgnore); - JobPrintln(job, commandShell->echoOn); + if (!job->flags.silent && echo && shell->hasEchoCtl) { + JobPrintln(job, shell->echoOff); + JobPrintln(job, shell->errOffOrExecIgnore); + JobPrintln(job, shell->echoOn); } else { - JobPrintln(job, commandShell->errOffOrExecIgnore); + JobPrintln(job, shell->errOffOrExecIgnore); } } @@ -785,15 +785,15 @@ JobPrintSpecialsEchoCtl(Job *job, RunFla job->flags.ignerr = TRUE; if (!job->flags.silent && inout_runFlags->echo) { - if (commandShell->hasEchoCtl) - JobPrintln(job, commandShell->echoOff); - JobPrintf(job, commandShell->errOnOrEcho, escCmd); + if (shell->hasEchoCtl) + JobPrintln(job, shell->echoOff); + JobPrintf(job, shell->errOnOrEcho, escCmd); inout_runFlags->echo = FALSE; } else { if (inout_runFlags->echo) - JobPrintf(job, commandShell->errOnOrEcho, escCmd); + JobPrintf(job, shell->errOnOrEcho, escCmd); } - *inout_cmdTemplate = commandShell->errOffOrExecIgnore; + *inout_cmdTemplate = shell->errOffOrExecIgnore; /* * The error ignoration (hee hee) is already taken care of by the @@ -809,10 +809,10 @@ JobPrintSpecials(Job *const job, const c { if (!run) inout_runFlags->ignerr = FALSE; - else if (commandShell->hasErrCtl) + else if (shell->hasErrCtl) JobPrintSpecialsErrCtl(job, inout_runFlags->echo); - else if (commandShell->errOffOrExecIgnore != NULL && - commandShell->errOffOrExecIgnore[0] != '\0') { + else if (shell->errOffOrExecIgnore != NULL && + shell->errOffOrExecIgnore[0] != '\0') { JobPrintSpecialsEchoCtl(job, inout_runFlags, escCmd, inout_cmdTemplate); } else @@ -879,14 +879,14 @@ JobPrintCommand(Job *job, char *cmd) * and this will need the characters '$ ` \ "' escaped */ - if (!commandShell->hasErrCtl) + if (!shell->hasErrCtl) escCmd = EscapeShellDblQuot(cmd); if (!runFlags.echo) { - if (!job->flags.silent && run && commandShell->hasEchoCtl) { - JobPrintln(job, commandShell->echoOff); + if (!job->flags.silent && run && shell->hasEchoCtl) { + JobPrintln(job, shell->echoOff); } else { - if (commandShell->hasErrCtl) + if (shell->hasErrCtl) runFlags.echo = TRUE; } } @@ -901,12 +901,12 @@ JobPrintCommand(Job *job, char *cmd) * set up commands to run through it. */ - if (!commandShell->hasErrCtl && commandShell->errExit && - commandShell->errExit[0] != '\0') { + if (!shell->hasErrCtl && shell->errExit && + shell->errExit[0] != '\0') { if (!job->flags.silent && runFlags.echo) { -if (commandShell->hasEchoCtl) - JobPrintln(job, commandShell->echoOff); -JobPrintf(job, commandShell->errOnOrEcho, +if (shell->hasEchoCtl) + JobPrintln(job, shell->echoOff); +JobPrintf(job, shell->errOnOrEcho, escCmd); runFlags.echo = FALSE; } @@ -914,11 +914,11 @@ JobPrintCommand(Job *job, char *cmd) * If it's a comment line or blank, treat as an * ignored error. */ - if (esc
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Thu Dec 10 20:50:24 UTC 2020 Modified Files: src/sys/dev/usb: ohci.c Log Message: Another leading space To generate a diff of this commit: cvs rdiff -u -r1.312 -r1.313 src/sys/dev/usb/ohci.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/ohci.c diff -u src/sys/dev/usb/ohci.c:1.312 src/sys/dev/usb/ohci.c:1.313 --- src/sys/dev/usb/ohci.c:1.312 Thu Dec 10 20:48:33 2020 +++ src/sys/dev/usb/ohci.c Thu Dec 10 20:50:24 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.312 2020/12/10 20:48:33 skrll Exp $ */ +/* $NetBSD: ohci.c,v 1.313 2020/12/10 20:50:24 skrll Exp $ */ /* * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.312 2020/12/10 20:48:33 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.313 2020/12/10 20:50:24 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -612,7 +612,7 @@ ohci_reset_std_chain(ohci_softc_t *sc, s usb_syncmem(dma, 0, len, rd ? BUS_DMASYNC_PREREAD : BUS_DMASYNC_PREWRITE); - const uint32_t tdflags = HTOO32( + const uint32_t tdflags = HTOO32( OHCI_TD_SET_DP(rd ? OHCI_TD_DP_IN : OHCI_TD_DP_OUT) | OHCI_TD_SET_CC(OHCI_TD_NOCC) | OHCI_TD_SET_TOGGLE(OHCI_TD_TOGGLE_CARRY) |
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 20:49:11 UTC 2020 Modified Files: src/usr.bin/make: compat.c job.c job.h meta.c meta.h trace.c src/usr.bin/make/unit-tests: opt-debug-jobs.exp Log Message: make(1): split JobFlags into separate fields Having all these flags in a single bitmask makes it harder to see where exactly they can possibly be used since their state could also be modified using the unsuspicious job->flags = 0. Using individual names just leaves the single memset, and that is only used during initialization. To generate a diff of this commit: cvs rdiff -u -r1.204 -r1.205 src/usr.bin/make/compat.c cvs rdiff -u -r1.353 -r1.354 src/usr.bin/make/job.c cvs rdiff -u -r1.64 -r1.65 src/usr.bin/make/job.h cvs rdiff -u -r1.157 -r1.158 src/usr.bin/make/meta.c cvs rdiff -u -r1.8 -r1.9 src/usr.bin/make/meta.h cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/trace.c cvs rdiff -u -r1.8 -r1.9 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/compat.c diff -u src/usr.bin/make/compat.c:1.204 src/usr.bin/make/compat.c:1.205 --- src/usr.bin/make/compat.c:1.204 Mon Dec 7 01:35:33 2020 +++ src/usr.bin/make/compat.c Thu Dec 10 20:49:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: compat.c,v 1.204 2020/12/07 01:35:33 rillig Exp $ */ +/* $NetBSD: compat.c,v 1.205 2020/12/10 20:49:11 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.204 2020/12/07 01:35:33 rillig Exp $"); +MAKE_RCSID("$NetBSD: compat.c,v 1.205 2020/12/10 20:49:11 rillig Exp $"); static GNode *curTarg = NULL; static pid_t compatChild; @@ -409,7 +409,7 @@ Compat_RunCommand(const char *cmdp, GNod if (errCheck) { #ifdef USE_META if (useMeta) { -meta_job_error(NULL, gn, 0, status); +meta_job_error(NULL, gn, FALSE, status); } #endif gn->made = ERROR; Index: src/usr.bin/make/job.c diff -u src/usr.bin/make/job.c:1.353 src/usr.bin/make/job.c:1.354 --- src/usr.bin/make/job.c:1.353 Thu Dec 10 20:14:35 2020 +++ src/usr.bin/make/job.c Thu Dec 10 20:49:11 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.353 2020/12/10 20:14:35 rillig Exp $ */ +/* $NetBSD: job.c,v 1.354 2020/12/10 20:49:11 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.353 2020/12/10 20:14:35 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.354 2020/12/10 20:49:11 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -451,15 +451,27 @@ nfds_per_job(void) return 1; } +void +Job_FlagsToString(char *buf, size_t bufsize, const JobFlags *flags) +{ + snprintf(buf, bufsize, "%c%c%c%c", + flags->ignerr ? 'i' : '-', + flags->silent ? 's' : '-', + flags->special ? 'S' : '-', + flags->xtraced ? 'x' : '-'); +} + static void job_table_dump(const char *where) { Job *job; + char flags[5]; debug_printf("job table @ %s\n", where); for (job = job_table; job < job_table_end; job++) { - debug_printf("job %d, status %d, flags %d, pid %d\n", - (int)(job - job_table), job->status, job->flags, job->pid); + Job_FlagsToString(flags, sizeof flags, &job->flags); + debug_printf("job %d, status %d, flags %s, pid %d\n", + (int)(job - job_table), job->status, flags, job->pid); } } @@ -750,7 +762,7 @@ JobPrintln(Job *job, const char *line) static void JobPrintSpecialsErrCtl(Job *job, Boolean echo) { - if (!(job->flags & JOB_SILENT) && echo && commandShell->hasEchoCtl) { + if (!job->flags.silent && echo && commandShell->hasEchoCtl) { JobPrintln(job, commandShell->echoOff); JobPrintln(job, commandShell->errOffOrExecIgnore); JobPrintln(job, commandShell->echoOn); @@ -770,9 +782,9 @@ static void JobPrintSpecialsEchoCtl(Job *job, RunFlags *inout_runFlags, const char *escCmd, const char **inout_cmdTemplate) { - job->flags |= JOB_IGNERR; + job->flags.ignerr = TRUE; - if (!(job->flags & JOB_SILENT) && inout_runFlags->echo) { + if (!job->flags.silent && inout_runFlags->echo) { if (commandShell->hasEchoCtl) JobPrintln(job, commandShell->echoOff); JobPrintf(job, commandShell->errOnOrEcho, escCmd); @@ -871,8 +883,7 @@ JobPrintCommand(Job *job, char *cmd) escCmd = EscapeShellDblQuot(cmd); if (!runFlags.echo) { - if (!(job->flags & JOB_SILENT) && run && - commandShell->hasEchoCtl) { + if (!job->flags.silent && run && commandShell->hasEchoCtl) { JobPrintln(job, commandShell->echoOff); } else { if (commandShell->hasErrCtl) @@ -892,7 +903,7 @@ JobPrintCommand(Job *job, char *cmd) if (!commandShell->hasErrCtl && commandShell->errExit && comm
CVS commit: src/sys/dev/usb
Module Name:src Committed By: skrll Date: Thu Dec 10 20:48:33 UTC 2020 Modified Files: src/sys/dev/usb: ohci.c Log Message: Remove leading space that crept in in the last change To generate a diff of this commit: cvs rdiff -u -r1.311 -r1.312 src/sys/dev/usb/ohci.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/ohci.c diff -u src/sys/dev/usb/ohci.c:1.311 src/sys/dev/usb/ohci.c:1.312 --- src/sys/dev/usb/ohci.c:1.311 Wed Dec 9 07:10:01 2020 +++ src/sys/dev/usb/ohci.c Thu Dec 10 20:48:33 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: ohci.c,v 1.311 2020/12/09 07:10:01 skrll Exp $ */ +/* $NetBSD: ohci.c,v 1.312 2020/12/10 20:48:33 skrll Exp $ */ /* * Copyright (c) 1998, 2004, 2005, 2012, 2016, 2020 The NetBSD Foundation, Inc. @@ -42,7 +42,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.311 2020/12/09 07:10:01 skrll Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ohci.c,v 1.312 2020/12/10 20:48:33 skrll Exp $"); #ifdef _KERNEL_OPT #include "opt_usb.h" @@ -2386,7 +2386,7 @@ ohci_abortx(struct usbd_xfer *xfer) std->held = p->held; std->xfer = xfer; p->held = NULL; - } + } /* Zap headp register if hardware pointed inside the xfer. */ if (hit) { DPRINTFN(1, "set hd=0x%08jx, tl=0x%08jx", (int)p->physaddr,
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 20:14:35 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): in JobStart, negate 'noExec' to 'run' To generate a diff of this commit: cvs rdiff -u -r1.352 -r1.353 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.352 src/usr.bin/make/job.c:1.353 --- src/usr.bin/make/job.c:1.352 Thu Dec 10 20:10:03 2020 +++ src/usr.bin/make/job.c Thu Dec 10 20:14:35 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.352 2020/12/10 20:10:03 rillig Exp $ */ +/* $NetBSD: job.c,v 1.353 2020/12/10 20:14:35 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.352 2020/12/10 20:10:03 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.353 2020/12/10 20:14:35 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1517,7 +1517,7 @@ JobStart(GNode *gn, JobFlags flags) Job *job; /* new job descriptor */ char *argv[10]; /* Argument vector to shell */ Boolean cmdsOK; /* true if the nodes commands were all right */ - Boolean noExec; /* Set true if we decide not to run the job */ + Boolean run; int tfd; /* File descriptor to the temp file */ for (job = job_table; job < job_table_end; job++) { @@ -1586,7 +1586,7 @@ JobStart(GNode *gn, JobFlags flags) * Send the commands to the command file, flush all its * buffers then rewind and remove the thing. */ - noExec = FALSE; + run = TRUE; #ifdef USE_META if (useMeta) { @@ -1601,11 +1601,10 @@ JobStart(GNode *gn, JobFlags flags) /* * If we didn't print out any commands to the shell script, - * there's not much point in executing the shell, is there? + * there's no point in executing the shell. */ - if (numCommands == 0) { - noExec = TRUE; - } + if (numCommands == 0) + run = FALSE; free(tfile); } else if (!GNode_ShouldExecute(gn)) { @@ -1625,7 +1624,7 @@ JobStart(GNode *gn, JobFlags flags) if (cmdsOK) JobPrintCommands(job); /* Don't execute the shell, thank you. */ - noExec = TRUE; + run = FALSE; } else { /* * Just touch the target and note that no shell should be @@ -1635,13 +1634,13 @@ JobStart(GNode *gn, JobFlags flags) */ job->cmdFILE = stdout; Job_Touch(gn, (job->flags & JOB_SILENT) != 0); - noExec = TRUE; + run = FALSE; } /* Just in case it isn't already... */ (void)fflush(job->cmdFILE); /* If we're not supposed to execute a shell, don't. */ - if (noExec) { + if (!run) { if (!(job->flags & JOB_SPECIAL)) Job_TokenReturn(); /* Unlink and close the command file if we opened one */
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Thu Dec 10 20:10:03 UTC 2020 Modified Files: src/usr.bin/make: job.c Log Message: make(1): fix theoretical type mismatch for Job_Touch To generate a diff of this commit: cvs rdiff -u -r1.351 -r1.352 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.351 src/usr.bin/make/job.c:1.352 --- src/usr.bin/make/job.c:1.351 Tue Dec 8 21:34:49 2020 +++ src/usr.bin/make/job.c Thu Dec 10 20:10:03 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: job.c,v 1.351 2020/12/08 21:34:49 rillig Exp $ */ +/* $NetBSD: job.c,v 1.352 2020/12/10 20:10:03 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.351 2020/12/08 21:34:49 rillig Exp $"); +MAKE_RCSID("$NetBSD: job.c,v 1.352 2020/12/10 20:10:03 rillig Exp $"); /* * A shell defines how the commands are run. All commands for a target are @@ -1634,7 +1634,7 @@ JobStart(GNode *gn, JobFlags flags) * good -- it does no harm to keep working up the graph. */ job->cmdFILE = stdout; - Job_Touch(gn, job->flags & JOB_SILENT); + Job_Touch(gn, (job->flags & JOB_SILENT) != 0); noExec = TRUE; } /* Just in case it isn't already... */
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Thu Dec 10 17:55:30 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: sh-flags.exp sh-flags.mk Log Message: make(1): fix test for command flags The "false" is supposed to be run not only if the command has the '-' flag, but also if the target is marked as .IGNORE or if the command line option -i is given. After the failed command, the remaining commands are skipped, therefore the final echo for the empty line had to be moved up, at the beginning of the target. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/sh-flags.exp \ 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.exp diff -u src/usr.bin/make/unit-tests/sh-flags.exp:1.1 src/usr.bin/make/unit-tests/sh-flags.exp:1.2 --- src/usr.bin/make/unit-tests/sh-flags.exp:1.1 Thu Dec 10 17:06:13 2020 +++ src/usr.bin/make/unit-tests/sh-flags.exp Thu Dec 10 17:55:30 2020 @@ -1,3 +1,4 @@ + opt-__-tgt-___-cmd-___ echo running running @@ -59,11 +60,13 @@ running *** Error code 1 (ignored) opt-__-tgt-_i_-cmd-___ -echo running +echo running; false running +*** Error code 1 (ignored) opt-__-tgt-_i_-cmd-__s running +*** Error code 1 (ignored) opt-__-tgt-_i_-cmd-_i_ echo running; false @@ -75,11 +78,13 @@ running *** Error code 1 (ignored) opt-__-tgt-_i_-cmd-a__ -echo running +echo running; false running +*** Error code 1 (ignored) opt-__-tgt-_i_-cmd-a_s running +*** Error code 1 (ignored) opt-__-tgt-_i_-cmd-ai_ echo running; false @@ -92,9 +97,11 @@ running opt-__-tgt-_is-cmd-___ running +*** Error code 1 (ignored) opt-__-tgt-_is-cmd-__s running +*** Error code 1 (ignored) opt-__-tgt-_is-cmd-_i_ running @@ -106,9 +113,11 @@ running opt-__-tgt-_is-cmd-a__ running +*** Error code 1 (ignored) opt-__-tgt-_is-cmd-a_s running +*** Error code 1 (ignored) opt-__-tgt-_is-cmd-ai_ running @@ -179,11 +188,13 @@ running *** Error code 1 (ignored) opt-__-tgt-ai_-cmd-___ -echo running +echo running; false running +*** Error code 1 (ignored) opt-__-tgt-ai_-cmd-__s running +*** Error code 1 (ignored) opt-__-tgt-ai_-cmd-_i_ echo running; false @@ -195,11 +206,13 @@ running *** Error code 1 (ignored) opt-__-tgt-ai_-cmd-a__ -echo running +echo running; false running +*** Error code 1 (ignored) opt-__-tgt-ai_-cmd-a_s running +*** Error code 1 (ignored) opt-__-tgt-ai_-cmd-ai_ echo running; false @@ -212,9 +225,11 @@ running opt-__-tgt-ais-cmd-___ running +*** Error code 1 (ignored) opt-__-tgt-ais-cmd-__s running +*** Error code 1 (ignored) opt-__-tgt-ais-cmd-_i_ running @@ -226,9 +241,11 @@ running opt-__-tgt-ais-cmd-a__ running +*** Error code 1 (ignored) opt-__-tgt-ais-cmd-a_s running +*** Error code 1 (ignored) opt-__-tgt-ais-cmd-ai_ running @@ -296,9 +313,11 @@ running opt-s_-tgt-_i_-cmd-___ running +*** Error code 1 (ignored) opt-s_-tgt-_i_-cmd-__s running +*** Error code 1 (ignored) opt-s_-tgt-_i_-cmd-_i_ running @@ -310,9 +329,11 @@ running opt-s_-tgt-_i_-cmd-a__ running +*** Error code 1 (ignored) opt-s_-tgt-_i_-cmd-a_s running +*** Error code 1 (ignored) opt-s_-tgt-_i_-cmd-ai_ running @@ -324,9 +345,11 @@ running opt-s_-tgt-_is-cmd-___ running +*** Error code 1 (ignored) opt-s_-tgt-_is-cmd-__s running +*** Error code 1 (ignored) opt-s_-tgt-_is-cmd-_i_ running @@ -338,9 +361,11 @@ running opt-s_-tgt-_is-cmd-a__ running +*** Error code 1 (ignored) opt-s_-tgt-_is-cmd-a_s running +*** Error code 1 (ignored) opt-s_-tgt-_is-cmd-ai_ running @@ -408,9 +433,11 @@ running opt-s_-tgt-ai_-cmd-___ running +*** Error code 1 (ignored) opt-s_-tgt-ai_-cmd-__s running +*** Error code 1 (ignored) opt-s_-tgt-ai_-cmd-_i_ running @@ -422,9 +449,11 @@ running opt-s_-tgt-ai_-cmd-a__ running +*** Error code 1 (ignored) opt-s_-tgt-ai_-cmd-a_s running +*** Error code 1 (ignored) opt-s_-tgt-ai_-cmd-ai_ running @@ -436,9 +465,11 @@ running opt-s_-tgt-ais-cmd-___ running +*** Error code 1 (ignored) opt-s_-tgt-ais-cmd-__s running +*** Error code 1 (ignored) opt-s_-tgt-ais-cmd-_i_ running @@ -450,9 +481,11 @@ running opt-s_-tgt-ais-cmd-a__ running +*** Error code 1 (ignored) opt-s_-tgt-ais-cmd-a_s running +*** Error code 1 (ignored) opt-s_-tgt-ais-cmd-ai_ running @@ -523,10 +556,10 @@ running *** Error code 1 (ignored) opt-___n__-tgt-_i_-cmd-___ -echo running +echo running; false opt-___n__-tgt-_i_-cmd-__s -echo running +echo running; false opt-___n__-tgt-_i_-cmd-_i_ echo running; false @@ -535,12 +568,14 @@ opt-___n__-tgt-_i_-cmd-_is ec
CVS commit: src
Module Name:src Committed By: rillig Date: Thu Dec 10 17:06:13 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-flags.exp sh-flags.mk Log Message: make(1): test all combinations of switches for running commands The code in JobPrintSpecials is rather complicated and contains surprising interaction between some of the switches. To see the exact effects of the switches, record the current state and its output, to prevent accidental breakage during the upcoming refactorings. To generate a diff of this commit: cvs rdiff -u -r1.987 -r1.988 src/distrib/sets/lists/tests/mi cvs rdiff -u -r1.243 -r1.244 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r0 -r1.1 src/usr.bin/make/unit-tests/sh-flags.exp \ 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/distrib/sets/lists/tests/mi diff -u src/distrib/sets/lists/tests/mi:1.987 src/distrib/sets/lists/tests/mi:1.988 --- src/distrib/sets/lists/tests/mi:1.987 Wed Dec 9 07:57:51 2020 +++ src/distrib/sets/lists/tests/mi Thu Dec 10 17:06:13 2020 @@ -1,4 +1,4 @@ -# $NetBSD: mi,v 1.987 2020/12/09 07:57:51 rillig Exp $ +# $NetBSD: mi,v 1.988 2020/12/10 17:06:13 rillig Exp $ # # Note: don't delete entries from here - mark them as "obsolete" instead. # @@ -5273,6 +5273,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-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 ./usr/tests/usr.bin/make/unit-tests/sh-jobs-error.mktests-usr.bin-tests compattestfile,atf ./usr/tests/usr.bin/make/unit-tests/sh-jobs.exp tests-usr.bin-tests compattestfile,atf Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.243 src/usr.bin/make/unit-tests/Makefile:1.244 --- src/usr.bin/make/unit-tests/Makefile:1.243 Wed Dec 9 08:18:35 2020 +++ src/usr.bin/make/unit-tests/Makefile Thu Dec 10 17:06:13 2020 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.243 2020/12/09 08:18:35 rillig Exp $ +# $NetBSD: Makefile,v 1.244 2020/12/10 17:06:13 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-flags TESTS+= sh-jobs TESTS+= sh-jobs-error TESTS+= sh-leading-at @@ -483,6 +484,7 @@ SED_CMDS.sh-dots= -e 's,^.*\.\.\.:.*,,' SED_CMDS.sh-dots+= -e 's,^\(\*\*\* Error code \)[1-9][0-9]*,\1,' +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} SED_CMDS.suff-transform-debug+= ${STD_SED_CMDS.dg1} Added files: Index: src/usr.bin/make/unit-tests/sh-flags.exp diff -u /dev/null src/usr.bin/make/unit-tests/sh-flags.exp:1.1 --- /dev/null Thu Dec 10 17:06:13 2020 +++ src/usr.bin/make/unit-tests/sh-flags.exp Thu Dec 10 17:06:13 2020 @@ -0,0 +1,7637 @@ +opt-__-tgt-___-cmd-___ +echo running +running + +opt-__-tgt-___-cmd-__s +running + +opt-__-tgt-___-cmd-_i_ +echo running; false +running +*** Error code 1 (ignored) + +opt-__-tgt-___-cmd-_is +running +*** Error code 1 (ignored) + +opt-__-tgt-___-cmd-a__ +echo running +running + +opt-__-tgt-___-cmd-a_s +running + +opt-__-tgt-___-cmd-ai_ +echo running; false +running +*** Error code 1 (ignored) + +opt-__-tgt-___-cmd-ais +running +*** Error code 1 (ignored) + +opt-__-tgt-__s-cmd-___ +running + +opt-__-tgt-__s-cmd-__s +running + +opt-__-tgt-__s-cmd-_i_ +running +*** Error code 1 (ignored) + +opt-__-tgt-__s-cmd-_is +running +*** Error code 1 (ignored) + +opt-__-tgt-__s-cmd-a__ +running + +opt-__-tgt-__s-cmd-a_s +running + +opt-__-tgt-__s-cmd-ai_ +running +*** Error code 1 (ignored) + +opt-__-tgt-__s-cmd-ais +running +*** Error code 1 (ignored) + +opt-__-tgt-_i_-cmd-___ +echo running +running + +opt-__-tgt-_i_-cmd-__s +running + +opt-__-tgt-_i_-cmd-_i_ +echo running; false +running +*** Error code 1 (ignored) + +opt-__-tgt-_i_-cmd-_is +running +*** Error code 1 (ignored) + +opt-__-tgt-_i_-cmd-a__ +echo running +running + +opt-__-tgt-_i_-cmd-a_s +running + +opt-__-tgt-_i_-cmd-ai_ +echo running; false +running +*** Error code 1 (ignored) + +opt-__-tgt-_i_-cmd-ais +running +*** Error code 1 (ignored) + +opt-__-tgt-_is-cmd-___ +running + +opt-__-tgt-_is-cmd-__s +running + +opt-__-tgt-_is-cmd-_i_ +running +*
CVS commit: src/sys/dev/i2c
Module Name:src Committed By: jdc Date: Thu Dec 10 17:02:51 UTC 2020 Modified Files: src/sys/dev/i2c: adm1021.c Log Message: Handle failing to acquire the iic bus. Better handle errors when attaching sysmon sensors. To generate a diff of this commit: cvs rdiff -u -r1.20 -r1.21 src/sys/dev/i2c/adm1021.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/i2c/adm1021.c diff -u src/sys/dev/i2c/adm1021.c:1.20 src/sys/dev/i2c/adm1021.c:1.21 --- src/sys/dev/i2c/adm1021.c:1.20 Fri Aug 21 20:44:38 2020 +++ src/sys/dev/i2c/adm1021.c Thu Dec 10 17:02:51 2020 @@ -1,4 +1,4 @@ -/* $NetBSD: adm1021.c,v 1.20 2020/08/21 20:44:38 macallan Exp $ */ +/* $NetBSD: adm1021.c,v 1.21 2020/12/10 17:02:51 jdc Exp $ */ /* $OpenBSD: adm1021.c,v 1.27 2007/06/24 05:34:35 dlg Exp $ */ /* @@ -38,7 +38,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.20 2020/08/21 20:44:38 macallan Exp $"); +__KERNEL_RCSID(0, "$NetBSD: adm1021.c,v 1.21 2020/12/10 17:02:51 jdc Exp $"); #include #include @@ -396,6 +396,7 @@ admtemp_attach(device_t parent, device_t if (sysmon_envsys_sensor_attach( sc->sc_sme, &sc->sc_sensor[ADMTEMP_INT])) { sysmon_envsys_destroy(sc->sc_sme); + sc->sc_sme = NULL; aprint_error_dev(self, "unable to attach internal at sysmon\n"); return; @@ -404,6 +405,7 @@ admtemp_attach(device_t parent, device_t sysmon_envsys_sensor_attach( sc->sc_sme, &sc->sc_sensor[ADMTEMP_EXT])) { sysmon_envsys_destroy(sc->sc_sme); + sc->sc_sme = NULL; aprint_error_dev(self, "unable to attach external at sysmon\n"); return; @@ -425,6 +427,7 @@ admtemp_attach(device_t parent, device_t aprint_error_dev(self, "unable to register with sysmon\n"); sysmon_envsys_destroy(sc->sc_sme); + sc->sc_sme = NULL; return; } } @@ -437,7 +440,10 @@ admtemp_refresh(struct sysmon_envsys *sm uint8_t cmd, xdata; int8_t sdata; - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) { + edata->state = ENVSYS_SINVALID; + return; + } if (edata->sensor == ADMTEMP_INT) cmd = ADM1021_INT_TEMP; @@ -472,7 +478,8 @@ admtemp_getlim_1021(struct sysmon_envsys *props &= ~(PROP_CRITMAX | PROP_CRITMIN); - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return; if (edata->sensor == ADMTEMP_INT) cmd = ADM1021_INT_HIGH_READ; @@ -521,7 +528,8 @@ admtemp_getlim_1023(struct sysmon_envsys *props &= ~(PROP_CRITMAX | PROP_CRITMIN); - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return; if (edata->sensor == ADMTEMP_INT) cmd = ADM1021_INT_HIGH_READ; @@ -585,7 +593,8 @@ admtemp_getlim_1032(struct sysmon_envsys *props &= ~(PROP_WARNMAX | PROP_CRITMAX | PROP_WARNMIN); - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return; if (edata->sensor == ADMTEMP_INT) cmd = ADM1032_INT_THERM; @@ -660,7 +669,8 @@ admtemp_setlim_1021(struct sysmon_envsys int tmp; int8_t sdata; - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return; if (*props & PROP_CRITMAX) { if (edata->sensor == ADMTEMP_INT) @@ -746,7 +756,8 @@ admtemp_setlim_1023(struct sysmon_envsys else ext11 = 1; - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return; if (*props & PROP_CRITMAX) { if (edata->sensor == ADMTEMP_INT) @@ -803,7 +814,8 @@ admtemp_setlim_1032(struct sysmon_envsys else ext11 = 1; - iic_acquire_bus(sc->sc_tag, 0); + if (iic_acquire_bus(sc->sc_tag, 0)) + return; if (*props & PROP_CRITMAX) { if (edata->sensor == ADMTEMP_INT)
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Thu Dec 10 16:47:42 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-ifelse.mk Log Message: make(1): document limitations of deferred '$' in ':?' modifier To generate a diff of this commit: cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/varmod-ifelse.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/varmod-ifelse.mk diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.7 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.8 --- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.7 Thu Dec 10 16:36:47 2020 +++ src/usr.bin/make/unit-tests/varmod-ifelse.mk Thu Dec 10 16:47:42 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-ifelse.mk,v 1.7 2020/12/10 16:36:47 rillig Exp $ +# $NetBSD: varmod-ifelse.mk,v 1.8 2020/12/10 16:47:42 rillig Exp $ # # Tests for the ${cond:?then:else} variable modifier, which evaluates either # the then-expression or the else-expression, depending on the condition. @@ -99,6 +99,11 @@ COND:= ${${UNDEF} == "":?bad-assign:bad- # the '$' of the intended '${VAR}' escapes from the parser in form of the # expression ${:U\$}. Because of this escaping, the variable "name" and thus # the condition ends up as "${VAR} == value", just as intended. +# +# This hack does not work for variables from .for loops since these are +# expanded at parse time to their corresponding ${:Uvalue} expressions. +# Making the '$' of the '${VAR}' expression indirect hides this expression +# from the parser of the .for loop body. See SubstVarLong. .MAKEFLAGS: -dc VAR= value .if ${ ${:U\$}{VAR} == value :?ok:bad} != "ok"
CVS commit: src/usr.bin/make/unit-tests
Module Name:src Committed By: rillig Date: Thu Dec 10 16:36:47 UTC 2020 Modified Files: src/usr.bin/make/unit-tests: varmod-ifelse.exp varmod-ifelse.mk Log Message: make(1): add test demonstrating how to defer evaluation in :? modifier To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/varmod-ifelse.exp cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/varmod-ifelse.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/varmod-ifelse.exp diff -u src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.4 src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.5 --- src/usr.bin/make/unit-tests/varmod-ifelse.exp:1.4 Thu Nov 12 00:29:55 2020 +++ src/usr.bin/make/unit-tests/varmod-ifelse.exp Thu Dec 10 16:36:47 2020 @@ -11,6 +11,10 @@ lhs = 1.00, rhs = 0.00, op = == make: Bad conditional expression `1 == == 2' in 1 == == 2?yes:no lhs = "", rhs = "", op = != make: "varmod-ifelse.mk" line 92: warning: Oops, the parse error should have been propagated. +CondParser_Eval: ${ ${:U\$}{VAR} == value :?ok:bad} != "ok" +CondParser_Eval: ${VAR} == value +lhs = "value", rhs = "value", op = == +lhs = "ok", rhs = "ok", op = != make: Fatal errors encountered -- cannot continue make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/varmod-ifelse.mk diff -u src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.6 src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.7 --- src/usr.bin/make/unit-tests/varmod-ifelse.mk:1.6 Thu Nov 12 00:29:55 2020 +++ src/usr.bin/make/unit-tests/varmod-ifelse.mk Thu Dec 10 16:36:47 2020 @@ -1,4 +1,4 @@ -# $NetBSD: varmod-ifelse.mk,v 1.6 2020/11/12 00:29:55 rillig Exp $ +# $NetBSD: varmod-ifelse.mk,v 1.7 2020/12/10 16:36:47 rillig Exp $ # # Tests for the ${cond:?then:else} variable modifier, which evaluates either # the then-expression or the else-expression, depending on the condition. @@ -93,5 +93,18 @@ COND:= ${${UNDEF} == "":?bad-assign:bad- .endif .MAKEFLAGS: -d0 +# As of 2020-12-10, the variable "name" is first expanded, and the result of +# this expansion is then taken as the condition. To force the variable +# expression in the condition to be evaluated at exactly the right point, +# the '$' of the intended '${VAR}' escapes from the parser in form of the +# expression ${:U\$}. Because of this escaping, the variable "name" and thus +# the condition ends up as "${VAR} == value", just as intended. +.MAKEFLAGS: -dc +VAR= value +.if ${ ${:U\$}{VAR} == value :?ok:bad} != "ok" +. error +.endif +.MAKEFLAGS: -d0 + all: @:;
CVS commit: src/external/gpl3/gdb/dist/gdb
Module Name:src Committed By: martin Date: Thu Dec 10 16:07:26 UTC 2020 Modified Files: src/external/gpl3/gdb/dist/gdb: sh-nbsd-tdep.c Log Message: Avoid an unused variable (breaking the build) To generate a diff of this commit: cvs rdiff -u -r1.10 -r1.11 src/external/gpl3/gdb/dist/gdb/sh-nbsd-tdep.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/gpl3/gdb/dist/gdb/sh-nbsd-tdep.c diff -u src/external/gpl3/gdb/dist/gdb/sh-nbsd-tdep.c:1.10 src/external/gpl3/gdb/dist/gdb/sh-nbsd-tdep.c:1.11 --- src/external/gpl3/gdb/dist/gdb/sh-nbsd-tdep.c:1.10 Sun Dec 6 04:08:51 2020 +++ src/external/gpl3/gdb/dist/gdb/sh-nbsd-tdep.c Thu Dec 10 16:07:26 2020 @@ -170,7 +170,7 @@ shnbsd_sigtramp_cache_init (const struct CORE_ADDR func) { struct gdbarch *gdbarch = get_frame_arch (next_frame); - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + // struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); int sp_regnum = gdbarch_sp_regnum (gdbarch); CORE_ADDR sp = get_frame_register_unsigned (next_frame, sp_regnum); CORE_ADDR base;
CVS commit: src/tests/sbin/ifconfig
Module Name:src Committed By: mrg Date: Thu Dec 10 08:16:59 UTC 2020 Modified Files: src/tests/sbin/ifconfig: t_repeated_mtu.sh t_repeated_scan.sh Log Message: apply this change to a a couple more tests: --- date: 2020-07-27 09:57:44 -0700; author: gson; state: Exp; lines: +6 -1; commitid: m3HouRBlhyJQVJhC; Skip the repeated_link_addr test by default as it causes the evbarm-aarch64 testbed to hang (PR port-evbarm/55521), and will not be safe to run by default even after that bug is fixed, for similar reasons as t_repeated_updown. --- t_repeated_mtu.sh changes the MTU, which may cause NFS to fail. if you have NFS root, this is system killing. t_repeated_scan.sh kills and restarts both hostapd and wpa_supplicant. To generate a diff of this commit: cvs rdiff -u -r1.1 -r1.2 src/tests/sbin/ifconfig/t_repeated_mtu.sh cvs rdiff -u -r1.5 -r1.6 src/tests/sbin/ifconfig/t_repeated_scan.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/sbin/ifconfig/t_repeated_mtu.sh diff -u src/tests/sbin/ifconfig/t_repeated_mtu.sh:1.1 src/tests/sbin/ifconfig/t_repeated_mtu.sh:1.2 --- src/tests/sbin/ifconfig/t_repeated_mtu.sh:1.1 Tue Jun 30 11:48:20 2020 +++ src/tests/sbin/ifconfig/t_repeated_mtu.sh Thu Dec 10 08:16:59 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_repeated_mtu.sh,v 1.1 2020/06/30 11:48:20 jruoho Exp $ +# $NetBSD: t_repeated_mtu.sh,v 1.2 2020/12/10 08:16:59 mrg Exp $ # # Copyright (c) 2020 The NetBSD Foundation, Inc. # All rights reserved. @@ -36,6 +36,11 @@ repeated_mtu_head() { repeated_mtu_body() { + if ! [ $(atf_config_get "run_unsafe" "no") = "yes" ] + then + atf_skip "can disrupt networking; also PR port-evbarm/55521" + fi + # This sequence covers both valid and invalid MTUs; we are # only interested in testing that the system does not hang. # Index: src/tests/sbin/ifconfig/t_repeated_scan.sh diff -u src/tests/sbin/ifconfig/t_repeated_scan.sh:1.5 src/tests/sbin/ifconfig/t_repeated_scan.sh:1.6 --- src/tests/sbin/ifconfig/t_repeated_scan.sh:1.5 Sat Jun 27 04:15:17 2020 +++ src/tests/sbin/ifconfig/t_repeated_scan.sh Thu Dec 10 08:16:59 2020 @@ -1,4 +1,4 @@ -# $NetBSD: t_repeated_scan.sh,v 1.5 2020/06/27 04:15:17 jruoho Exp $ +# $NetBSD: t_repeated_scan.sh,v 1.6 2020/12/10 08:16:59 mrg Exp $ # # Copyright (c) 2020 The NetBSD Foundation, Inc. # All rights reserved. @@ -36,6 +36,11 @@ repeated_scan_head() { repeated_scan_body() { + if ! [ $(atf_config_get "run_unsafe" "no") = "yes" ] + then + atf_skip "can disrupt networking; also PR port-evbarm/55521" + fi + # Even though this should amount to a "few minutes", # try to still avoid stalling any automated test runs. #