Re: null-terminated vs. nul-terminated
Taylor R Campbell writes: >> Date: Sat, 26 Mar 2022 16:53:19 +0100 >> From: Roland Illig >> >> The term "null-terminated string" is quite common when talking about C. >> In contrast, the word "nul" in "nul-terminated" always reminds me of >> the character abbreviation in ASCII, which has a narrower scope than C. >> I prefer to keep "null-terminated" here. > > I feel like I've usually seen it as NUL-terminated. I thought it was > in /usr/share/misc/style but I must have been thinking of a different > style guide. > > `NUL' is better than `null' or `NULL' here because it's not a null > pointer, unlike, e.g., the execve argv terminator. Even if the string > isn't US-ASCII, what character encoding calls a nonzero byte `NUL'? > > `NUL' is better than `zero' or `0' here because it's unambiguously the > all-bits-zero byte, not the US-ASCII encoding of `0' (i.e., decimal 48 > or 0x30). For background I'm a native en_US speaker whose second computer language was K&R C from the pre-ANSI edition. There are three separate concepts. NULLRefers to a pointer, never to a character NUL ASCII codepoint, 7 zero bits, and 8 zero bits when stored in an 8-bit byte. NUL is never properly written nul; the ASCII codepoints are upper case in formal usage. nullAn English word that can mean various things, including null pointer => NULL null character => NUL in ASCII null character => 0 in something else, theoretically maybe, but C just cannot deal with a character set that uses 0 to represent something that gets used in strings. So one can talk about a "null-terminated string" implying "null character" which means NUL, and one could also write "NUL-terminated string". I find the from NUL-terminated to be artificial. I perceive "nul-terminated" as an error due to the lower case nul. signature.asc Description: PGP signature
CVS commit: src/lib/libc/gen
Module Name:src Committed By: gutteridge Date: Sun Mar 27 00:32:15 UTC 2022 Modified Files: src/lib/libc/gen: popen.3 Log Message: popen.3: revert s/null-/nul-/ change, this is subject to debate To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/popen.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libc/gen/popen.3 diff -u src/lib/libc/gen/popen.3:1.23 src/lib/libc/gen/popen.3:1.24 --- src/lib/libc/gen/popen.3:1.23 Thu Mar 24 01:55:15 2022 +++ src/lib/libc/gen/popen.3 Sun Mar 27 00:32:15 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: popen.3,v 1.23 2022/03/24 01:55:15 gutteridge Exp $ +.\" $NetBSD: popen.3,v 1.24 2022/03/27 00:32:15 gutteridge Exp $ .\" .\" Copyright (c) 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -71,7 +71,7 @@ is now implemented using sockets, the may request a bidirectional data flow. The .Fa type -argument is a pointer to a nul-terminated string +argument is a pointer to a null-terminated string which must be .Ql r for reading, @@ -88,7 +88,7 @@ string, the file descriptor used interna .Pp The .Fa command -argument is a pointer to a nul-terminated string +argument is a pointer to a null-terminated string containing a shell command line. This command is passed to .Pa /bin/sh
CVS commit: src/lib/libc/gen
Module Name:src Committed By: gutteridge Date: Sun Mar 27 00:32:15 UTC 2022 Modified Files: src/lib/libc/gen: popen.3 Log Message: popen.3: revert s/null-/nul-/ change, this is subject to debate To generate a diff of this commit: cvs rdiff -u -r1.23 -r1.24 src/lib/libc/gen/popen.3 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/arch/mips/cavium
Module Name:src Committed By: riastradh Date: Sat Mar 26 19:38:00 UTC 2022 Modified Files: src/sys/arch/mips/cavium: octeon_intr.c Log Message: mips/cavium: Simplify membars around interrupt establishment. Previously I used xc_barrier to ensure the initialization of the struct octeon_intrhand was witnessed on all CPUs before publishing it, in order to avoid needing any barrier on the usage side to be issued by the interrupt handler. But there's no need to avoid atomic_load_consume at time of interrupt: on MIPS it's the same as atomic_load_relaxed anyway, so there's no additional memory barrier cost here. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/cavium/octeon_intr.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/mips/cavium/octeon_intr.c diff -u src/sys/arch/mips/cavium/octeon_intr.c:1.25 src/sys/arch/mips/cavium/octeon_intr.c:1.26 --- src/sys/arch/mips/cavium/octeon_intr.c:1.25 Wed Mar 23 23:24:21 2022 +++ src/sys/arch/mips/cavium/octeon_intr.c Sat Mar 26 19:38:00 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: octeon_intr.c,v 1.25 2022/03/23 23:24:21 riastradh Exp $ */ +/* $NetBSD: octeon_intr.c,v 1.26 2022/03/26 19:38:00 riastradh Exp $ */ /* * Copyright 2001, 2002 Wasabi Systems, Inc. * All rights reserved. @@ -44,7 +44,7 @@ #define __INTR_PRIVATE #include -__KERNEL_RCSID(0, "$NetBSD: octeon_intr.c,v 1.25 2022/03/23 23:24:21 riastradh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: octeon_intr.c,v 1.26 2022/03/26 19:38:00 riastradh Exp $"); #include #include @@ -354,14 +354,6 @@ octeon_intr_establish(int irq, int ipl, ih->ih_irq = irq; ih->ih_ipl = ipl; - /* - * Make sure the initialization is visible on all CPUs before - * we expose it in octciu_intrs. This way we don't need to - * issue any membar for a load-acquire when handling the - * interrupt. - */ - xc_barrier(0); - mutex_enter(&octeon_intr_lock); /* @@ -370,7 +362,7 @@ octeon_intr_establish(int irq, int ipl, KASSERTMSG(octciu_intrs[irq] == NULL, "irq %d in use! (%p)", irq, octciu_intrs[irq]); - atomic_store_relaxed(&octciu_intrs[irq], ih); + atomic_store_release(&octciu_intrs[irq], ih); /* * Now enable it. @@ -518,7 +510,7 @@ octeon_iointr(int ipl, vaddr_t pc, uint3 hwpend[bank] &= ~__BIT(bit); struct octeon_intrhand * const ih = - atomic_load_relaxed(&octciu_intrs[irq]); + atomic_load_consume(&octciu_intrs[irq]); cpu->cpu_intr_evs[irq].ev_count++; if (__predict_true(ih != NULL)) { #ifdef MULTIPROCESSOR
CVS commit: src/sys/arch/mips/cavium
Module Name:src Committed By: riastradh Date: Sat Mar 26 19:38:00 UTC 2022 Modified Files: src/sys/arch/mips/cavium: octeon_intr.c Log Message: mips/cavium: Simplify membars around interrupt establishment. Previously I used xc_barrier to ensure the initialization of the struct octeon_intrhand was witnessed on all CPUs before publishing it, in order to avoid needing any barrier on the usage side to be issued by the interrupt handler. But there's no need to avoid atomic_load_consume at time of interrupt: on MIPS it's the same as atomic_load_relaxed anyway, so there's no additional memory barrier cost here. To generate a diff of this commit: cvs rdiff -u -r1.25 -r1.26 src/sys/arch/mips/cavium/octeon_intr.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Sat Mar 26 19:35:57 UTC 2022 Modified Files: src/sys/dev/ic: igpio.c Log Message: igpio(4): Use device_xname, not struct device members. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/igpio.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/ic/igpio.c diff -u src/sys/dev/ic/igpio.c:1.3 src/sys/dev/ic/igpio.c:1.4 --- src/sys/dev/ic/igpio.c:1.3 Sat Mar 26 19:35:35 2022 +++ src/sys/dev/ic/igpio.c Sat Mar 26 19:35:56 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: igpio.c,v 1.3 2022/03/26 19:35:35 riastradh Exp $ */ +/* $NetBSD: igpio.c,v 1.4 2022/03/26 19:35:56 riastradh Exp $ */ /* * Copyright (c) 2021,2022 Emmanuel Dreyfus @@ -724,7 +724,7 @@ igpio_intr_str(void *priv, int pin, int char *buf, size_t buflen) { struct igpio_softc *sc = priv; - const char *name = sc->sc_dev->dv_xname; + const char *name = device_xname(sc->sc_dev); int rv; rv = snprintf(buf, buflen, "%s pin %d", name, pin);
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Sat Mar 26 19:35:57 UTC 2022 Modified Files: src/sys/dev/ic: igpio.c Log Message: igpio(4): Use device_xname, not struct device members. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 src/sys/dev/ic/igpio.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Sat Mar 26 19:35:35 UTC 2022 Modified Files: src/sys/dev/ic: igpio.c igpioreg.h Log Message: igpio(4): Nix trailing whitespace. (setq show-trailing-whitespace t), M-x delete-trailing-whitespace To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/igpio.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/igpioreg.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/ic/igpio.c diff -u src/sys/dev/ic/igpio.c:1.2 src/sys/dev/ic/igpio.c:1.3 --- src/sys/dev/ic/igpio.c:1.2 Thu Mar 24 08:08:05 2022 +++ src/sys/dev/ic/igpio.c Sat Mar 26 19:35:35 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: igpio.c,v 1.2 2022/03/24 08:08:05 andvar Exp $ */ +/* $NetBSD: igpio.c,v 1.3 2022/03/26 19:35:35 riastradh Exp $ */ /* * Copyright (c) 2021,2022 Emmanuel Dreyfus @@ -75,11 +75,11 @@ igpio_padcfg0_print(uint32_t val, int id char *buf = (idx % 2) ? &buf0[0] : &buf1[0]; size_t len = sizeof(buf0) - 1; size_t wr = 0; - uint32_t unknown_bits = + uint32_t unknown_bits = __BITS(3,7)|__BITS(14,16)|__BITS(21,22)|__BITS(27,31); int b; - rxev = + rxev = (val & IGPIO_PADCFG0_RXEVCFG_MASK) >> IGPIO_PADCFG0_RXEVCFG_SHIFT; wr += snprintf(buf + wr, len - wr, "rxev "); switch (rxev) { @@ -122,7 +122,7 @@ igpio_padcfg0_print(uint32_t val, int id wr += snprintf(buf + wr, len - wr, " nmi"); } - pmode = + pmode = (val & IGPIO_PADCFG0_PMODE_MASK) >> IGPIO_PADCFG0_PMODE_SHIFT; switch (pmode) { case IGPIO_PADCFG0_PMODE_GPIO: @@ -208,7 +208,7 @@ igpio_hexdump(struct igpio_softc *sc, in size_t len = MIN(sc->sc_length[n], 2048); printf("bar %d\n", n); - for (j = 0; j < len; j += 16) { + for (j = 0; j < len; j += 16) { printf("%04x ", j); for (i = 0; i < 16 && i + j < len; i++) { v = bus_space_read_1(sc->sc_bst, sc->sc_bsh[n], i + j); @@ -227,7 +227,7 @@ igpio_attach(struct igpio_softc *sc) struct gpiobus_attach_args gba; int success = 0; - sc->sc_banks = + sc->sc_banks = kmem_zalloc(sizeof(*sc->sc_banks) * sc->sc_nbar, KM_SLEEP); sc->sc_npins = 0; @@ -310,7 +310,7 @@ igpio_attach(struct igpio_softc *sc) printf("Missing BAR %d\n", i); goto out; } - + ibs = ib->ib_setup; DPRINTF(("setup[%d] = " @@ -319,7 +319,7 @@ igpio_attach(struct igpio_softc *sc) npins = 1 + ibs->ibs_last_pin - ibs->ibs_first_pin; - ib->ib_intr = + ib->ib_intr = kmem_zalloc(sizeof(*ib->ib_intr) * npins, KM_SLEEP); sc->sc_npins += npins; @@ -330,14 +330,14 @@ igpio_attach(struct igpio_softc *sc) goto out; } - sc->sc_pins = + sc->sc_pins = kmem_zalloc(sizeof(*sc->sc_pins) * sc->sc_npins, KM_SLEEP); for (j = 0; j < sc->sc_npins; j++) { sc->sc_pins[j].pin_num = j; sc->sc_pins[j].pin_caps = GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | GPIO_PIN_INOUT | - GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN | GPIO_PIN_INVIN; + GPIO_PIN_PULLUP | GPIO_PIN_PULLDOWN | GPIO_PIN_INVIN; sc->sc_pins[j].pin_intrcaps = GPIO_INTR_POS_EDGE | GPIO_INTR_NEG_EDGE | GPIO_INTR_DOUBLE_EDGE | GPIO_INTR_HIGH_LEVEL | @@ -366,7 +366,7 @@ igpio_attach(struct igpio_softc *sc) out: if (!success) igpio_detach(sc); - + return; } @@ -385,7 +385,7 @@ igpio_detach(struct igpio_softc *sc) ib->ib_intr = NULL; } } - + if (sc->sc_pins != NULL) { kmem_free(sc->sc_pins, sizeof(*sc->sc_pins) * sc->sc_npins); sc->sc_pins = NULL; @@ -403,7 +403,7 @@ static bus_addr_t igpio_pincfg(struct igpio_bank *ib, int pin, int reg) { int nregs = (ib->ib_cap & IGPIO_PINCTRL_FEATURE_DEBOUNCE) ? 4 : 2; - bus_addr_t pincfg; + bus_addr_t pincfg; pincfg = ib->ib_padbar + reg + (pin * nregs * 4); #if 0 @@ -450,10 +450,10 @@ igpio_groupcfg(struct igpio_bank *ib, in if ((ipg = igpio_find_group(ib, pin)) == NULL) return (bus_addr_t)NULL; - groupcfg = ib->ib_padbar - + (ipg->ipg_groupno * 4) + groupcfg = ib->ib_padbar + + (ipg->ipg_groupno * 4) + (pin - ipg->ipg_first_pin) / 2; - + DPRINTF(("%s: barno %d, pin = %d, found group %d \"%s\", cfg %p\n", \ __func__, ibs->ibs_barno, pin, ipg->ipg_groupno, \ ipg->ipg_name, (void *)groupcfg)); @@ -477,10 +477,10 @@ igpio_pin_read(void *priv, int pin) mutex_enter(&ib->ib_mtx); val = bus_space_read_4(sc->sc_bst, sc->sc_bsh[ib->ib_barno], cfg0); - DPRINTF(("%s: bar %d pin %d val #%x (%s)\n", __func__, + DPRINTF(("%s: bar %d pin %d val #%x (%s)\n", __func__, ib->ib_barno, pin, val, igpio_padcfg0_print(val, 0))); - if (val & IGPIO_PADCFG0_GPIOTXDIS) + if (val & IGPIO_PADCFG0_GPIOTXDIS) val = (val & IGPIO_PADCFG0_GPIORXSTATE) ? 1 : 0; else val = (val & IGPIO_PADCFG0_GPIOTXSTATE) ? 1 : 0; @@ -584,7 +584,7 @@ igpio_pin_ctl(void *priv, int pin, int f } DPRINTF(("%s: bar %d pin %d flags #%x val0 #%x (%s) -> #%x (%s), " - "val1 #%x -> #%x\n", __func__, ib->ib_barno, pin, flags, +
CVS commit: src/sys/dev/ic
Module Name:src Committed By: riastradh Date: Sat Mar 26 19:35:35 UTC 2022 Modified Files: src/sys/dev/ic: igpio.c igpioreg.h Log Message: igpio(4): Nix trailing whitespace. (setq show-trailing-whitespace t), M-x delete-trailing-whitespace To generate a diff of this commit: cvs rdiff -u -r1.2 -r1.3 src/sys/dev/ic/igpio.c cvs rdiff -u -r1.1 -r1.2 src/sys/dev/ic/igpioreg.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
> On Mar 26, 2022, at 9:39 AM, Taylor R Campbell > wrote: > > `C string' is ambiguous because there are also char arrays that > function as strings but which are not guaranteed to be NUL-terminated, > as strncpy is intended for. A non-terminated char array is not a C-string. The term C-string is not ambiguous. This is something that, amazingly, even Internet trolls appear to agree on. However, they do disagree as to the spelling of the terminating character's name, which is why I think it's best to elide it altogether. -- thorpej
CVS commit: src/sys/arch/amiga/dev
Module Name:src Committed By: andvar Date: Sat Mar 26 17:15:18 UTC 2022 Modified Files: src/sys/arch/amiga/dev: grfabs_cc.c Log Message: s/logial/logical/ To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amiga/dev/grfabs_cc.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/amiga/dev/grfabs_cc.c diff -u src/sys/arch/amiga/dev/grfabs_cc.c:1.36 src/sys/arch/amiga/dev/grfabs_cc.c:1.37 --- src/sys/arch/amiga/dev/grfabs_cc.c:1.36 Tue Aug 17 22:00:27 2021 +++ src/sys/arch/amiga/dev/grfabs_cc.c Sat Mar 26 17:15:18 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: grfabs_cc.c,v 1.36 2021/08/17 22:00:27 andvar Exp $ */ +/* $NetBSD: grfabs_cc.c,v 1.37 2022/03/26 17:15:18 andvar Exp $ */ /* * Copyright (c) 1994 Christian E. Hopps @@ -38,7 +38,7 @@ #include "opt_amigaccgrf.h" #include -__KERNEL_RCSID(0, "$NetBSD: grfabs_cc.c,v 1.36 2021/08/17 22:00:27 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: grfabs_cc.c,v 1.37 2022/03/26 17:15:18 andvar Exp $"); #include #include @@ -930,7 +930,7 @@ display_hires_view(view_t *v) int d = 0; /* XXX anyone know the equality properties of - * intermixed logial AND's */ + * intermixed logical AND's */ /* XXX and arithmetic operators? */ while (((ddfstart & 0xfffc) + ddfwidth - d) > 0xd8) { d++;
CVS commit: src/sys/arch/amiga/dev
Module Name:src Committed By: andvar Date: Sat Mar 26 17:15:18 UTC 2022 Modified Files: src/sys/arch/amiga/dev: grfabs_cc.c Log Message: s/logial/logical/ To generate a diff of this commit: cvs rdiff -u -r1.36 -r1.37 src/sys/arch/amiga/dev/grfabs_cc.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/distrib/sparc/miniroot
Module Name:src Committed By: christos Date: Sat Mar 26 17:11:20 UTC 2022 Modified Files: src/distrib/sparc/miniroot: Makefile.inc Log Message: grow (for llvm) To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/distrib/sparc/miniroot/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sparc/miniroot/Makefile.inc diff -u src/distrib/sparc/miniroot/Makefile.inc:1.31 src/distrib/sparc/miniroot/Makefile.inc:1.32 --- src/distrib/sparc/miniroot/Makefile.inc:1.31 Wed Jan 29 11:24:21 2020 +++ src/distrib/sparc/miniroot/Makefile.inc Sat Mar 26 13:11:20 2022 @@ -1,6 +1,6 @@ -# $NetBSD: Makefile.inc,v 1.31 2020/01/29 16:24:21 christos Exp $ +# $NetBSD: Makefile.inc,v 1.32 2022/03/26 17:11:20 christos Exp $ -IMAGESIZE= 10m +IMAGESIZE= 11m DBG= ${${ACTIVE_CC} == "clang":? -Oz -fomit-frame-pointer : -Os } -fno-unwind-tables MAKEFS_FLAGS+= -o density=4k
CVS commit: src/distrib/sparc/miniroot
Module Name:src Committed By: christos Date: Sat Mar 26 17:11:20 UTC 2022 Modified Files: src/distrib/sparc/miniroot: Makefile.inc Log Message: grow (for llvm) To generate a diff of this commit: cvs rdiff -u -r1.31 -r1.32 src/distrib/sparc/miniroot/Makefile.inc Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
> On Mar 26, 2022, at 9:09 AM, Warner Losh wrote: > > Since all the 'C' standards[*] use "null-terminated" and "null character", > it's likely best to use that terminology because there is a source of truth > for its definition in case of ambiguity or doubt. Ah, but you're giving up the opportunity to use indirection to solve the problem. By calling it a "C-string", then those who care what the standard calls the terminating character can go look it up! :-) -- thorpej
CVS commit: src/distrib/sandpoint/ramdisk
Module Name:src Committed By: christos Date: Sat Mar 26 17:09:53 UTC 2022 Modified Files: src/distrib/sandpoint/ramdisk: Makefile Log Message: grow To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/distrib/sandpoint/ramdisk/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/distrib/sandpoint/ramdisk/Makefile diff -u src/distrib/sandpoint/ramdisk/Makefile:1.14 src/distrib/sandpoint/ramdisk/Makefile:1.15 --- src/distrib/sandpoint/ramdisk/Makefile:1.14 Sun Dec 29 13:26:18 2019 +++ src/distrib/sandpoint/ramdisk/Makefile Sat Mar 26 13:09:53 2022 @@ -1,10 +1,10 @@ -# $NetBSD: Makefile,v 1.14 2019/12/29 18:26:18 christos Exp $ +# $NetBSD: Makefile,v 1.15 2022/03/26 17:09:53 christos Exp $ .include .include "${NETBSDSRCDIR}/distrib/common/Makefile.distrib" IMAGE= ramdisk.fs -IMAGESIZE= 2300k +IMAGESIZE= 2400k MAKEFS_FLAGS+= -f 15 WARNS= 1
CVS commit: src/distrib/sandpoint/ramdisk
Module Name:src Committed By: christos Date: Sat Mar 26 17:09:53 UTC 2022 Modified Files: src/distrib/sandpoint/ramdisk: Makefile Log Message: grow To generate a diff of this commit: cvs rdiff -u -r1.14 -r1.15 src/distrib/sandpoint/ramdisk/Makefile Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: null-terminated vs. nul-terminated
Am 26.03.2022 um 17:09 schrieb Warner Losh: [*] I've not gone the extra mile and checked to see if K&R used this phrase, to be honest. It does. The book from 1978 says in its tutorial section: > getline puts the character \0 (the null character, whose value > is zero) at the end of the array it is creating, to mark the > end of the string of characters. Interestingly, the section from the above quote is named "Character Arrays", not "Strings". The definition of "string" on page 181 doesn't mention the word "terminated", it gives the name "null byte" to the \0. So using the word "null" to mean all kinds of nothing, including a null pointer, a null byte and a null character, has a long tradition. Roland
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
On Sat, Mar 26, 2022 at 9:53 AM Roland Illig wrote: > Am 24.03.2022 um 02:55 schrieb David H. Gutteridge: > > Module Name: src > > Committed By: gutteridge > > Date: Thu Mar 24 01:55:15 UTC 2022 > > > > Modified Files: > > src/lib/libc/gen: popen.3 > > > > Log Message: > > popen.3: minor spelling, grammar, style, and xref tweaks > > > > > > To generate a diff of this commit: > > cvs rdiff -u -r1.22 -r1.23 src/lib/libc/gen/popen.3 > > The term "null-terminated string" is quite common when talking about C. > In contrast, the word "nul" in "nul-terminated" always reminds me of > the character abbreviation in ASCII, which has a narrower scope than C. > I prefer to keep "null-terminated" here. > The standard uses "null-terminated" and "null character" (see Character Sets section 5.2.1 (from the C2x draft, but this term dates back to C89): "A byte with all bits set to 0, called the null character, shall exist in the basic execution character set; it is used to terminate a character string." I couldn't find the definition for null-terminated though. This is different than the NULL #define Not to be confused with the all zeros ASCII charater, whose mnemonic is NUL, which is where some pressure to use NUL terminated comes from. I agree that it's usage is narrower and really only relevant for certain ASCII and ASCII-derived character sets, which is why the standard chose the spelling it did. Since all the 'C' standards[*] use "null-terminated" and "null character", it's likely best to use that terminology because there is a source of truth for its definition in case of ambiguity or doubt. Warner [*] I've not gone the extra mile and checked to see if K&R used this phrase, to be honest.
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
> Date: Sat, 26 Mar 2022 16:53:19 +0100 > From: Roland Illig > > The term "null-terminated string" is quite common when talking about C. > In contrast, the word "nul" in "nul-terminated" always reminds me of > the character abbreviation in ASCII, which has a narrower scope than C. > I prefer to keep "null-terminated" here. I feel like I've usually seen it as NUL-terminated. I thought it was in /usr/share/misc/style but I must have been thinking of a different style guide. `NUL' is better than `null' or `NULL' here because it's not a null pointer, unlike, e.g., the execve argv terminator. Even if the string isn't US-ASCII, what character encoding calls a nonzero byte `NUL'? `NUL' is better than `zero' or `0' here because it's unambiguously the all-bits-zero byte, not the US-ASCII encoding of `0' (i.e., decimal 48 or 0x30). `C string' is ambiguous because there are also char arrays that function as strings but which are not guaranteed to be NUL-terminated, as strncpy is intended for.
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Sat Mar 26 16:22:50 UTC 2022 Modified Files: src/tests/lib/libc/sys: t_ptrace_core_wait.h Log Message: Add sparc* to the list of architectures that need an explicit address with PT_CONTINUE in this test. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_ptrace_core_wait.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/tests/lib/libc/sys/t_ptrace_core_wait.h diff -u src/tests/lib/libc/sys/t_ptrace_core_wait.h:1.4 src/tests/lib/libc/sys/t_ptrace_core_wait.h:1.5 --- src/tests/lib/libc/sys/t_ptrace_core_wait.h:1.4 Sat Jul 24 08:39:54 2021 +++ src/tests/lib/libc/sys/t_ptrace_core_wait.h Sat Mar 26 16:22:50 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: t_ptrace_core_wait.h,v 1.4 2021/07/24 08:39:54 rin Exp $ */ +/* $NetBSD: t_ptrace_core_wait.h,v 1.5 2022/03/26 16:22:50 martin Exp $ */ /*- * Copyright (c) 2016, 2017, 2018, 2019, 2020 The NetBSD Foundation, Inc. @@ -209,7 +209,7 @@ ATF_TC_BODY(core_dump_procinfo, tc) "without signal to be sent\n"); #if defined(__aarch64__) || defined(__arm__) || defined(__powerpc__) || \ -defined(__sh3__) +defined(__sh3__) || defined(sparc) /* * For these archs, program counter is not automatically incremented * by a trap instruction. We cannot increment PC in the trap handler,
CVS commit: src/tests/lib/libc/sys
Module Name:src Committed By: martin Date: Sat Mar 26 16:22:50 UTC 2022 Modified Files: src/tests/lib/libc/sys: t_ptrace_core_wait.h Log Message: Add sparc* to the list of architectures that need an explicit address with PT_CONTINUE in this test. To generate a diff of this commit: cvs rdiff -u -r1.4 -r1.5 src/tests/lib/libc/sys/t_ptrace_core_wait.h Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
> On Mar 26, 2022, at 9:17 AM, Martin Husemann wrote: > When talking about it I prefer "zero terminated", or C-string, in > contrast to C++ std::string (which are objects) or Pascal strings > (which have an explicit length at the beginning). Yes, I also prefer the term “C-string" -- thorpej
Re: null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
On Sat, Mar 26, 2022 at 04:53:19PM +0100, Roland Illig wrote: > The term "null-terminated string" is quite common when talking about C. NULL terminated lists/array are quite common, but NULL is a pointer and the string is terminated by a 0 char (sometimes spelled as \0 in a string literal, but implicitly added by the compiler at the end of a literal, and spelled as NUL in the ascii table). > I prefer to keep "null-terminated" here. I think it is a bug. When talking about it I prefer "zero terminated", or C-string, in contrast to C++ std::string (which are objects) or Pascal strings (which have an explicit length at the beginning). Martin
CVS commit: src/lib/libcurses
Module Name:src Committed By: uwe Date: Sat Mar 26 16:03:02 UTC 2022 Modified Files: src/lib/libcurses: newwin.c Log Message: __makenew: use calloc to get zeroed memory for window contents. PR lib/56767. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/lib/libcurses/newwin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/lib/libcurses/newwin.c diff -u src/lib/libcurses/newwin.c:1.64 src/lib/libcurses/newwin.c:1.65 --- src/lib/libcurses/newwin.c:1.64 Tue Jan 25 03:05:06 2022 +++ src/lib/libcurses/newwin.c Sat Mar 26 16:03:02 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: newwin.c,v 1.64 2022/01/25 03:05:06 blymn Exp $ */ +/* $NetBSD: newwin.c,v 1.65 2022/03/26 16:03:02 uwe Exp $ */ /* * Copyright (c) 1981, 1993, 1994 @@ -34,7 +34,7 @@ #if 0 static char sccsid[] = "@(#)newwin.c 8.3 (Berkeley) 7/27/94"; #else -__RCSID("$NetBSD: newwin.c,v 1.64 2022/01/25 03:05:06 blymn Exp $"); +__RCSID("$NetBSD: newwin.c,v 1.65 2022/03/26 16:03:02 uwe Exp $"); #endif #endif/* not lint */ @@ -275,7 +275,7 @@ __makenew(SCREEN *screen, int nlines, in free(win); return NULL; } - if ((win->lspace = malloc(nlines * sizeof(__LINE))) == NULL) { + if ((win->lspace = calloc(nlines, sizeof(__LINE))) == NULL) { free(win->alines); free(win); return NULL; @@ -288,7 +288,7 @@ __makenew(SCREEN *screen, int nlines, in * Allocate window space in one chunk. */ if ((win->wspace = - malloc(ncols * nlines * sizeof(__LDATA))) == NULL) { + calloc(ncols * nlines, sizeof(__LDATA))) == NULL) { free(win->lspace); free(win->alines); free(win);
CVS commit: src/lib/libcurses
Module Name:src Committed By: uwe Date: Sat Mar 26 16:03:02 UTC 2022 Modified Files: src/lib/libcurses: newwin.c Log Message: __makenew: use calloc to get zeroed memory for window contents. PR lib/56767. To generate a diff of this commit: cvs rdiff -u -r1.64 -r1.65 src/lib/libcurses/newwin.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
null-terminated vs. nul-terminated (was: Re: CVS commit: src/lib/libc/gen)
Am 24.03.2022 um 02:55 schrieb David H. Gutteridge: Module Name:src Committed By: gutteridge Date: Thu Mar 24 01:55:15 UTC 2022 Modified Files: src/lib/libc/gen: popen.3 Log Message: popen.3: minor spelling, grammar, style, and xref tweaks To generate a diff of this commit: cvs rdiff -u -r1.22 -r1.23 src/lib/libc/gen/popen.3 The term "null-terminated string" is quite common when talking about C. In contrast, the word "nul" in "nul-terminated" always reminds me of the character abbreviation in ASCII, which has a narrower scope than C. I prefer to keep "null-terminated" here. Roland
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Mar 26 15:39:58 UTC 2022 Modified Files: src/usr.bin/make: make.1 Log Message: Mention 'make -r' with .POSIX To generate a diff of this commit: cvs rdiff -u -r1.306 -r1.307 src/usr.bin/make/make.1 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/make.1 diff -u src/usr.bin/make/make.1:1.306 src/usr.bin/make/make.1:1.307 --- src/usr.bin/make/make.1:1.306 Fri Mar 25 21:16:04 2022 +++ src/usr.bin/make/make.1 Sat Mar 26 15:39:58 2022 @@ -1,4 +1,4 @@ -.\" $NetBSD: make.1,v 1.306 2022/03/25 21:16:04 sjg Exp $ +.\" $NetBSD: make.1,v 1.307 2022/03/26 15:39:58 sjg Exp $ .\" .\" Copyright (c) 1990, 1993 .\" The Regents of the University of California. All rights reserved. @@ -2301,6 +2301,13 @@ is encountered, the makefile .Ql posix.mk will be included if possible, to provide POSIX compatible default rules. +If +.Nm +is run with the +.Fl r +flag, then only +.Ql posix.mk +will contribute to the default rules. .It Ic .PRECIOUS Apply the .Ic .PRECIOUS
CVS commit: src/usr.bin/make
Module Name:src Committed By: sjg Date: Sat Mar 26 15:39:58 UTC 2022 Modified Files: src/usr.bin/make: make.1 Log Message: Mention 'make -r' with .POSIX To generate a diff of this commit: cvs rdiff -u -r1.306 -r1.307 src/usr.bin/make/make.1 Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Mar 26 14:34:07 UTC 2022 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: directive.exp opt-debug-graph1.exp opt-debug-graph2.exp opt-debug-graph3.exp opt-debug-var.exp suff-main-several.exp suff-transform-debug.exp var-scope-local.exp vardebug.exp varmod-assign-shell.exp varmod-defined.exp varmod-indirect.exp varmod-shell.exp varmod-sun-shell.exp varname-dot-shell.exp varname-dot-suffixes.exp varname-empty.exp Log Message: make: avoid trailing whitespace in debug log for variables Since trailing whitespace is invisible, describe the variable value in words to make it visible. To generate a diff of this commit: cvs rdiff -u -r1.1017 -r1.1018 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/opt-debug-graph1.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-debug-graph2.exp \ src/usr.bin/make/unit-tests/opt-debug-graph3.exp \ src/usr.bin/make/unit-tests/suff-transform-debug.exp \ src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-debug-var.exp \ src/usr.bin/make/unit-tests/varmod-sun-shell.exp \ src/usr.bin/make/unit-tests/varname-dot-suffixes.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/suff-main-several.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/var-scope-local.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.exp cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/unit-tests/vardebug.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-defined.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-indirect.exp cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varname-dot-shell.exp cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varname-empty.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Mar 26 14:34:07 UTC 2022 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: directive.exp opt-debug-graph1.exp opt-debug-graph2.exp opt-debug-graph3.exp opt-debug-var.exp suff-main-several.exp suff-transform-debug.exp var-scope-local.exp vardebug.exp varmod-assign-shell.exp varmod-defined.exp varmod-indirect.exp varmod-shell.exp varmod-sun-shell.exp varname-dot-shell.exp varname-dot-suffixes.exp varname-empty.exp Log Message: make: avoid trailing whitespace in debug log for variables Since trailing whitespace is invisible, describe the variable value in words to make it visible. To generate a diff of this commit: cvs rdiff -u -r1.1017 -r1.1018 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/directive.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/opt-debug-graph1.exp cvs rdiff -u -r1.4 -r1.5 src/usr.bin/make/unit-tests/opt-debug-graph2.exp \ src/usr.bin/make/unit-tests/opt-debug-graph3.exp \ src/usr.bin/make/unit-tests/suff-transform-debug.exp \ src/usr.bin/make/unit-tests/varmod-shell.exp cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-debug-var.exp \ src/usr.bin/make/unit-tests/varmod-sun-shell.exp \ src/usr.bin/make/unit-tests/varname-dot-suffixes.exp cvs rdiff -u -r1.7 -r1.8 src/usr.bin/make/unit-tests/suff-main-several.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/var-scope-local.exp \ src/usr.bin/make/unit-tests/varmod-assign-shell.exp cvs rdiff -u -r1.28 -r1.29 src/usr.bin/make/unit-tests/vardebug.exp cvs rdiff -u -r1.10 -r1.11 src/usr.bin/make/unit-tests/varmod-defined.exp cvs rdiff -u -r1.21 -r1.22 src/usr.bin/make/unit-tests/varmod-indirect.exp cvs rdiff -u -r1.15 -r1.16 src/usr.bin/make/unit-tests/varname-dot-shell.exp cvs rdiff -u -r1.19 -r1.20 src/usr.bin/make/unit-tests/varname-empty.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/var.c diff -u src/usr.bin/make/var.c:1.1017 src/usr.bin/make/var.c:1.1018 --- src/usr.bin/make/var.c:1.1017 Sat Mar 26 14:17:46 2022 +++ src/usr.bin/make/var.c Sat Mar 26 14:34:07 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1017 2022/03/26 14:17:46 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1018 2022/03/26 14:34:07 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1017 2022/03/26 14:17:46 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1018 2022/03/26 14:34:07 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -471,6 +471,16 @@ VarFreeShortLived(Var *v) free(v); } +static const char * +ValueDescription(const char *value) +{ + if (value[0] == '\0') + return "# (empty)"; + if (ch_isspace(value[strlen(value)-1])) + return "# (ends with space)"; + return ""; +} + /* Add a new variable of the given name and value to the given scope. */ static Var * VarAdd(const char *name, const char *value, GNode *scope, VarSetFlags flags) @@ -479,7 +489,8 @@ VarAdd(const char *name, const char *val Var *v = VarNew(FStr_InitRefer(/* aliased to */ he->key), value, false, false, (flags & VAR_SET_READONLY) != 0); HashEntry_Set(he, v); - DEBUG3(VAR, "%s: %s = %s\n", scope->name, name, value); + DEBUG4(VAR, "%s: %s = %s%s\n", + scope->name, name, value, ValueDescription(value)); return v; } @@ -979,7 +990,8 @@ Var_SetWithFlags(GNode *scope, const cha Buf_Clear(&v->val); Buf_AddStr(&v->val, val); - DEBUG3(VAR, "%s: %s = %s\n", scope->name, name, val); + DEBUG4(VAR, "%s: %s = %s%s\n", + scope->name, name, val, ValueDescription(val)); if (v->exported) ExportVar(name, VEM_PLAIN); } @@ -4782,7 +4794,8 @@ Var_Dump(GNode *scope) for (i = 0; i < vec.len; i++) { const char *varname = varnames[i]; Var *var = HashTable_FindValue(&scope->vars, varname); - debug_printf("%-16s = %s\n", varname, var->val.data); + debug_printf("%-16s = %s%s\n", varname, + var->val.data, ValueDescription(var->val.data)); } Vector_Done(&vec); Index: src/usr.bin/make/unit-tests/directive.exp diff -u src/usr.bin/make/unit-tests/directive.exp:1.6 src/usr.bin/make/unit-tests/directive.exp:1.7 --- src/usr.bin/make/unit-tests/directive.exp:1.6 Sun Jan 23 16:09:38 2022 +++ src/usr.bin/make/unit-tests/directive.exp Sat Mar 26 14:34:07 2022 @@ -2,7 +2,7 @@ make: "directive.mk" line 10: Unknown di make: "directive.mk" line 12: Unknown directive "indented" make: "directive.mk" line 14: Unknown directive "indented" make: "directive.mk" line 21: Unknown directive "info" -Global: .info = +Global: .info = # (empty) Global: .info = value make: "directive.mk" line 33: := value Global: .MAKEFLAGS = -r -k -d v -d Index: src/usr.bin/make/unit-
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Mar 26 14:17:47 UTC 2022 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: deptgt-makeflags.exp directive-unexport-env.exp vardebug.exp varmod-defined.exp varname-dot-shell.exp varname-dot-suffixes.exp varname-empty.exp Log Message: make: add space after colon in debug logging for variables These log messages are intended for human interpretation, so don't make them unnecessarily hard to read. To generate a diff of this commit: cvs rdiff -u -r1.1016 -r1.1017 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/deptgt-makeflags.exp cvs rdiff -u -r1.11 -r1.12 \ src/usr.bin/make/unit-tests/directive-unexport-env.exp cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/vardebug.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-defined.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varname-dot-shell.exp cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varname-dot-suffixes.exp cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/varname-empty.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/var.c diff -u src/usr.bin/make/var.c:1.1016 src/usr.bin/make/var.c:1.1017 --- src/usr.bin/make/var.c:1.1016 Sat Mar 26 14:02:40 2022 +++ src/usr.bin/make/var.c Sat Mar 26 14:17:46 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1016 2022/03/26 14:02:40 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1017 2022/03/26 14:17:46 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1016 2022/03/26 14:02:40 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1017 2022/03/26 14:17:46 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -494,11 +494,12 @@ Var_Delete(GNode *scope, const char *var Var *v; if (he == NULL) { - DEBUG2(VAR, "%s:delete %s (not found)\n", scope->name, varname); + DEBUG2(VAR, "%s: delete %s (not found)\n", + scope->name, varname); return; } - DEBUG2(VAR, "%s:delete %s\n", scope->name, varname); + DEBUG2(VAR, "%s: delete %s\n", scope->name, varname); v = he->value; if (v->inUse) { Parse_Error(PARSE_FATAL, @@ -506,10 +507,12 @@ Var_Delete(GNode *scope, const char *var v->name.str); return; } + if (v->exported) unsetenv(v->name.str); if (strcmp(v->name.str, MAKE_EXPORTED) == 0) var_exportedVars = VAR_EXPORTED_NONE; + assert(v->name.freeIt == NULL); HashTable_DeleteEntry(&scope->vars, he); Buf_Done(&v->val); Index: src/usr.bin/make/unit-tests/deptgt-makeflags.exp diff -u src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.6 src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.7 --- src/usr.bin/make/unit-tests/deptgt-makeflags.exp:1.6 Thu Mar 3 19:36:35 2022 +++ src/usr.bin/make/unit-tests/deptgt-makeflags.exp Sat Mar 26 14:17:46 2022 @@ -1,4 +1,4 @@ -Global:delete DOLLAR (not found) +Global: delete DOLLAR (not found) Command: DOLLAR = Global: .MAKEOVERRIDES = VAR DOLLAR CondParser_Eval: ${DOLLAR} != "\$\$" Index: src/usr.bin/make/unit-tests/directive-unexport-env.exp diff -u src/usr.bin/make/unit-tests/directive-unexport-env.exp:1.11 src/usr.bin/make/unit-tests/directive-unexport-env.exp:1.12 --- src/usr.bin/make/unit-tests/directive-unexport-env.exp:1.11 Tue Apr 6 01:38:39 2021 +++ src/usr.bin/make/unit-tests/directive-unexport-env.exp Sat Mar 26 14:17:46 2022 @@ -10,7 +10,7 @@ Result of ${.MAKE.EXPORTED:O} is "UT_EXP Evaluating modifier ${.MAKE.EXPORTED:u} on value "UT_EXPORTED" Result of ${.MAKE.EXPORTED:u} is "UT_EXPORTED" Unexporting "UT_EXPORTED" -Global:delete .MAKE.EXPORTED +Global: delete .MAKE.EXPORTED Global: .MAKEFLAGS = -r -k -d v -d Global: .MAKEFLAGS = -r -k -d v -d 0 make: Fatal errors encountered -- cannot continue Index: src/usr.bin/make/unit-tests/vardebug.exp diff -u src/usr.bin/make/unit-tests/vardebug.exp:1.27 src/usr.bin/make/unit-tests/vardebug.exp:1.28 --- src/usr.bin/make/unit-tests/vardebug.exp:1.27 Sat Nov 20 17:51:48 2021 +++ src/usr.bin/make/unit-tests/vardebug.exp Sat Mar 26 14:17:46 2022 @@ -1,10 +1,10 @@ -Global:delete FROM_CMDLINE (not found) +Global: delete FROM_CMDLINE (not found) Command: FROM_CMDLINE = Global: .MAKEOVERRIDES = FROM_CMDLINE Global: VAR = added Global: VAR = overwritten -Global:delete VAR -Global:delete VAR (not found) +Global: delete VAR +Global: delete VAR (not found) Var_SetExpand: variable name "${:U}" expands to empty string, with value "empty name" - ignored Var_AppendExpand: variable name "${:U}" expands to empty string, with value "empty name" - ignored Global: FROM_CMDLINE = overwritten ignored! @@ -49,7 +49,7 @@ Evaluating modifier ${:M...} on value "v Pattern for ':M' is "valu[e]" ModifyWords: split "value" into 1 word R
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Mar 26 14:17:47 UTC 2022 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: deptgt-makeflags.exp directive-unexport-env.exp vardebug.exp varmod-defined.exp varname-dot-shell.exp varname-dot-suffixes.exp varname-empty.exp Log Message: make: add space after colon in debug logging for variables These log messages are intended for human interpretation, so don't make them unnecessarily hard to read. To generate a diff of this commit: cvs rdiff -u -r1.1016 -r1.1017 src/usr.bin/make/var.c cvs rdiff -u -r1.6 -r1.7 src/usr.bin/make/unit-tests/deptgt-makeflags.exp cvs rdiff -u -r1.11 -r1.12 \ src/usr.bin/make/unit-tests/directive-unexport-env.exp cvs rdiff -u -r1.27 -r1.28 src/usr.bin/make/unit-tests/vardebug.exp cvs rdiff -u -r1.9 -r1.10 src/usr.bin/make/unit-tests/varmod-defined.exp cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/varname-dot-shell.exp cvs rdiff -u -r1.1 -r1.2 src/usr.bin/make/unit-tests/varname-dot-suffixes.exp cvs rdiff -u -r1.18 -r1.19 src/usr.bin/make/unit-tests/varname-empty.exp Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Mar 26 14:02:40 UTC 2022 Modified Files: src/usr.bin/make: make.h trace.c var.c Log Message: make: prefer 'long long' over 'long' on 32-bit C99 platforms When sorting the words of an expression numerically using the modifier ':On' (added on 2021-07-30), use 64-bit numbers even on 32-bit platforms. A typical use case is comparing file sizes. When tracing the execution of jobs, fix an integer overflow after 2038. 32-bit platforms that use a pre-C99 compiler still have this problem. No change to the test suite since most tests simply skip any potential differences between 32-bit platforms and 64-bit platforms (see varmod-order-numeric.mk) or already account for both variants (see varmod-localtime.mk). To generate a diff of this commit: cvs rdiff -u -r1.298 -r1.299 src/usr.bin/make/make.h cvs rdiff -u -r1.31 -r1.32 src/usr.bin/make/trace.c cvs rdiff -u -r1.1015 -r1.1016 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Mar 26 14:02:40 UTC 2022 Modified Files: src/usr.bin/make: make.h trace.c var.c Log Message: make: prefer 'long long' over 'long' on 32-bit C99 platforms When sorting the words of an expression numerically using the modifier ':On' (added on 2021-07-30), use 64-bit numbers even on 32-bit platforms. A typical use case is comparing file sizes. When tracing the execution of jobs, fix an integer overflow after 2038. 32-bit platforms that use a pre-C99 compiler still have this problem. No change to the test suite since most tests simply skip any potential differences between 32-bit platforms and 64-bit platforms (see varmod-order-numeric.mk) or already account for both variants (see varmod-localtime.mk). To generate a diff of this commit: cvs rdiff -u -r1.298 -r1.299 src/usr.bin/make/make.h cvs rdiff -u -r1.31 -r1.32 src/usr.bin/make/trace.c cvs rdiff -u -r1.1015 -r1.1016 src/usr.bin/make/var.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/make.h diff -u src/usr.bin/make/make.h:1.298 src/usr.bin/make/make.h:1.299 --- src/usr.bin/make/make.h:1.298 Sat Feb 5 00:26:21 2022 +++ src/usr.bin/make/make.h Sat Mar 26 14:02:40 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: make.h,v 1.298 2022/02/05 00:26:21 rillig Exp $ */ +/* $NetBSD: make.h,v 1.299 2022/03/26 14:02:40 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -136,7 +136,7 @@ #define MAKE_ATTR_USE /* delete */ #endif -#if __STDC__ >= 199901L || defined(lint) +#if __STDC_VERSION__ >= 199901L || defined(lint) #define MAKE_INLINE static inline MAKE_ATTR_UNUSED #else #define MAKE_INLINE static MAKE_ATTR_UNUSED Index: src/usr.bin/make/trace.c diff -u src/usr.bin/make/trace.c:1.31 src/usr.bin/make/trace.c:1.32 --- src/usr.bin/make/trace.c:1.31 Sat Feb 5 00:26:21 2022 +++ src/usr.bin/make/trace.c Sat Mar 26 14:02:40 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: trace.c,v 1.31 2022/02/05 00:26:21 rillig Exp $ */ +/* $NetBSD: trace.c,v 1.32 2022/03/26 14:02:40 rillig Exp $ */ /* * Copyright (c) 2000 The NetBSD Foundation, Inc. @@ -48,7 +48,7 @@ #include "job.h" #include "trace.h" -MAKE_RCSID("$NetBSD: trace.c,v 1.31 2022/02/05 00:26:21 rillig Exp $"); +MAKE_RCSID("$NetBSD: trace.c,v 1.32 2022/03/26 14:02:40 rillig Exp $"); static FILE *trfile; static pid_t trpid; @@ -90,7 +90,7 @@ Trace_Log(TrEvent event, Job *job) gettimeofday(&rightnow, NULL); -#if __STDC__ >= 199901L +#if __STDC_VERSION__ >= 199901L fprintf(trfile, "%lld.%06ld %d %s %d %s", (long long)rightnow.tv_sec, (long)rightnow.tv_usec, jobTokensRunning, Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1015 src/usr.bin/make/var.c:1.1016 --- src/usr.bin/make/var.c:1.1015 Sat Mar 26 13:32:31 2022 +++ src/usr.bin/make/var.c Sat Mar 26 14:02:40 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1015 2022/03/26 13:32:31 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1016 2022/03/26 14:02:40 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1015 2022/03/26 13:32:31 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1016 2022/03/26 14:02:40 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -3217,7 +3217,7 @@ bad_modifier: return AMR_BAD; } -#if __STDC__ >= 199901L +#if __STDC_VERSION__ >= 199901L # define NUM_TYPE long long # define PARSE_NUM_TYPE strtoll #else
CVS commit: src/sys/dev/cardbus
Module Name:src Committed By: martin Date: Sat Mar 26 13:41:16 UTC 2022 Modified Files: src/sys/dev/cardbus: cardbus.c Log Message: When reading CIS tuples from a BAR, do not blindly copy 2k of data (or to the end of the BAR space), but instead follow the tuples and stop reading once we reach the end of the list. I have a card bwi0 at cardbus0 function 0: Broadcom Wireless bwi0: BBP id 0x4306, BBP rev 0x2, BBP pkg 0 where the BAR claims 8k space but seems to only implement 6k (but that is impossible to report as the spec only allows 2^n sizes) and the CIS starts at a bit over 4k (so the old code tried reading beyound the 6k limit and caused pci bus errors). An alternative would be to avoid reporting bus errors during this access, but since we are only interested in the CIS chain anyway (and that ends way earlier) this is a simpler solution. To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/sys/dev/cardbus/cardbus.c Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/sys/dev/cardbus
Module Name:src Committed By: martin Date: Sat Mar 26 13:41:16 UTC 2022 Modified Files: src/sys/dev/cardbus: cardbus.c Log Message: When reading CIS tuples from a BAR, do not blindly copy 2k of data (or to the end of the BAR space), but instead follow the tuples and stop reading once we reach the end of the list. I have a card bwi0 at cardbus0 function 0: Broadcom Wireless bwi0: BBP id 0x4306, BBP rev 0x2, BBP pkg 0 where the BAR claims 8k space but seems to only implement 6k (but that is impossible to report as the spec only allows 2^n sizes) and the CIS starts at a bit over 4k (so the old code tried reading beyound the 6k limit and caused pci bus errors). An alternative would be to avoid reporting bus errors during this access, but since we are only interested in the CIS chain anyway (and that ends way earlier) this is a simpler solution. To generate a diff of this commit: cvs rdiff -u -r1.113 -r1.114 src/sys/dev/cardbus/cardbus.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/cardbus/cardbus.c diff -u src/sys/dev/cardbus/cardbus.c:1.113 src/sys/dev/cardbus/cardbus.c:1.114 --- src/sys/dev/cardbus/cardbus.c:1.113 Mon Nov 1 21:28:03 2021 +++ src/sys/dev/cardbus/cardbus.c Sat Mar 26 13:41:16 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: cardbus.c,v 1.113 2021/11/01 21:28:03 andvar Exp $ */ +/* $NetBSD: cardbus.c,v 1.114 2022/03/26 13:41:16 martin Exp $ */ /* * Copyright (c) 1997, 1998, 1999 and 2000 @@ -27,7 +27,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.113 2021/11/01 21:28:03 andvar Exp $"); +__KERNEL_RCSID(0, "$NetBSD: cardbus.c,v 1.114 2022/03/26 13:41:16 martin Exp $"); #include "opt_cardbus.h" @@ -163,6 +163,7 @@ cardbus_read_tuples(struct cardbus_attac pcireg_t reg; int found = 0; int cardbus_space = cis_ptr & CARDBUS_CIS_ASIMASK; + size_t mlen, n, tlen; int i, j; memset(tuples, 0, len); @@ -262,10 +263,28 @@ cardbus_read_tuples(struct cardbus_attac cardbus_conf_write(cc, cf, tag, PCI_COMMAND_STATUS_REG, command | PCI_COMMAND_MEM_ENABLE); - /* XXX byte order? */ - bus_space_read_region_1(bar_tag, bar_memh, - cis_ptr, tuples, - MIN(bar_size - MIN(bar_size, cis_ptr), len)); + + mlen = MIN(bar_size - MIN(bar_size, cis_ptr), len); + for (n = 0; n < mlen; ) { +tuples[n] = bus_space_read_1(bar_tag, bar_memh, +cis_ptr+n); +if (tuples[n] == PCMCIA_CISTPL_END) + break; +if (tuples[n] == PCMCIA_CISTPL_NULL) { + n++; + continue; +} +n++; +tuples[n] = bus_space_read_1(bar_tag, bar_memh, +cis_ptr+n); +tlen = tuples[n]; +n++; +if (n+tlen >= mlen) + break; +bus_space_read_region_1(bar_tag, bar_memh, +cis_ptr+n, tuples+n, tlen); +n += tlen; + } found++; } command = cardbus_conf_read(cc, cf, tag,
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Mar 26 13:32:32 UTC 2022 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: opt-env.exp opt-env.mk opt-file.mk Log Message: make: clean up comments To generate a diff of this commit: cvs rdiff -u -r1.1014 -r1.1015 src/usr.bin/make/var.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-env.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-env.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/opt-file.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1014 src/usr.bin/make/var.c:1.1015 --- src/usr.bin/make/var.c:1.1014 Sat Mar 26 12:44:57 2022 +++ src/usr.bin/make/var.c Sat Mar 26 13:32:31 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1014 2022/03/26 12:44:57 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1015 2022/03/26 13:32:31 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1014 2022/03/26 12:44:57 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1015 2022/03/26 13:32:31 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -4016,9 +4016,9 @@ cleanup: /* * TODO: Use p + strlen(p) instead, to stop parsing immediately. * - * In the unit tests, this generates a few unterminated strings in the - * shell commands though. Instead of producing these unfinished - * strings, commands with evaluation errors should not be run at all. + * In the unit tests, this generates a few shell commands with + * unbalanced quotes. Instead of producing these incomplete strings, + * commands with evaluation errors should not be run at all. * * To make that happen, Var_Subst must report the actual errors * instead of returning VPR_OK unconditionally. @@ -4028,8 +4028,8 @@ cleanup: } /* - * Only 4 of the 7 local variables are treated specially as they are the only - * ones that will be set when dynamic sources are expanded. + * Only 4 of the 7 built-in local variables are treated specially as they are + * the only ones that will be set when dynamic sources are expanded. */ static bool VarnameIsDynamic(Substring varname) Index: src/usr.bin/make/unit-tests/opt-env.exp diff -u src/usr.bin/make/unit-tests/opt-env.exp:1.2 src/usr.bin/make/unit-tests/opt-env.exp:1.3 --- src/usr.bin/make/unit-tests/opt-env.exp:1.2 Sun Jan 23 16:09:38 2022 +++ src/usr.bin/make/unit-tests/opt-env.exp Sat Mar 26 13:32:31 2022 @@ -1,5 +1,5 @@ -make: "opt-env.mk" line 9: Malformed conditional (${FROM_ENV} != value-from-env) -make: "opt-env.mk" line 16: value-from-mk +make: "opt-env.mk" line 13: Malformed conditional (${FROM_ENV} != value-from-env) +make: "opt-env.mk" line 20: value-from-mk make: stopped in unit-tests exit status 1 Index: src/usr.bin/make/unit-tests/opt-env.mk diff -u src/usr.bin/make/unit-tests/opt-env.mk:1.3 src/usr.bin/make/unit-tests/opt-env.mk:1.4 --- src/usr.bin/make/unit-tests/opt-env.mk:1.3 Sun Jan 23 16:09:38 2022 +++ src/usr.bin/make/unit-tests/opt-env.mk Sat Mar 26 13:32:31 2022 @@ -1,6 +1,10 @@ -# $NetBSD: opt-env.mk,v 1.3 2022/01/23 16:09:38 rillig Exp $ +# $NetBSD: opt-env.mk,v 1.4 2022/03/26 13:32:31 rillig Exp $ # -# Tests for the -e command line option. +# Tests for the -e command line option, which looks up environment variables +# before those from the global scope. It has no influence on variables from +# the command line though. +# +# This option is required by POSIX. # The variable FROM_ENV is defined in ./Makefile. Index: src/usr.bin/make/unit-tests/opt-file.mk diff -u src/usr.bin/make/unit-tests/opt-file.mk:1.14 src/usr.bin/make/unit-tests/opt-file.mk:1.15 --- src/usr.bin/make/unit-tests/opt-file.mk:1.14 Thu Dec 9 20:47:33 2021 +++ src/usr.bin/make/unit-tests/opt-file.mk Sat Mar 26 13:32:31 2022 @@ -1,4 +1,4 @@ -# $NetBSD: opt-file.mk,v 1.14 2021/12/09 20:47:33 rillig Exp $ +# $NetBSD: opt-file.mk,v 1.15 2022/03/26 13:32:31 rillig Exp $ # # Tests for the -f command line option, which adds a makefile to the list of # files that are parsed. @@ -15,7 +15,7 @@ all: file-containing-null-byte # possible. # # In the unlikely case where a file ends in a backslash instead of a newline, -# that backslash is trimmed. See ParseGetLine. +# that backslash is trimmed. See ReadLowLevelLine. # # make-2014.01.01.00.00.00 invoked undefined behavior, reading text from # outside of the file buffer. @@ -52,7 +52,7 @@ file-ending-in-backslash-mmap: .PHONY # Since parse.c 1.511 from 2020-12-22, an assertion in ParseGetLine failed # for lines that contained trailing whitespace. Worked around in parse.c -# 1.513, properly fixed in parse.c 1.514. +# 1.513, properly fixed in parse.c 1.514 from 2020-12-22. line-with-trailing-whitespace: .PHONY @printf
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Mar 26 13:32:32 UTC 2022 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: opt-env.exp opt-env.mk opt-file.mk Log Message: make: clean up comments To generate a diff of this commit: cvs rdiff -u -r1.1014 -r1.1015 src/usr.bin/make/var.c cvs rdiff -u -r1.2 -r1.3 src/usr.bin/make/unit-tests/opt-env.exp cvs rdiff -u -r1.3 -r1.4 src/usr.bin/make/unit-tests/opt-env.mk cvs rdiff -u -r1.14 -r1.15 src/usr.bin/make/unit-tests/opt-file.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Mar 26 12:44:57 UTC 2022 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: Makefile directive-undef.mk Log Message: make: fix crash on .undef of an environment variable (since 2020-10-06) To generate a diff of this commit: cvs rdiff -u -r1.1013 -r1.1014 src/usr.bin/make/var.c cvs rdiff -u -r1.310 -r1.311 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/directive-undef.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
CVS commit: src/usr.bin/make
Module Name:src Committed By: rillig Date: Sat Mar 26 12:44:57 UTC 2022 Modified Files: src/usr.bin/make: var.c src/usr.bin/make/unit-tests: Makefile directive-undef.mk Log Message: make: fix crash on .undef of an environment variable (since 2020-10-06) To generate a diff of this commit: cvs rdiff -u -r1.1013 -r1.1014 src/usr.bin/make/var.c cvs rdiff -u -r1.310 -r1.311 src/usr.bin/make/unit-tests/Makefile cvs rdiff -u -r1.11 -r1.12 src/usr.bin/make/unit-tests/directive-undef.mk Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files. Modified files: Index: src/usr.bin/make/var.c diff -u src/usr.bin/make/var.c:1.1013 src/usr.bin/make/var.c:1.1014 --- src/usr.bin/make/var.c:1.1013 Thu Mar 3 19:52:41 2022 +++ src/usr.bin/make/var.c Sat Mar 26 12:44:57 2022 @@ -1,4 +1,4 @@ -/* $NetBSD: var.c,v 1.1013 2022/03/03 19:52:41 rillig Exp $ */ +/* $NetBSD: var.c,v 1.1014 2022/03/26 12:44:57 rillig Exp $ */ /* * Copyright (c) 1988, 1989, 1990, 1993 @@ -139,7 +139,7 @@ #include "metachar.h" /* "@(#)var.c 8.3 (Berkeley) 3/19/94" */ -MAKE_RCSID("$NetBSD: var.c,v 1.1013 2022/03/03 19:52:41 rillig Exp $"); +MAKE_RCSID("$NetBSD: var.c,v 1.1014 2022/03/26 12:44:57 rillig Exp $"); /* * Variables are defined using one of the VAR=value assignments. Their @@ -1088,20 +1088,14 @@ Var_Append(GNode *scope, const char *nam DEBUG3(VAR, "%s: %s = %s\n", scope->name, name, v->val.data); if (v->fromEnvironment) { - /* - * The variable originally came from the environment. - * Install it in the global scope (we could place it - * in the environment, but then we should provide a - * way to export other variables...) - */ - v->fromEnvironment = false; + /* See VarAdd. */ + HashEntry *he = + HashTable_CreateEntry(&scope->vars, name, NULL); + HashEntry_Set(he, v); + FStr_Done(&v->name); + v->name = FStr_InitRefer(/* aliased to */ he->key); v->shortLived = false; - /* - * This is the only place where a variable is - * created in a scope, where v->name does not alias - * scope->vars->key. - */ - HashTable_Set(&scope->vars, name, v); + v->fromEnvironment = false; } } } Index: src/usr.bin/make/unit-tests/Makefile diff -u src/usr.bin/make/unit-tests/Makefile:1.310 src/usr.bin/make/unit-tests/Makefile:1.311 --- src/usr.bin/make/unit-tests/Makefile:1.310 Fri Mar 25 22:38:39 2022 +++ src/usr.bin/make/unit-tests/Makefile Sat Mar 26 12:44:57 2022 @@ -1,4 +1,4 @@ -# $NetBSD: Makefile,v 1.310 2022/03/25 22:38:39 rillig Exp $ +# $NetBSD: Makefile,v 1.311 2022/03/26 12:44:57 rillig Exp $ # # Unit tests for make(1) # @@ -467,6 +467,7 @@ TESTS:= ${TESTS:${BROKEN_TESTS:S,^,N,:ts # Additional environment variables for some of the tests. # The base environment is -i PATH="$PATH". ENV.depsrc-optional+= TZ=UTC +ENV.directive-undef= ENV_VAR=env-value ENV.envfirst= FROM_ENV=value-from-env ENV.varmisc= FROM_ENV=env ENV.varmisc+= FROM_ENV_BEFORE=env Index: src/usr.bin/make/unit-tests/directive-undef.mk diff -u src/usr.bin/make/unit-tests/directive-undef.mk:1.11 src/usr.bin/make/unit-tests/directive-undef.mk:1.12 --- src/usr.bin/make/unit-tests/directive-undef.mk:1.11 Fri Mar 25 23:03:47 2022 +++ src/usr.bin/make/unit-tests/directive-undef.mk Sat Mar 26 12:44:57 2022 @@ -1,4 +1,4 @@ -# $NetBSD: directive-undef.mk,v 1.11 2022/03/25 23:03:47 rillig Exp $ +# $NetBSD: directive-undef.mk,v 1.12 2022/03/26 12:44:57 rillig Exp $ # # Tests for the .undef directive. # @@ -130,4 +130,16 @@ INDIRECT= in-${DIRECT} .endif +# Since var.c 1.570 from 2020-10-06 and before var.c 1.1014 from 2022-03-26, +# make ran into an assertion failure when trying to undefine a variable that +# was based on an environment variable. +.if ${ENV_VAR} != "env-value" # see ./Makefile, ENV.directive-undef +. error +.endif +ENV_VAR+= appended # moves the short-lived variable to the +# global scope +.undef ENV_VAR # removes the variable from both the global +# scope and from the environment + + all:
Re: CVS commit: src/lib/libc/time
In article <977b81a4-d330-6722-7ce4-cc4e61011...@gmx.de>, Roland Illig wrote: >Am 25.03.2022 um 22:25 schrieb Christos Zoulas: >> In article <20220325183551.0f039f...@cvs.netbsd.org>, >> Roland Illig wrote: >>> -=-=-=-=-=- >>> >>> Module Name:src >>> Committed By: rillig >>> Date: Fri Mar 25 18:35:50 UTC 2022 >>> >>> Modified Files: >>> src/lib/libc/time: localtime.c >>> >>> Log Message: >>> localtime.c: add back storage class 'register' >>> >>> This reduces the differences to the upstream code. >> >> I don't know why you did that. It is as simple to sed -e 's/register //g' >> in upstream when you diff. Adding register is useless; these days it is >> mostly ignored by compilers, except you can't &... > >I thought that having a small diff to the upstream code was more >important than a few saved keywords. If I was wrong, I can of course >revert it. I don't care too much, less clutter without obsolete keywords that do nothing or worse. christos