From nobody Sun Dec 01 17:33:09 2024 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Y1Ysf0LPyz5fwNy; Sun, 01 Dec 2024 17:33:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Y1Ysd6xx5z40kL; Sun, 1 Dec 2024 17:33:09 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733074390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d2sj0b3dcTIjUaxZ/UsLtMPDTiN023w0UqeSN/fBuK0=; b=FnOUkro7Tl8ILAe3FgT5V6FACQs1Lv/48HzF3H8SzRgOj+G6tMphjGa1lWwYBbGC9x/FrD SmvdMrYjq15idDT6mb15UOLzJRtljRwy4tDPALgLJHjlcVxoCPU3bKGnykshl+V02FSBKR fhBoq5rnMl94o+rB1XCfBYsbKo+1v6zwWHJA37eQj6KkHi1ViHln1rAyQH7ORgizW3wuOC nxj4AunSPHf/QLzaGadECAA7DmZs1QfdTDT5tyw/bGh6jJpEXMoDnLVIzsAM9LisK64YiG NNo7WxQ70vUZq2AlpBIqFeinYVYG8nDLTAJpd9MjeN44ZPXf5kZIEQJBptn0PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1733074390; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=d2sj0b3dcTIjUaxZ/UsLtMPDTiN023w0UqeSN/fBuK0=; b=xjFOp8c9anYTisNR0XXdeGKaOQzvbyJm1JgBQELgqu9sVVbfOgOigXy0u81JSW0LQ/5fHL 957HTT7KICtNcqAtdp5nPk2cZl8H5hXdH9zSS8atIZkQWw1vpdM+HOIZvmoWq/SA2zpc5x upwVplsn85UmYYQ0osUFgRpQOVJJdodl9ZsxOPxgKcVhXSgwY86TMZ8lYwxI7qwTt7nZhW Lw04RxWGZX5OZJkAzamLSgya1NmT1LhLTEd4vd3U+IfTHTqfScQAxXiG/fIg5T3iAii22I AAL5bDVUbdcJOPLKnkWtCGAuud3Rp5JFfQmNXGlsWmDU2pOoagfFDlIdF+obMw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1733074390; a=rsa-sha256; cv=none; b=sAd+mAjRZgxwFmdKzHN9FE5N04w9bqaD5R/Ejml6KPi5Zwq6gxWzbFUuYgDE6p/U0irhlO MHj/1CA4sJMmv3syLqI//WoTZvgdP0EK6ArrjPXyhX5rRdub8wh/IKFFeDJW3lyGBgQQoO DBYI1+ZRA5LsmxCaFXsz2EfFHogM5feHMmGvgLSBcZastUxEluOiGavdHSHh9byTlxgZj3 FNuhpsEDajilVIMboMnYhAlZR6/7swVGf0+YZfCzvlxM1kSEM4gc7gvXzzTR4FoI2sU4/k XjmRDtRweEMSXDh+CztKYJTjncNNOv+NdQp4ZuQS1/uQHEp+qEx6yxuJqehAiQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4Y1Ysd6Dbrz12qY; Sun, 1 Dec 2024 17:33:09 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 4B1HX9C9014637; Sun, 1 Dec 2024 17:33:09 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 4B1HX9og014633; Sun, 1 Dec 2024 17:33:09 GMT (envelope-from git) Date: Sun, 1 Dec 2024 17:33:09 GMT Message-Id: <202412011733.4B1HX9og014633@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Warner Losh Subject: git: 955208d636fc - stable/14 - ota: Merge 20240728 (bsd-feature) from ota 3319c34a8713 List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: imp X-Git-Repository: src X-Git-Refname: refs/heads/stable/14 X-Git-Reftype: branch X-Git-Commit: 955208d636fc453f655136dacf8ddc12287667d0 Auto-Submitted: auto-generated The branch stable/14 has been updated by imp: URL: https://cgit.FreeBSD.org/src/commit/?id=955208d636fc453f655136dacf8ddc12287667d0 commit 955208d636fc453f655136dacf8ddc12287667d0 Author: Warner Losh AuthorDate: 2024-11-30 04:57:45 +0000 Commit: Warner Losh CommitDate: 2024-12-01 17:33:16 +0000 ota: Merge 20240728 (bsd-feature) from ota 3319c34a8713 Jul 28, 2024 Fixed readcsvrec resize segfault when reading csv records longer than 8k. Thanks to Ozan Yigit. mktime() added to bsd-features branch. Thanks to Todd Miller. (cherry picked from commit 8d457988a72487b35ee3922671775d73169339e3) --- contrib/one-true-awk/FIXES | 5 +++++ contrib/one-true-awk/awk.h | 1 + contrib/one-true-awk/b.c | 2 +- contrib/one-true-awk/lex.c | 1 + contrib/one-true-awk/lib.c | 2 +- contrib/one-true-awk/main.c | 2 +- contrib/one-true-awk/run.c | 22 +++++++++++++++++++++- 7 files changed, 31 insertions(+), 4 deletions(-) diff --git a/contrib/one-true-awk/FIXES b/contrib/one-true-awk/FIXES index b59f32831e2c..ad8bce2645fd 100644 --- a/contrib/one-true-awk/FIXES +++ b/contrib/one-true-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. +Jul 28, 2024 + Fixed readcsvrec resize segfault when reading csv records longer + than 8k. Thanks to Ozan Yigit. + mktime() added to bsd-features branch. Thanks to Todd Miller. + Jun 23, 2024 Fix signal for system-status test. Thanks to Tim van der Molen. Rewrite if-else chain as switch. Thanks to Andrew Sukach. diff --git a/contrib/one-true-awk/awk.h b/contrib/one-true-awk/awk.h index 76c2a772b4ce..a57c1598d67e 100644 --- a/contrib/one-true-awk/awk.h +++ b/contrib/one-true-awk/awk.h @@ -162,6 +162,7 @@ extern Cell *symtabloc; /* SYMTAB */ #define FRSHIFT 20 #define FSYSTIME 21 #define FSTRFTIME 22 +#define FMKTIME 23 /* Node: parse tree is made of nodes, with Cell's at bottom */ diff --git a/contrib/one-true-awk/b.c b/contrib/one-true-awk/b.c index a8f67785a6ea..455e6f812d3e 100644 --- a/contrib/one-true-awk/b.c +++ b/contrib/one-true-awk/b.c @@ -616,7 +616,7 @@ static void resize_gototab(fa *f, int state) if (p == NULL) overflo(__func__); - // need to initialized the new memory to zero + // need to initialize the new memory to zero size_t orig_size = f->gototab[state].allocated; // 2nd half of new mem is this size memset(p + orig_size, 0, orig_size * sizeof(gtte)); // clean it out diff --git a/contrib/one-true-awk/lex.c b/contrib/one-true-awk/lex.c index 7c61bba46d13..c135db4dfb67 100644 --- a/contrib/one-true-awk/lex.c +++ b/contrib/one-true-awk/lex.c @@ -74,6 +74,7 @@ const Keyword keywords[] = { /* keep sorted: binary searched */ { "log", FLOG, BLTIN }, { "lshift", FLSHIFT, BLTIN }, { "match", MATCHFCN, MATCHFCN }, + { "mktime", FMKTIME, BLTIN }, { "next", NEXT, NEXT }, { "nextfile", NEXTFILE, NEXTFILE }, { "or", FFOR, BLTIN }, diff --git a/contrib/one-true-awk/lib.c b/contrib/one-true-awk/lib.c index 4b0addf21525..c2ed4f2607ac 100644 --- a/contrib/one-true-awk/lib.c +++ b/contrib/one-true-awk/lib.c @@ -231,7 +231,7 @@ int readrec(char **pbuf, int *pbufsize, FILE *inf, bool newflag) /* read one rec char *rs = getsval(rsloc); if (CSV) { - c = readcsvrec(pbuf, pbufsize, inf, newflag); + c = readcsvrec(&buf, &bufsize, inf, newflag); isrec = (c == EOF && rr == buf) ? false : true; } else if (*rs && rs[1]) { bool found; diff --git a/contrib/one-true-awk/main.c b/contrib/one-true-awk/main.c index 02d02991bce7..7d3ef84a580f 100644 --- a/contrib/one-true-awk/main.c +++ b/contrib/one-true-awk/main.c @@ -22,7 +22,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ****************************************************************/ -const char *version = "version 20240623"; +const char *version = "version 20240728"; #define DEBUG #include diff --git a/contrib/one-true-awk/run.c b/contrib/one-true-awk/run.c index 3f9f3d8626fc..286a601f3311 100644 --- a/contrib/one-true-awk/run.c +++ b/contrib/one-true-awk/run.c @@ -2069,7 +2069,7 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis FILE *fp; int status = 0; time_t tv; - struct tm *tm; + struct tm *tm, tmbuf; int estatus = 0; t = ptoi(a[0]); @@ -2223,6 +2223,26 @@ Cell *bltin(Node **a, int n) /* builtin functions. a[0] is type, a[1] is arg lis else u = fflush(fp); break; + case FMKTIME: + memset(&tmbuf, 0, sizeof(tmbuf)); + tm = &tmbuf; + t = sscanf(getsval(x), "%d %d %d %d %d %d %d", + &tm->tm_year, &tm->tm_mon, &tm->tm_mday, &tm->tm_hour, + &tm->tm_min, &tm->tm_sec, &tm->tm_isdst); + switch (t) { + case 6: + tm->tm_isdst = -1; /* let mktime figure it out */ + /* FALLTHROUGH */ + case 7: + tm->tm_year -= 1900; + tm->tm_mon--; + u = mktime(tm); + break; + default: + u = -1; + break; + } + break; case FSYSTIME: u = time((time_t *) 0); break;