From 3252c81e6b18b34fe615b8354daa9eff10d47bfe Mon Sep 17 00:00:00 2001 From: purplerain Date: Sun, 8 Oct 2023 00:42:41 +0000 Subject: [PATCH] sync code with last improvements from OpenBSD --- bin/ls/ls.c | 39 +++++--- bin/ls/ls.h | 5 +- bin/ls/print.c | 11 +-- lib/libc/stdio/fvwrite.c | 7 +- lib/libc/stdio/putc.c | 7 +- lib/libc/stdio/vfprintf.c | 6 +- lib/libc/stdio/vfwprintf.c | 6 +- lib/libc/stdio/wbuf.c | 7 +- lib/libc/stdio/wsetup.c | 15 ++- regress/usr.bin/ssh/agent-pkcs11.sh | 27 ++++-- regress/usr.sbin/pkg_add/Makefile | 46 ++++----- sbin/bioctl/bioctl.c | 18 ++-- share/man/man1/register-plist.1 | 14 ++- share/man/man7/man.7 | 32 ++++--- sys/dev/pci/if_iwx.c | 12 ++- sys/dev/pci/if_iwxreg.h | 3 +- sys/dev/usb/ucom.c | 8 +- sys/dev/usb/usb_subr.c | 6 +- sys/kern/kern_sig.c | 6 +- usr.bin/awk/FIXES | 5 + usr.bin/awk/b.c | 131 ++++++++++++++++---------- usr.bin/awk/lib.c | 3 +- usr.bin/awk/main.c | 4 +- usr.bin/awk/run.c | 7 +- usr.sbin/dhcpd/dhcpd.c | 4 +- usr.sbin/pkg_add/OpenBSD/PkgAdd.pm | 16 +++- usr.sbin/pkg_add/OpenBSD/PkgCreate.pm | 4 +- usr.sbin/pkg_add/OpenBSD/Tracker.pm | 17 +++- usr.sbin/pkg_add/OpenBSD/Update.pm | 3 +- 29 files changed, 283 insertions(+), 186 deletions(-) diff --git a/bin/ls/ls.c b/bin/ls/ls.c index 125512ba6..75b594d16 100644 --- a/bin/ls/ls.c +++ b/bin/ls/ls.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ls.c,v 1.54 2020/10/07 21:03:09 millert Exp $ */ +/* $OpenBSD: ls.c,v 1.56 2023/10/07 13:29:08 schwarze Exp $ */ /* $NetBSD: ls.c,v 1.18 1996/07/09 09:16:29 mycroft Exp $ */ /* @@ -436,12 +436,12 @@ display(FTSENT *p, FTSENT *list) unsigned long long btotal; blkcnt_t maxblock; ino_t maxinode; + unsigned int maxmajor, maxminor; int bcfile, flen, glen, ulen, maxflags, maxgroup, maxuser, maxlen; int entries, needstats; int width; const char *user, *group; char nuser[12], ngroup[12]; - char buf[21]; /* 64 bits == 20 digits */ char *flags = NULL; needstats = f_inode || f_longform || f_size; @@ -449,6 +449,7 @@ display(FTSENT *p, FTSENT *list) btotal = maxblock = maxinode = maxlen = maxnlink = 0; bcfile = 0; maxuser = maxgroup = maxflags = 0; + maxmajor = maxminor = 0; maxsize = 0; for (cur = list, entries = 0; cur != NULL; cur = cur->fts_link) { if (cur->fts_info == FTS_ERR || cur->fts_info == FTS_NS) { @@ -523,9 +524,13 @@ display(FTSENT *p, FTSENT *list) (void)strlcpy(np->group, group, glen + 1); if (S_ISCHR(sp->st_mode) || - S_ISBLK(sp->st_mode)) + S_ISBLK(sp->st_mode)) { bcfile = 1; - + if (maxmajor < major(sp->st_rdev)) + maxmajor = major(sp->st_rdev); + if (maxminor < minor(sp->st_rdev)) + maxminor = minor(sp->st_rdev); + } if (f_flags) { np->flags = &np->data[ulen + 1 + glen + 1]; (void)strlcpy(np->flags, flags, flen + 1); @@ -551,25 +556,29 @@ display(FTSENT *p, FTSENT *list) d.entries = entries; d.maxlen = maxlen; if (needstats) { - d.bcfile = bcfile; d.btotal = btotal; - (void)snprintf(buf, sizeof(buf), "%llu", + d.s_block = snprintf(NULL, 0, "%llu", (unsigned long long)maxblock); - d.s_block = strlen(buf); d.s_flags = maxflags; d.s_group = maxgroup; - (void)snprintf(buf, sizeof(buf), "%llu", + d.s_inode = snprintf(NULL, 0, "%llu", (unsigned long long)maxinode); - d.s_inode = strlen(buf); - (void)snprintf(buf, sizeof(buf), "%lu", + d.s_nlink = snprintf(NULL, 0, "%lu", (unsigned long)maxnlink); - d.s_nlink = strlen(buf); - if (!f_humanval) { - (void)snprintf(buf, sizeof(buf), "%lld", + if (!f_humanval) + d.s_size = snprintf(NULL, 0, "%lld", (long long)maxsize); - d.s_size = strlen(buf); - } else + else d.s_size = FMT_SCALED_STRSIZE-2; /* no - or '\0' */ + d.s_major = d.s_minor = 3; + if (bcfile) { + d.s_major = snprintf(NULL, 0, "%u", maxmajor); + d.s_minor = snprintf(NULL, 0, "%u", maxminor); + if (d.s_size <= d.s_major + 2 + d.s_minor) + d.s_size = d.s_major + 2 + d.s_minor; + else + d.s_major = d.s_size - 2 - d.s_minor; + } d.s_user = maxuser; } diff --git a/bin/ls/ls.h b/bin/ls/ls.h index 1feebd932..7f654f588 100644 --- a/bin/ls/ls.h +++ b/bin/ls/ls.h @@ -1,4 +1,4 @@ -/* $OpenBSD: ls.h,v 1.9 2013/05/30 16:34:32 guenther Exp $ */ +/* $OpenBSD: ls.h,v 1.10 2023/10/07 11:51:08 schwarze Exp $ */ /* $NetBSD: ls.h,v 1.7 1995/03/21 09:06:33 cgd Exp $ */ /* @@ -55,7 +55,6 @@ extern int f_typedir; /* add type character for directories */ typedef struct { FTSENT *list; unsigned long long btotal; - int bcfile; int entries; int maxlen; int s_block; @@ -64,6 +63,8 @@ typedef struct { int s_inode; int s_nlink; int s_size; + int s_major; + int s_minor; int s_user; } DISPLAY; diff --git a/bin/ls/print.c b/bin/ls/print.c index 646b4277b..ce3b82d10 100644 --- a/bin/ls/print.c +++ b/bin/ls/print.c @@ -1,4 +1,4 @@ -/* $OpenBSD: print.c,v 1.39 2020/10/07 21:03:09 millert Exp $ */ +/* $OpenBSD: print.c,v 1.40 2023/10/07 11:51:08 schwarze Exp $ */ /* $NetBSD: print.c,v 1.15 1996/12/11 03:25:39 thorpej Exp $ */ /* @@ -110,12 +110,9 @@ printlong(DISPLAY *dp) if (f_flags) (void)printf("%-*s ", dp->s_flags, np->flags); if (S_ISCHR(sp->st_mode) || S_ISBLK(sp->st_mode)) - (void)printf("%3u, %3u ", - major(sp->st_rdev), minor(sp->st_rdev)); - else if (dp->bcfile) - (void)printf("%*s%*lld ", - 8 - dp->s_size, "", dp->s_size, - (long long)sp->st_size); + (void)printf("%*u, %*u ", + dp->s_major, major(sp->st_rdev), + dp->s_minor, minor(sp->st_rdev)); else printsize(dp->s_size, sp->st_size); if (f_accesstime) diff --git a/lib/libc/stdio/fvwrite.c b/lib/libc/stdio/fvwrite.c index ba58f9de0..d83de8845 100644 --- a/lib/libc/stdio/fvwrite.c +++ b/lib/libc/stdio/fvwrite.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fvwrite.c,v 1.20 2017/03/17 16:06:33 millert Exp $ */ +/* $OpenBSD: fvwrite.c,v 1.21 2023/10/06 16:41:02 millert Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -34,7 +34,6 @@ #include #include #include -#include #include #include "local.h" #include "fvwrite.h" @@ -58,10 +57,8 @@ __sfvwrite(FILE *fp, struct __suio *uio) if ((len = uio->uio_resid) == 0) return (0); /* make sure we can write */ - if (cantwrite(fp)) { - errno = EBADF; + if (cantwrite(fp)) return (EOF); - } #define MIN(a, b) ((a) < (b) ? (a) : (b)) #define COPY(n) (void)memcpy(fp->_p, p, n) diff --git a/lib/libc/stdio/putc.c b/lib/libc/stdio/putc.c index 9fca90507..b58ae7310 100644 --- a/lib/libc/stdio/putc.c +++ b/lib/libc/stdio/putc.c @@ -1,4 +1,4 @@ -/* $OpenBSD: putc.c,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: putc.c,v 1.14 2023/10/06 16:41:02 millert Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -32,7 +32,6 @@ */ #include -#include #include "local.h" /* @@ -43,10 +42,8 @@ int putc_unlocked(int c, FILE *fp) { - if (cantwrite(fp)) { - errno = EBADF; + if (cantwrite(fp)) return (EOF); - } _SET_ORIENTATION(fp, -1); return (__sputc(c, fp)); } diff --git a/lib/libc/stdio/vfprintf.c b/lib/libc/stdio/vfprintf.c index 9c684c819..759aab522 100644 --- a/lib/libc/stdio/vfprintf.c +++ b/lib/libc/stdio/vfprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfprintf.c,v 1.81 2021/09/08 15:57:27 jca Exp $ */ +/* $OpenBSD: vfprintf.c,v 1.82 2023/10/06 16:41:02 millert Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -457,10 +457,8 @@ __vfprintf(FILE *fp, const char *fmt0, __va_list ap) _SET_ORIENTATION(fp, -1); /* sorry, fprintf(read_only_file, "") returns EOF, not 0 */ - if (cantwrite(fp)) { - errno = EBADF; + if (cantwrite(fp)) return (EOF); - } /* optimise fprintf(stderr) (and other unbuffered Unix files) */ if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) && diff --git a/lib/libc/stdio/vfwprintf.c b/lib/libc/stdio/vfwprintf.c index c6db189dc..f968ebbe0 100644 --- a/lib/libc/stdio/vfwprintf.c +++ b/lib/libc/stdio/vfwprintf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: vfwprintf.c,v 1.22 2021/09/08 15:57:27 jca Exp $ */ +/* $OpenBSD: vfwprintf.c,v 1.23 2023/10/06 16:41:02 millert Exp $ */ /*- * Copyright (c) 1990 The Regents of the University of California. * All rights reserved. @@ -451,10 +451,8 @@ __vfwprintf(FILE * __restrict fp, const wchar_t * __restrict fmt0, __va_list ap) _SET_ORIENTATION(fp, 1); /* sorry, fwprintf(read_only_file, "") returns EOF, not 0 */ - if (cantwrite(fp)) { - errno = EBADF; + if (cantwrite(fp)) return (EOF); - } /* optimise fwprintf(stderr) (and other unbuffered Unix files) */ if ((fp->_flags & (__SNBF|__SWR|__SRW)) == (__SNBF|__SWR) && diff --git a/lib/libc/stdio/wbuf.c b/lib/libc/stdio/wbuf.c index 2d077505b..edb6a50ba 100644 --- a/lib/libc/stdio/wbuf.c +++ b/lib/libc/stdio/wbuf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wbuf.c,v 1.13 2015/08/31 02:53:57 guenther Exp $ */ +/* $OpenBSD: wbuf.c,v 1.14 2023/10/06 16:41:02 millert Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -32,7 +32,6 @@ */ #include -#include #include "local.h" /* @@ -54,10 +53,8 @@ __swbuf(int c, FILE *fp) * calls might wrap _w from negative to positive. */ fp->_w = fp->_lbfsize; - if (cantwrite(fp)) { - errno = EBADF; + if (cantwrite(fp)) return (EOF); - } c = (unsigned char)c; /* diff --git a/lib/libc/stdio/wsetup.c b/lib/libc/stdio/wsetup.c index 083422365..842036b49 100644 --- a/lib/libc/stdio/wsetup.c +++ b/lib/libc/stdio/wsetup.c @@ -1,4 +1,4 @@ -/* $OpenBSD: wsetup.c,v 1.7 2005/08/08 08:05:36 espie Exp $ */ +/* $OpenBSD: wsetup.c,v 1.8 2023/10/06 16:41:02 millert Exp $ */ /*- * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. @@ -31,6 +31,7 @@ * SUCH DAMAGE. */ +#include #include #include #include "local.h" @@ -38,7 +39,7 @@ /* * Various output routines call wsetup to be sure it is safe to write, * because either _flags does not include __SWR, or _buf is NULL. - * _wsetup returns 0 if OK to write, nonzero otherwise. + * __swsetup returns 0 if OK to write, nonzero otherwise, setting errno. */ int __swsetup(FILE *fp) @@ -51,8 +52,11 @@ __swsetup(FILE *fp) * If we are not writing, we had better be reading and writing. */ if ((fp->_flags & __SWR) == 0) { - if ((fp->_flags & __SRW) == 0) + if ((fp->_flags & __SRW) == 0) { + errno = EBADF; + fp->_flags |= __SERR; return (EOF); + } if (fp->_flags & __SRD) { /* clobber any ungetc data */ if (HASUB(fp)) @@ -68,8 +72,11 @@ __swsetup(FILE *fp) * Make a buffer if necessary, then set _w. */ if (fp->_bf._base == NULL) { - if ((fp->_flags & (__SSTR | __SALC)) == __SSTR) + if ((fp->_flags & (__SSTR | __SALC)) == __SSTR) { + errno = EINVAL; + fp->_flags |= __SERR; return (EOF); + } __smakebuf(fp); } if (fp->_flags & __SLBF) { diff --git a/regress/usr.bin/ssh/agent-pkcs11.sh b/regress/usr.bin/ssh/agent-pkcs11.sh index 91674c3a6..66efa2142 100644 --- a/regress/usr.bin/ssh/agent-pkcs11.sh +++ b/regress/usr.bin/ssh/agent-pkcs11.sh @@ -1,4 +1,4 @@ -# $OpenBSD: agent-pkcs11.sh,v 1.9 2021/07/25 12:13:03 dtucker Exp $ +# $OpenBSD: agent-pkcs11.sh,v 1.11 2023/10/06 03:32:15 djm Exp $ # Placed in the Public Domain. tid="pkcs11 agent test" @@ -38,6 +38,7 @@ export SSH_ASKPASS unset DISPLAY # start command w/o tty, so ssh-add accepts pin from stdin +# XXX could force askpass instead notty() { perl -e 'use POSIX; POSIX::setsid(); if (fork) { wait; exit($? >> 8); } else { exec(@ARGV) }' "$@" @@ -45,18 +46,23 @@ notty() { trace "generating keys" RSA=${DIR}/RSA +RSAP8=${DIR}/RSAP8 +ECPARAM=${DIR}/ECPARAM EC=${DIR}/EC -$OPENSSL_BIN genpkey -algorithm rsa > $RSA -$OPENSSL_BIN pkcs8 -nocrypt -in $RSA |\ - softhsm2-util --slot "$slot" --label 01 --id 01 --pin "$TEST_SSH_PIN" --import /dev/stdin +ECP8=${DIR}/ECP8 +$OPENSSL_BIN genpkey -algorithm rsa > $RSA || fatal "genpkey RSA fail" +$OPENSSL_BIN pkcs8 -nocrypt -in $RSA > $RSAP8 || fatal "pkcs8 RSA fail" +softhsm2-util --slot "$slot" --label 01 --id 01 \ + --pin "$TEST_SSH_PIN" --import $RSAP8 || fatal "softhsm import RSA fail" + $OPENSSL_BIN genpkey \ -genparam \ -algorithm ec \ - -pkeyopt ec_paramgen_curve:prime256v1 |\ - $OPENSSL_BIN genpkey \ - -paramfile /dev/stdin > $EC -$OPENSSL_BIN pkcs8 -nocrypt -in $EC |\ - softhsm2-util --slot "$slot" --label 02 --id 02 --pin "$TEST_SSH_PIN" --import /dev/stdin + -pkeyopt ec_paramgen_curve:prime256v1 > $ECPARAM || fatal "param EC fail" +$OPENSSL_BIN genpkey -paramfile $ECPARAM > $EC || fatal "genpkey EC fail" +$OPENSSL_BIN pkcs8 -nocrypt -in $EC > $ECP8 || fatal "pkcs8 EC fail" +softhsm2-util --slot "$slot" --label 02 --id 02 \ + --pin "$TEST_SSH_PIN" --import $ECP8 || fatal "softhsm import EC fail" trace "start agent" eval `${SSHAGENT} ${EXTRA_AGENT_ARGS} -s` > /dev/null @@ -83,7 +89,8 @@ else chmod 600 $k ssh-keygen -y -f $k > $k.pub pub=$(cat $k.pub) - ${SSHADD} -L | grep -q "$pub" || fail "key $k missing in ssh-add -L" + ${SSHADD} -L | grep -q "$pub" || \ + fail "key $k missing in ssh-add -L" ${SSHADD} -T $k.pub || fail "ssh-add -T with $k failed" # add to authorized keys diff --git a/regress/usr.sbin/pkg_add/Makefile b/regress/usr.sbin/pkg_add/Makefile index e06a65579..43e25d7cc 100644 --- a/regress/usr.sbin/pkg_add/Makefile +++ b/regress/usr.sbin/pkg_add/Makefile @@ -1,4 +1,4 @@ -# $OpenBSD: Makefile,v 1.86 2022/05/10 09:42:32 bluhm Exp $ +# $OpenBSD: Makefile,v 1.87 2023/10/06 06:00:18 espie Exp $ REGRESS_TARGETS=pkgnames pkgpaths signatures depends-check longnames pkgcfl \ collision-check1 collision-check2 collision-check3 \ @@ -24,6 +24,8 @@ REGRESS_EXPECTED_FAILURES = collision-check1 collision-check2 \ PERLSCRIPT = perl -I ${.CURDIR} ${.CURDIR} +WAVE_PLIST=-DREGRESSION_TESTING=plist_checks + ADD_PKG = ${PERLSCRIPT}/my add -Dchecksum DELETE_PKG = ${PERLSCRIPT}/my delete -Dchecksum INFO_PKG = ${PERLSCRIPT}/my info @@ -353,22 +355,22 @@ rep0/intb-0.tgz: @${CREATE_PKG} -P't/inta:inta-*:inta-0' ${EMPTY} $@ rep1/o-1.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -P't/p:p-*:p-0' -W'coincoin.0.0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -P't/p:p-*:p-0' -W'coincoin.0.0' ${EMPTY} $@ rep1/o1-1.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -P't/p1:p1-*:p1-0' -W'coincoin.0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -P't/p1:p1-*:p1-0' -W'coincoin.0' ${EMPTY} $@ rep1/o2-1.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -P't/p2:p2-*:p2-0' -W'coincoin.0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -P't/p2:p2-*:p2-0' -W'coincoin.0' ${EMPTY} $@ rep0/o3-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -W'unlikelylibraryname.0.0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -W'unlikelylibraryname.0.0' ${EMPTY} $@ rep1/p-0.tgz rep1/p1-0.tgz: plist8 @${WITH} -B src13 -DLIBcoincoin_VERSION=0.0 -f plist8 $@ ${CPKG} rep1/p2-0.tgz: plist8 - @${WITH} -DREGRESSION_TESTING -B src14 -DLIBcoincoin_VERSION=0 -f plist8 $@ ${CPKG} + @${WITH} ${WAVE_PLIST} -B src14 -DLIBcoincoin_VERSION=0 -f plist8 $@ ${CPKG} rep0/p4-0.tgz: plist12 @${WITH} -B src15 -DLIBa_VERSION=0.0 -f plist12 $@ ${CPKG} @@ -377,31 +379,31 @@ rep1/p4-1.tgz: plist12 @${WITH} -B src31 -DLIBa_VERSION=1.0 -f plist12 $@ ${CPKG} rep0/boost-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -W'a.0.0' -P't/p4:p4-*:p4-0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -W'a.0.0' -P't/p4:p4-*:p4-0' ${EMPTY} $@ rep1/boost-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -W'a.1.0' -P't/p4:p4-*:p4-1' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -W'a.1.0' -P't/p4:p4-*:p4-1' ${EMPTY} $@ rep0/Imath-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -P't/boots:boost-*:boost-0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -P't/boots:boost-*:boost-0' ${EMPTY} $@ rep1/Imath-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -P't/boots:boost-*:boost-0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -P't/boots:boost-*:boost-0' ${EMPTY} $@ rep0/o4-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -W'a.1.0' -P't/p4:p4-*:p4-0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -W'a.1.0' -P't/p4:p4-*:p4-0' ${EMPTY} $@ rep0/o5-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -W'a.0.2' -P't/p4:p4-*:p4-0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -W'a.0.2' -P't/p4:p4-*:p4-0' ${EMPTY} $@ rep0/o6-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -W'a.0.0' -P't/p4:p4-*:p4-0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -W'a.0.0' -P't/p4:p4-*:p4-0' ${EMPTY} $@ rep0/oo6-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -W'a.0.0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -W'a.0.0' ${EMPTY} $@ rep0/o7-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -W'dir/a.0.0' -P't/p4:p4-*:p4-0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -W'dir/a.0.0' -P't/p4:p4-*:p4-0' ${EMPTY} $@ rep1/b-1.tgz: @${CREATE_PKG} -P't/a:a-*:a-1' ${EMPTY} $@ @@ -589,14 +591,14 @@ rep1/ol-1.tgz: plist21 CUPS_FILES += rep2/$o.tgz rep2/$o.tgz: ${.CURDIR}/oldcups/$o/+CONTENTS mkdir -p rep2 - cd rep2 && pkg_create -DREGRESSION_TESTING -Dstub -f ${.CURDIR}/oldcups/$o/+CONTENTS + cd rep2 && pkg_create ${WAVE_PLIST} -Dstub -f ${.CURDIR}/oldcups/$o/+CONTENTS .endfor .for n in cups-2.2.8 cups-filters-1.20.3 cups-libs-2.2.8 ghostscript-9.07p7 CUPS_FILES += rep3/$n.tgz rep3/$n.tgz: ${.CURDIR}/newcups/$n/+CONTENTS mkdir -p rep3 - cd rep3 && pkg_create -DREGRESSION_TESTING -Dstub -f ${.CURDIR}/newcups/$n/+CONTENTS + cd rep3 && pkg_create ${WAVE_PLIST} -Dstub -f ${.CURDIR}/newcups/$n/+CONTENTS .endfor cups-bug: ${CUPS_FILES} @@ -651,10 +653,10 @@ rep5/gnutls-0.tgz: @${CREATE_PKG} -P't/libnettle:libnettle-*:libnettle-1' ${EMPTY} $@ rep4/gtk+3-cups-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -W nettle.0.0 -P't/cups-libs:cups-libs-*:cups-libs-0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -W nettle.0.0 -P't/cups-libs:cups-libs-*:cups-libs-0' ${EMPTY} $@ rep5/gtk+3-cups-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -W nettle.1.0 -P't/cups-libs:cups-libs-*:cups-libs-0' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -W nettle.1.0 -P't/cups-libs:cups-libs-*:cups-libs-0' ${EMPTY} $@ rep5/libnettle-1.tgz: plist22 @${WITH} -B src24 -DLIBnettle_VERSION=1.0 -f plist22 $@ ${CPKG} @@ -766,10 +768,10 @@ rep6/avahi-0.tgz: plist25 @${WITH} -B src28 -DLIBavahi_VERSION=0.0 -f plist25 $@ ${CPKG} rep6/cups-0.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -P't/avahi:avahi-*:avahi-0' -W avahi.0.0 ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -P't/avahi:avahi-*:avahi-0' -W avahi.0.0 ${EMPTY} $@ rep7/avahi-1.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -P't/avahi-libs:avahi-libs-*:avahi-libs-1' ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -P't/avahi-libs:avahi-libs-*:avahi-libs-1' ${EMPTY} $@ rep7/avahi-libs-1.tgz: plist27 @${WITH} -B src28 -f plist27 $@ ${CPKG} @@ -778,7 +780,7 @@ rep7/avahi-glib-1.tgz: plist26 @${WITH} -B src28 -DLIBavahi_VERSION=0.0 -f plist26 $@ ${CPKG} rep7/cups-1.tgz: - @${CREATE_PKG} -DREGRESSION_TESTING -P't/avahi-libs:avahi-libs-*:avahi-libs-0' -P't/avahi-glib:avahi-glib-*:avahi-glib-1' -W avahi.0.0 ${EMPTY} $@ + @${CREATE_PKG} ${WAVE_PLIST} -P't/avahi-libs:avahi-libs-*:avahi-libs-0' -P't/avahi-glib:avahi-glib-*:avahi-glib-1' -W avahi.0.0 ${EMPTY} $@ rep0/sym-0.tgz: plist19 diff --git a/sbin/bioctl/bioctl.c b/sbin/bioctl/bioctl.c index 20e10743a..ff24ba007 100644 --- a/sbin/bioctl/bioctl.c +++ b/sbin/bioctl/bioctl.c @@ -1,4 +1,4 @@ -/* $OpenBSD: bioctl.c,v 1.155 2023/09/02 09:14:47 kn Exp $ */ +/* $OpenBSD: bioctl.c,v 1.157 2023/10/07 12:20:10 kn Exp $ */ /* * Copyright (c) 2004, 2005 Marco Peereboom @@ -90,7 +90,7 @@ int human; int verbose; u_int32_t cflags = 0; int rflag = -1; /* auto */ -char *password; +char *passfile; void *bio_cookie; @@ -175,7 +175,7 @@ main(int argc, char *argv[]) changepass = 1; break; case 'p': - password = optarg; + passfile = optarg; break; case 'r': if (strcmp(optarg, "auto") == 0) { @@ -1334,8 +1334,8 @@ derive_key(u_int32_t type, int rounds, u_int8_t *key, size_t keysz, errx(1, "number of KDF rounds is too small: %d", rounds); /* get passphrase */ - if (password) { - if ((f = fopen(password, "r")) == NULL) + if (passfile) { + if ((f = fopen(passfile, "r")) == NULL) err(1, "invalid passphrase file"); if (fstat(fileno(f), &sb) == -1) @@ -1361,9 +1361,15 @@ derive_key(u_int32_t type, int rounds, u_int8_t *key, size_t keysz, if (readpassphrase(prompt, passphrase, sizeof(passphrase), rpp_flag) == NULL) err(1, "unable to read passphrase"); + if (*passphrase == '\0') { + warnx("invalid passphrase length"); + if (interactive) + goto retry; + exit(1); + } } - if (verify && !password) { + if (verify && !passfile) { /* request user to re-type it */ if (readpassphrase("Re-type passphrase: ", verifybuf, sizeof(verifybuf), rpp_flag) == NULL) { diff --git a/share/man/man1/register-plist.1 b/share/man/man1/register-plist.1 index 706a83eaf..2049d1176 100644 --- a/share/man/man1/register-plist.1 +++ b/share/man/man1/register-plist.1 @@ -1,4 +1,4 @@ -.\" $OpenBSD: register-plist.1,v 1.6 2020/06/10 07:44:38 espie Exp $ +.\" $OpenBSD: register-plist.1,v 1.7 2023/10/06 12:45:45 espie Exp $ .\" .\" Copyright (c) 2010 Marc Espie .\" @@ -14,7 +14,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: June 10 2020 $ +.Dd $Mdocdate: October 6 2023 $ .Dt REGISTER-PLIST 1 .Os .Sh NAME @@ -38,10 +38,18 @@ is used to check that a packing-list for a given package name doesn't change. By default, it is invoked at the end of .Li make package , +and compares a temporary package with the +.Pa ${PLIST_REPOSITORY} +before moving it to +.Pa ${PACKAGE_REPOSITORY}/${MACHINE_ARCH}/all +.Po see .Ev PACKAGE_REPOSITORY +and +.Ev PLIST_REPOSITORY in -.Xr bsd.port.mk 5 . +.Xr bsd.port.mk 5 +.Pc . Package names (package stem plus version) are used to uniquely identify packages. When something in the package changes, the package name should change, diff --git a/share/man/man7/man.7 b/share/man/man7/man.7 index 6eb25e48b..31ed7bfa0 100644 --- a/share/man/man7/man.7 +++ b/share/man/man7/man.7 @@ -1,4 +1,4 @@ -.\" $OpenBSD: man.7,v 1.60 2021/08/05 14:31:06 schwarze Exp $ +.\" $OpenBSD: man.7,v 1.61 2023/10/07 21:26:29 schwarze Exp $ .\" .\" Copyright (c) 2009, 2010, 2011, 2012 Kristaps Dzonsons .\" Copyright (c) 2011-2015, 2017-2020 Ingo Schwarze @@ -17,7 +17,7 @@ .\" ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF .\" OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. .\" -.Dd $Mdocdate: August 5 2021 $ +.Dd $Mdocdate: October 7 2023 $ .Dt MAN 7 .Os .Sh NAME @@ -97,10 +97,11 @@ but can be found in the alphabetical reference below. .It Ic SH Ta section header (one line) .It Ic SS Ta subsection header (one line) .It Ic PP Ta start an undecorated paragraph (no arguments) -.It Ic RS , RE Ta reset the left margin: Op Ar width .It Ic IP Ta indented paragraph: Op Ar head Op Ar width .It Ic TP Ta tagged paragraph: Op Ar width .It Ic PD Ta set vertical paragraph distance: Op Ar height +.It Ic EX , EE Ta display an example (no arguments) +.It Ic RS , RE Ta reset the left margin: Op Ar width .It Ic in Ta additional indent: Op Ar width .El .Ss Physical markup @@ -162,7 +163,9 @@ This has no effect unless the tabulator positions were changed with the .Ic ta request. .It Ic EE -This is a non-standard Version 9 +End an example block started with +.Ic EX . +This is a Version 9 .At extension later adopted by GNU. In @@ -172,7 +175,8 @@ it does the same as the .Ic fi request (switch to fill mode). .It Ic EX -This is a non-standard Version 9 +Begin a block to display an example. +This is a Version 9 .At extension later adopted by GNU. In @@ -234,10 +238,10 @@ A synonym for .It Ic ME End a mailto block started with .Ic MT . -This is a non-standard GNU extension. +This is a GNU extension. .It Ic MT Begin a mailto block. -This is a non-standard GNU extension. +This is a GNU extension. It has the following syntax: .Bd -unfilled -offset indent .Pf . Ic MT Ar address @@ -246,7 +250,7 @@ link description to be shown .Ed .It Ic OP Optional command-line argument. -This is a non-standard DWB extension. +This is a rarely used DWB extension. It has the following syntax: .Pp .D1 Pf . Ic OP Ar key Op Ar value @@ -373,8 +377,7 @@ Begin a synopsis block with the following syntax: .Pf . Ic YS .Ed .Pp -This is a non-standard GNU extension -and very rarely used even in GNU manual pages. +This is a GNU extension and rarely used even in GNU manual pages. Formatting is similar to .Ic IP . .It Ic TH @@ -437,8 +440,7 @@ unspecified, the saved or default width is used. Like .Ic TP , except that no vertical spacing is inserted before the paragraph. -This is a non-standard GNU extension -and very rarely used even in GNU manual pages. +This is a GNU extension and rarely used even in GNU manual pages. .It Ic UC Sets the volume for the footer for compatibility with man pages from .Bx @@ -449,10 +451,10 @@ This macro is an extension that first appeared in .It Ic UE End a uniform resource identifier block started with .Ic UR . -This is a non-standard GNU extension. +This is a GNU extension. .It Ic UR Begin a uniform resource identifier block. -This is a non-standard GNU extension. +This is a GNU extension. It has the following syntax: .Bd -unfilled -offset indent .Pf . Ic UR Ar uri @@ -462,7 +464,7 @@ link description to be shown .It Ic YS End a synopsis block started with .Ic SY . -This is a non-standard GNU extension. +This is a GNU extension. .It Ic in Indent relative to the current indentation: .Pp diff --git a/sys/dev/pci/if_iwx.c b/sys/dev/pci/if_iwx.c index 01bf04f48..612b68e3c 100644 --- a/sys/dev/pci/if_iwx.c +++ b/sys/dev/pci/if_iwx.c @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwx.c,v 1.176 2023/08/26 09:05:34 stsp Exp $ */ +/* $OpenBSD: if_iwx.c,v 1.177 2023/10/06 15:15:29 stsp Exp $ */ /* * Copyright (c) 2014, 2016 genua gmbh @@ -10127,6 +10127,16 @@ iwx_rx_pkt(struct iwx_softc *sc, struct iwx_rx_data *data, struct mbuf_list *ml) case IWX_WIDE_ID(IWX_DATA_PATH_GROUP, IWX_RLC_CONFIG_CMD): break; + /* + * Ignore for now. The Linux driver only acts on this request + * with 160Mhz channels in 11ax mode. + */ + case IWX_WIDE_ID(IWX_DATA_PATH_GROUP, + IWX_THERMAL_DUAL_CHAIN_REQUEST): + DPRINTF(("%s: thermal dual-chain request received\n", + DEVNAME(sc))); + break; + /* undocumented notification from iwx-ty-a0-gf-a0-77 image */ case IWX_WIDE_ID(IWX_DATA_PATH_GROUP, 0xf8): break; diff --git a/sys/dev/pci/if_iwxreg.h b/sys/dev/pci/if_iwxreg.h index fba5b09a4..8ce836b03 100644 --- a/sys/dev/pci/if_iwxreg.h +++ b/sys/dev/pci/if_iwxreg.h @@ -1,4 +1,4 @@ -/* $OpenBSD: if_iwxreg.h,v 1.51 2023/03/06 11:18:37 stsp Exp $ */ +/* $OpenBSD: if_iwxreg.h,v 1.52 2023/10/06 15:15:41 stsp Exp $ */ /*- * Based on BSD-licensed source modules in the Linux iwlwifi driver, @@ -2010,6 +2010,7 @@ struct iwx_tx_queue_cfg_rsp { #define IWX_RX_BAID_ALLOCATION_CONFIG_CMD 0x16 #define IWX_SCD_QUEUE_CONFIG_CMD 0x17 #define IWX_RX_NO_DATA_NOTIF 0xf5 +#define IWX_THERMAL_DUAL_CHAIN_REQUEST 0xf6 #define IWX_TLC_MNG_UPDATE_NOTIF 0xf7 /* REGULATORY_AND_NVM group subcommand IDs */ diff --git a/sys/dev/usb/ucom.c b/sys/dev/usb/ucom.c index 7b1fcf43b..336d3a3a4 100644 --- a/sys/dev/usb/ucom.c +++ b/sys/dev/usb/ucom.c @@ -1,4 +1,4 @@ -/* $OpenBSD: ucom.c,v 1.77 2023/10/02 23:38:11 krw Exp $ */ +/* $OpenBSD: ucom.c,v 1.78 2023/10/06 16:06:11 krw Exp $ */ /* $NetBSD: ucom.c,v 1.49 2003/01/01 00:10:25 thorpej Exp $ */ /* @@ -1256,7 +1256,7 @@ sysctl_ucominit(void) int rslt; unsigned int unit; uint32_t route; - uint8_t bus, ifaceidx; + uint8_t bus, ifaceno; KERNEL_ASSERT_LOCKED(); @@ -1272,11 +1272,11 @@ sysctl_ucominit(void) if (sc == NULL || sc->sc_iface == NULL) continue; if (usbd_get_location(sc->sc_uparent, sc->sc_iface, - &bus, &route, &ifaceidx) == -1) + &bus, &route, &ifaceno) == -1) continue; rslt = snprintf(name, sizeof(name), "%s:usb%u.%u.%05x.%u,", sc->sc_dev.dv_xname, bus, - ROUTEROOTPORT(route), ROUTESTRING(route), ifaceidx); + ROUTEROOTPORT(route), ROUTESTRING(route), ifaceno); if (rslt < sizeof(name) && (strlen(ucoms) + rslt) < ucomslen) strlcat(ucoms, name, ucomslen); diff --git a/sys/dev/usb/usb_subr.c b/sys/dev/usb/usb_subr.c index 817170369..44c028aaa 100644 --- a/sys/dev/usb/usb_subr.c +++ b/sys/dev/usb/usb_subr.c @@ -1,4 +1,4 @@ -/* $OpenBSD: usb_subr.c,v 1.161 2023/10/02 23:38:11 krw Exp $ */ +/* $OpenBSD: usb_subr.c,v 1.162 2023/10/06 16:06:11 krw Exp $ */ /* $NetBSD: usb_subr.c,v 1.103 2003/01/10 11:19:13 augustss Exp $ */ /* $FreeBSD: src/sys/dev/usb/usb_subr.c,v 1.18 1999/11/17 22:33:47 n_hibma Exp $ */ @@ -1362,7 +1362,7 @@ usbd_get_routestring(struct usbd_device *dev, uint32_t *route) int usbd_get_location(struct usbd_device *dev, struct usbd_interface *iface, - uint8_t *bus, uint32_t *route, uint8_t *ifaceidx) + uint8_t *bus, uint32_t *route, uint8_t *ifaceno) { int i; uint32_t r; @@ -1380,7 +1380,7 @@ usbd_get_location(struct usbd_device *dev, struct usbd_interface *iface, if (iface == &dev->ifaces[i]) { *bus = dev->bus->usbctl->dv_unit; *route = (usbd_get_routestring(dev, &r)) ? 0 : r; - *ifaceidx = i; + *ifaceno = i; return 0; } } diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c index 8d1abf9e2..6e88b37c5 100644 --- a/sys/kern/kern_sig.c +++ b/sys/kern/kern_sig.c @@ -1,4 +1,4 @@ -/* $OpenBSD: kern_sig.c,v 1.319 2023/09/29 12:47:34 claudio Exp $ */ +/* $OpenBSD: kern_sig.c,v 1.320 2023/10/06 08:58:13 claudio Exp $ */ /* $NetBSD: kern_sig.c,v 1.54 1996/04/22 01:38:32 christos Exp $ */ /* @@ -1812,7 +1812,6 @@ sys_nosys(struct proc *p, void *v, register_t *retval) int sys___thrsigdivert(struct proc *p, void *v, register_t *retval) { - static int sigwaitsleep; struct sys___thrsigdivert_args /* { syscallarg(sigset_t) sigmask; syscallarg(siginfo_t *) info; @@ -1863,8 +1862,7 @@ sys___thrsigdivert(struct proc *p, void *v, register_t *retval) if (error != 0) break; - error = tsleep_nsec(&sigwaitsleep, PPAUSE|PCATCH, "sigwait", - nsecs); + error = tsleep_nsec(&nowake, PPAUSE|PCATCH, "sigwait", nsecs); } if (error == 0) { diff --git a/usr.bin/awk/FIXES b/usr.bin/awk/FIXES index 6c2f1505e..e3dedacf4 100644 --- a/usr.bin/awk/FIXES +++ b/usr.bin/awk/FIXES @@ -25,6 +25,11 @@ THIS SOFTWARE. This file lists all bug fixes, changes, etc., made since the second edition of the AWK book was published in September 2023. +Sep 24, 2023: + fnematch and getrune have been overhauled to solve issues around + unicode FS and RS. also fixed gsub null match issue with unicode. + big thanks to Arnold Robbins. + Sep 12, 2023: Fixed a length error in u8_byte2char that set RSTART to incorrect (cannot happen) value for EOL match(str, /$/). diff --git a/usr.bin/awk/b.c b/usr.bin/awk/b.c index 5cf54abb8..670613799 100644 --- a/usr.bin/awk/b.c +++ b/usr.bin/awk/b.c @@ -1,4 +1,4 @@ -/* $OpenBSD: b.c,v 1.42 2023/09/21 17:19:06 millert Exp $ */ +/* $OpenBSD: b.c,v 1.44 2023/10/06 22:31:21 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -81,6 +81,8 @@ int patlen; fa *fatab[NFA]; int nfatab = 0; /* entries in fatab */ +extern int u8_nextlen(const char *s); + /* utf-8 mechanism: @@ -114,6 +116,7 @@ int nfatab = 0; /* entries in fatab */ static int get_gototab(fa*, int, int); static int set_gototab(fa*, int, int, int); +static void reset_gototab(fa*, int); extern int u8_rune(int *, const uschar *); static int * @@ -274,8 +277,7 @@ int makeinit(fa *f, bool anchor) } if ((f->posns[2])[1] == f->accept) f->out[2] = 1; - for (i = 0; i < NCHARS; i++) - set_gototab(f, 2, 0, 0); /* f->gototab[2][i] = 0; */ + reset_gototab(f, 2); f->curstat = cgoto(f, 2, HAT); if (anchor) { *f->posns[2] = k-1; /* leave out position 0 */ @@ -611,6 +613,11 @@ static int get_gototab(fa *f, int state, int ch) /* hide gototab inplementation return 0; } +static void reset_gototab(fa *f, int state) /* hide gototab inplementation */ +{ + memset(f->gototab[state], 0, f->gototab_len * sizeof(**f->gototab)); +} + static int set_gototab(fa *f, int state, int ch, int val) /* hide gototab inplementation */ { int i; @@ -760,33 +767,59 @@ int nematch(fa *f, const char *p0) /* non-empty match, for sub */ return (0); } -static int getrune(FILE *fp, char **pbuf, int *pbufsize, int quantum, - int *curpos, int *lastpos) -{ - int c = 0; - char *buf = *pbuf; - static const int max_bytes = 4; // max multiple bytes in UTF-8 is 4 - int i, rune; - uschar private_buf[max_bytes + 1]; - for (i = 0; i <= max_bytes; i++) { - if (++*curpos == *lastpos) { - if (*lastpos == *pbufsize) - if (!adjbuf((char **) pbuf, pbufsize, *pbufsize+1, quantum, 0, "getrune")) - FATAL("stream '%.30s...' too long", buf); - buf[(*lastpos)++] = (c = getc(fp)) != EOF ? c : 0; - private_buf[i] = c; - } - if (c == 0 || c < 128 || (c >> 6) == 4) { // 10xxxxxx starts a new character - ungetc(c, fp); - private_buf[i] = 0; - break; - } +#define MAX_UTF_BYTES 4 // UTF-8 is up to 4 bytes long + +// Read one rune at a time from the given FILE*. Return both +// the bytes and the actual rune. + +struct runedata { + int rune; + size_t len; + char bytes[6]; +}; + +struct runedata getrune(FILE *fp) +{ + struct runedata result; + int c, i, next; + + memset(&result, 0, sizeof(result)); + + c = getc(fp); + if (c == EOF) + return result; // result.rune == 0 --> EOF + else if (c < 128 || awk_mb_cur_max == 1) { + result.bytes[0] = c; + result.len = 1; + result.rune = c; + + return result; } - u8_rune(& rune, private_buf); + // need to get bytes and fill things in + result.bytes[0] = c; + result.len = 1; - return rune; + next = 1; + for (i = 1; i < MAX_UTF_BYTES; i++) { + c = getc(fp); + if (c == EOF) + break; + result.bytes[next++] = c; + result.len++; + } + + // put back any extra input bytes + int actual_len = u8_nextlen(result.bytes); + while (result.len > actual_len) { + ungetc(result.bytes[--result.len], fp); + } + + result.bytes[result.len] = '\0'; + (void) u8_rune(& result.rune, (uschar *) result.bytes); + + return result; } @@ -809,8 +842,8 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum) { char *buf = *pbuf; int bufsize = *pbufsize; - int c, i, j, k, ns, s; - int rune; + int i, j, k, ns, s; + struct runedata r; s = pfa->initstat; patlen = 0; @@ -819,42 +852,38 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum) * All indices relative to buf. * i <= j <= k <= bufsize * - * i: origin of active substring - * j: current character + * i: origin of active substring (first byte of first character) + * j: current character (last byte of current character) * k: destination of next getc() */ i = -1, k = 0; do { j = i++; do { - if (++j == k) { - if (k == bufsize) + r = getrune(f); + if ((++j + r.len) >= k) { + if (k >= bufsize) if (!adjbuf(&buf, &bufsize, bufsize+1, quantum, 0, "fnematch")) FATAL("stream '%.30s...' too long", buf); - buf[k++] = (c = getc(f)) != EOF ? c : 0; - } - c = (uschar)buf[j]; - if (c < 128 || awk_mb_cur_max == 1) - rune = c; - else { - j--; - k--; - ungetc(c, f); - rune = getrune(f, &buf, &bufsize, quantum, &j, &k); } + memcpy(buf + k, r.bytes, r.len); + j += r.len - 1; // incremented next time around the loop + k += r.len; - if ((ns = get_gototab(pfa, s, rune)) != 0) + if ((ns = get_gototab(pfa, s, r.rune)) != 0) s = ns; else - s = cgoto(pfa, s, rune); + s = cgoto(pfa, s, r.rune); if (pfa->out[s]) { /* final state */ patlen = j - i + 1; - if (c == 0) /* don't count $ */ + if (r.rune == 0) /* don't count $ */ patlen--; } } while (buf[j] && s != 1); s = 2; + if (r.len > 1) + i += r.len - 1; // i incremented around the loop } while (buf[i] && !patlen); /* adjbuf() may have relocated a resized buffer. Inform the world. */ @@ -874,10 +903,12 @@ bool fnematch(fa *pfa, FILE *f, char **pbuf, int *pbufsize, int quantum) * (except for EOF's nullbyte, if present) and null * terminate the buffer. */ - do - if (buf[--k] && ungetc(buf[k], f) == EOF) - FATAL("unable to ungetc '%c'", buf[k]); - while (k > i + patlen); + do { + int ii; + for (ii = r.len; ii > 0; ii--) + if (buf[--k] && ungetc(buf[k], f) == EOF) + FATAL("unable to ungetc '%c'", buf[k]); + } while (k > i + patlen); buf[k] = '\0'; return true; } @@ -1466,8 +1497,6 @@ int cgoto(fa *f, int s, int c) /* add tmpset to current set of states */ ++(f->curstat); resize_state(f, f->curstat); - for (i = 0; i < NCHARS; i++) - set_gototab(f, f->curstat, 0, 0); xfree(f->posns[f->curstat]); p = intalloc(setcnt + 1, __func__); diff --git a/usr.bin/awk/lib.c b/usr.bin/awk/lib.c index fafe32fa6..1ef860433 100644 --- a/usr.bin/awk/lib.c +++ b/usr.bin/awk/lib.c @@ -1,4 +1,4 @@ -/* $OpenBSD: lib.c,v 1.51 2023/09/17 14:49:44 millert Exp $ */ +/* $OpenBSD: lib.c,v 1.52 2023/10/06 22:29:24 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -234,6 +234,7 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag) /* read one rec } else if (*rs && rs[1]) { bool found; + memset(buf, 0, bufsize); fa *pfa = makedfa(rs, 1); if (newflag) found = fnematch(pfa, inf, &buf, &bufsize, recsize); diff --git a/usr.bin/awk/main.c b/usr.bin/awk/main.c index 2ec0bc7d9..55794c6ff 100644 --- a/usr.bin/awk/main.c +++ b/usr.bin/awk/main.c @@ -1,4 +1,4 @@ -/* $OpenBSD: main.c,v 1.62 2023/09/20 16:57:12 millert Exp $ */ +/* $OpenBSD: main.c,v 1.63 2023/10/06 22:29:24 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -23,7 +23,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -const char *version = "version 20230913"; +const char *version = "version 20231001"; #define DEBUG #include diff --git a/usr.bin/awk/run.c b/usr.bin/awk/run.c index b7397905d..ae8fa7491 100644 --- a/usr.bin/awk/run.c +++ b/usr.bin/awk/run.c @@ -1,4 +1,4 @@ -/* $OpenBSD: run.c,v 1.78 2023/09/20 16:49:13 millert Exp $ */ +/* $OpenBSD: run.c,v 1.79 2023/10/06 22:29:24 millert Exp $ */ /**************************************************************** Copyright (C) Lucent Technologies 1997 All Rights Reserved @@ -2587,6 +2587,7 @@ Cell *gsub(Node **a, int nnn) /* global substitute */ fa *pfa; int mflag, tempstat, num; int bufsz = recsize; + int charlen = 0; if ((buf = (char *) malloc(bufsz)) == NULL) FATAL("out of memory in gsub"); @@ -2628,7 +2629,9 @@ Cell *gsub(Node **a, int nnn) /* global substitute */ if (*t == '\0') /* at end */ goto done; adjbuf(&buf, &bufsz, 2+pb-buf, recsize, &pb, "gsub"); - *pb++ = *t++; + charlen = u8_nextlen(t); + while (charlen-- > 0) + *pb++ = *t++; if (pb > buf + bufsz) /* BUG: not sure of this test */ FATAL("gsub result0 %.30s too big; can't happen", buf); mflag = 0; diff --git a/usr.sbin/dhcpd/dhcpd.c b/usr.sbin/dhcpd/dhcpd.c index f5f8fd101..926df9172 100644 --- a/usr.sbin/dhcpd/dhcpd.c +++ b/usr.sbin/dhcpd/dhcpd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: dhcpd.c,v 1.58 2023/10/05 18:46:14 mvs Exp $ */ +/* $OpenBSD: dhcpd.c,v 1.59 2023/10/06 05:31:54 jmc Exp $ */ /* * Copyright (c) 2004 Henning Brauer @@ -276,7 +276,7 @@ usage(void) { extern char *__progname; - fprintf(stderr, "usage: %s [-dfn] [-A abandoned_ip_table]", + fprintf(stderr, "usage: %s [-dfnv] [-A abandoned_ip_table]", __progname); fprintf(stderr, " [-C changed_ip_table]\n"); fprintf(stderr, "\t[-c config-file] [-L leased_ip_table]"); diff --git a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm index e3ab88787..ce58a9cf1 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgAdd.pm @@ -1,7 +1,7 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgAdd.pm,v 1.143 2023/07/03 19:12:08 espie Exp $ +# $OpenBSD: PkgAdd.pm,v 1.144 2023/10/07 09:11:26 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -1112,6 +1112,16 @@ sub grab_debug_package($class, $d, $dbg, $state) } } +sub report_cantupdate($state, $cantupdate) +{ + if ($state->tracker->did_something) { + $state->say("Couldn't find updates for #1", + join(' ', sort @$cantupdate)); + } else { + $state->say("Couldn't find any update"); + } +} + sub inform_user_of_problems($state) { my @cantupdate = $state->tracker->cant_list; @@ -1120,10 +1130,8 @@ sub inform_user_of_problems($state) sub($quirks) { $quirks->filter_obsolete(\@cantupdate, $state); }); - - $state->say("Couldn't find updates for #1", - join(' ', sort @cantupdate)) if @cantupdate > 0; if (@cantupdate > 0) { + report_cantupdate($state, \@cantupdate); $state->{bad}++; } } diff --git a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm index 25747698c..c6e40eaa6 100644 --- a/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm +++ b/usr.sbin/pkg_add/OpenBSD/PkgCreate.pm @@ -1,6 +1,6 @@ #! /usr/bin/perl # ex:ts=8 sw=4: -# $OpenBSD: PkgCreate.pm,v 1.195 2023/07/20 17:56:37 espie Exp $ +# $OpenBSD: PkgCreate.pm,v 1.196 2023/10/07 09:09:07 espie Exp $ # # Copyright (c) 2003-2014 Marc Espie # @@ -1684,7 +1684,7 @@ sub run_command($self, $state) } $state->{stash} = {}; - if ($state->{bad} && !$state->defines('REGRESSION_TESTING')) { + if ($state->{bad} && !$state->{regression}{plist_checks}) { $state->fatal("can't continue"); } $state->{bad} = 0; diff --git a/usr.sbin/pkg_add/OpenBSD/Tracker.pm b/usr.sbin/pkg_add/OpenBSD/Tracker.pm index 485a4e931..a7d555929 100644 --- a/usr.sbin/pkg_add/OpenBSD/Tracker.pm +++ b/usr.sbin/pkg_add/OpenBSD/Tracker.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Tracker.pm,v 1.31 2023/06/13 09:07:17 espie Exp $ +# $OpenBSD: Tracker.pm,v 1.32 2023/10/07 09:10:03 espie Exp $ # # Copyright (c) 2009 Marc Espie # @@ -101,6 +101,9 @@ sub add_set($self, $set) for my $n ($set->kept) { delete $self->{to_update}{$n->pkgname}; $self->{uptodate}{$n->pkgname} = 1; + if ($n->{is_firmware}) { + $self->{firmware}{$n->pkgname} = 1; + } } $self->known($set); $self->handle_set($set); @@ -134,6 +137,9 @@ sub uptodate($self, $set) $self->remove_set($set); for my $n ($set->older, $set->kept) { $self->{uptodate}{$n->pkgname} = 1; + if ($n->{is_firmware}) { + $self->{firmware}{$n->pkgname} = 1; + } } } @@ -198,6 +204,15 @@ sub cant_list($self) return keys %{$self->{cant_update}}; } +sub did_something($self) +{ + for my $k (keys %{$self->{uptodate}}) { + next if $self->{firmware}{$k}; + return 1; + } + return 0; +} + sub cant_install_list($self) { return keys %{$self->{cant_install}}; diff --git a/usr.sbin/pkg_add/OpenBSD/Update.pm b/usr.sbin/pkg_add/OpenBSD/Update.pm index 82b0bf5ec..e2f3da112 100644 --- a/usr.sbin/pkg_add/OpenBSD/Update.pm +++ b/usr.sbin/pkg_add/OpenBSD/Update.pm @@ -1,5 +1,5 @@ # ex:ts=8 sw=4: -# $OpenBSD: Update.pm,v 1.170 2023/06/13 09:07:17 espie Exp $ +# $OpenBSD: Update.pm,v 1.171 2023/10/07 09:10:03 espie Exp $ # # Copyright (c) 2004-2014 Marc Espie # @@ -117,6 +117,7 @@ sub process_handle($self, $set, $h, $state) if ($plist->has('firmware') && !$state->defines('FW_UPDATE')) { $set->move_kept($h); + $h->{is_firmware} = 1; return 0; }