From 80770716279ced2795dbdec6b92cc1a06be2ab61 Mon Sep 17 00:00:00 2001 From: Michael Forney Date: Wed, 7 Nov 2018 13:58:29 -0800 Subject: Build nc from libressl This way we don't have to maintain the nc linux port patch ourselves. It also avoids a circular dependency between the libressl and openbsd packages. --- pkg/openbsd/gen.lua | 8 - pkg/openbsd/include/netinet/ip.h | 9 + pkg/openbsd/patch/0018-nc-Port-to-linux.patch | 111 ------- pkg/openbsd/patch/0018-yacc-Remove-__unused.patch | 27 ++ .../patch/0019-Add-standalone-freezero.patch | 51 ++++ pkg/openbsd/patch/0019-yacc-Remove-__unused.patch | 27 -- .../patch/0020-Add-standalone-freezero.patch | 51 ---- ...-written-lexer-to-avoid-cycle-in-bootstra.patch | 327 +++++++++++++++++++++ .../0021-m4-Use-_Noreturn-instead-of-__dead.patch | 25 ++ ...-written-lexer-to-avoid-cycle-in-bootstra.patch | 327 --------------------- .../patch/0022-m4-Add-missing-includes.patch | 37 +++ .../0022-m4-Use-_Noreturn-instead-of-__dead.patch | 25 -- .../patch/0023-libutil-Add-missing-includes.patch | 24 ++ .../patch/0023-m4-Add-missing-includes.patch | 37 --- .../patch/0024-libutil-Add-missing-includes.patch | 24 -- 15 files changed, 500 insertions(+), 610 deletions(-) create mode 100644 pkg/openbsd/include/netinet/ip.h delete mode 100644 pkg/openbsd/patch/0018-nc-Port-to-linux.patch create mode 100644 pkg/openbsd/patch/0018-yacc-Remove-__unused.patch create mode 100644 pkg/openbsd/patch/0019-Add-standalone-freezero.patch delete mode 100644 pkg/openbsd/patch/0019-yacc-Remove-__unused.patch delete mode 100644 pkg/openbsd/patch/0020-Add-standalone-freezero.patch create mode 100644 pkg/openbsd/patch/0020-m4-Use-hand-written-lexer-to-avoid-cycle-in-bootstra.patch create mode 100644 pkg/openbsd/patch/0021-m4-Use-_Noreturn-instead-of-__dead.patch delete mode 100644 pkg/openbsd/patch/0021-m4-Use-hand-written-lexer-to-avoid-cycle-in-bootstra.patch create mode 100644 pkg/openbsd/patch/0022-m4-Add-missing-includes.patch delete mode 100644 pkg/openbsd/patch/0022-m4-Use-_Noreturn-instead-of-__dead.patch create mode 100644 pkg/openbsd/patch/0023-libutil-Add-missing-includes.patch delete mode 100644 pkg/openbsd/patch/0023-m4-Add-missing-includes.patch delete mode 100644 pkg/openbsd/patch/0024-libutil-Add-missing-includes.patch (limited to 'pkg/openbsd') diff --git a/pkg/openbsd/gen.lua b/pkg/openbsd/gen.lua index fb11c973..6434d5a4 100644 --- a/pkg/openbsd/gen.lua +++ b/pkg/openbsd/gen.lua @@ -56,14 +56,6 @@ exe('m4', [[ file('bin/m4', '755', '$outdir/m4') man{'usr.bin/m4/m4.1'} --- nc -exe('nc', [[ - usr.bin/nc/(netcat.c atomicio.c socks.c) - $builddir/pkg/libressl/libtls.a.d -]], {'pkg/libressl/headers'}) -file('bin/nc', '755', '$outdir/nc') -man{'usr.bin/nc/nc.1'} - -- patch exe('patch', 'usr.bin/patch/(patch.c pch.c inp.c util.c backupfile.c mkpath.c ed.c) libbsd.a') file('bin/patch', '755', '$outdir/patch') diff --git a/pkg/openbsd/include/netinet/ip.h b/pkg/openbsd/include/netinet/ip.h new file mode 100644 index 00000000..238358c9 --- /dev/null +++ b/pkg/openbsd/include/netinet/ip.h @@ -0,0 +1,9 @@ +#include_next +#define IPTOS_DSCP_CS0 0x00 +#define IPTOS_DSCP_CS1 0x20 +#define IPTOS_DSCP_CS2 0x40 +#define IPTOS_DSCP_CS3 0x60 +#define IPTOS_DSCP_CS4 0x80 +#define IPTOS_DSCP_CS5 0xa0 +#define IPTOS_DSCP_CS6 0xc0 +#define IPTOS_DSCP_CS7 0xe0 diff --git a/pkg/openbsd/patch/0018-nc-Port-to-linux.patch b/pkg/openbsd/patch/0018-nc-Port-to-linux.patch deleted file mode 100644 index 6c9f5182..00000000 --- a/pkg/openbsd/patch/0018-nc-Port-to-linux.patch +++ /dev/null @@ -1,111 +0,0 @@ -From 0d05008cdf8188f66789de23e581d46608ad036b Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Fri, 16 Jun 2017 20:32:42 -0700 -Subject: [PATCH] nc: Port to linux - ---- - usr.bin/nc/netcat.c | 45 +++++++++++++++++++++++++++++++-------------- - 1 file changed, 31 insertions(+), 14 deletions(-) - -diff --git a/usr.bin/nc/netcat.c b/usr.bin/nc/netcat.c -index 3798dc760f1..6cbf346ed10 100644 ---- a/usr.bin/nc/netcat.c -+++ b/usr.bin/nc/netcat.c -@@ -73,6 +73,31 @@ - #define TLS_CCERT (1 << 3) - #define TLS_MUSTSTAPLE (1 << 4) - -+#ifndef IPTOS_DSCP_CS0 -+# define IPTOS_DSCP_CS0 0x00 -+#endif -+#ifndef IPTOS_DSCP_CS1 -+# define IPTOS_DSCP_CS1 0x20 -+#endif -+#ifndef IPTOS_DSCP_CS2 -+# define IPTOS_DSCP_CS2 0x40 -+#endif -+#ifndef IPTOS_DSCP_CS3 -+# define IPTOS_DSCP_CS3 0x60 -+#endif -+#ifndef IPTOS_DSCP_CS4 -+# define IPTOS_DSCP_CS4 0x80 -+#endif -+#ifndef IPTOS_DSCP_CS5 -+# define IPTOS_DSCP_CS5 0xa0 -+#endif -+#ifndef IPTOS_DSCP_CS6 -+# define IPTOS_DSCP_CS6 0xc0 -+#endif -+#ifndef IPTOS_DSCP_CS7 -+# define IPTOS_DSCP_CS7 0xe0 -+#endif -+ - /* Command Line Options */ - int dflag; /* detached, no stdin */ - int Fflag; /* fdpass sock to stdout */ -@@ -95,7 +120,6 @@ int Iflag; /* TCP receive buffer size */ - int Oflag; /* TCP send buffer size */ - int Sflag; /* TCP MD5 signature option */ - int Tflag = -1; /* IP Type of Service */ --int rtableid = -1; - - int usetls; /* use TLS */ - char *Cflag; /* Public cert file */ -@@ -267,12 +291,6 @@ main(int argc, char *argv[]) - case 'u': - uflag = 1; - break; -- case 'V': -- rtableid = (int)strtonum(optarg, 0, -- RT_TABLEID_MAX, &errstr); -- if (errstr) -- errx(1, "rtable %s: %s", errstr, optarg); -- break; - case 'v': - vflag = 1; - break; -@@ -345,10 +363,6 @@ main(int argc, char *argv[]) - argc -= optind; - argv += optind; - -- if (rtableid >= 0) -- if (setrtable(rtableid) == -1) -- err(1, "setrtable"); -- - /* Cruft to make sure options are clean, and used properly. */ - if (argv[0] && !argv[1] && family == AF_UNIX) { - host = argv[0]; -@@ -923,8 +937,12 @@ remote_connect(const char *host, const char *port, struct addrinfo hints) - if (sflag || pflag) { - struct addrinfo ahints, *ares; - -- /* try SO_BINDANY, but don't insist */ -+ /* try SO_BINDANY/IP_TRANSPARENT, but don't insist */ -+#if defined(SO_BINDANY) - setsockopt(s, SOL_SOCKET, SO_BINDANY, &on, sizeof(on)); -+#elif defined(IP_TRANSPARENT) -+ setsockopt(s, SOL_IP, IP_TRANSPARENT, &on, sizeof(on)); -+#endif - memset(&ahints, 0, sizeof(struct addrinfo)); - ahints.ai_family = res->ai_family; - ahints.ai_socktype = uflag ? SOCK_DGRAM : SOCK_STREAM; -@@ -1754,7 +1772,6 @@ help(void) - \t-t Answer TELNET negotiation\n\ - \t-U Use UNIX domain socket\n\ - \t-u UDP mode\n\ -- \t-V rtable Specify alternate routing table\n\ - \t-v Verbose\n\ - \t-W recvlimit Terminate after receiving a number of packets\n\ - \t-w timeout Timeout for connects and final net reads\n\ -@@ -1775,7 +1792,7 @@ usage(int ret) - "\t [-i interval] [-K keyfile] [-M ttl] [-m minttl] [-O length]\n" - "\t [-o staplefile] [-P proxy_username] [-p source_port] " - "[-R CAfile]\n" -- "\t [-s source] [-T keyword] [-V rtable] [-W recvlimit] " -+ "\t [-s source] [-T keyword] [-W recvlimit] " - "[-w timeout]\n" - "\t [-X proxy_protocol] [-x proxy_address[:port]] " - "[-Z peercertfile]\n" --- -2.19.0 - diff --git a/pkg/openbsd/patch/0018-yacc-Remove-__unused.patch b/pkg/openbsd/patch/0018-yacc-Remove-__unused.patch new file mode 100644 index 00000000..d8e49be7 --- /dev/null +++ b/pkg/openbsd/patch/0018-yacc-Remove-__unused.patch @@ -0,0 +1,27 @@ +From 8c468833465d7fa0d5372807de01272414b1f4bb Mon Sep 17 00:00:00 2001 +From: Michael Forney +Date: Tue, 10 Oct 2017 02:55:38 -0700 +Subject: [PATCH] yacc: Remove __unused + +We can't define this to __attribute__((unused)) because musl uses this +identifier as a structure field. +--- + usr.bin/yacc/main.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c +index 3d9f6add5c8..dd34a04c5bf 100644 +--- a/usr.bin/yacc/main.c ++++ b/usr.bin/yacc/main.c +@@ -122,7 +122,7 @@ done(int k) + + + void +-onintr(__unused int signo) ++onintr(int signo) + { + sigdie = 1; + done(1); +-- +2.14.2 + diff --git a/pkg/openbsd/patch/0019-Add-standalone-freezero.patch b/pkg/openbsd/patch/0019-Add-standalone-freezero.patch new file mode 100644 index 00000000..249a3e4d --- /dev/null +++ b/pkg/openbsd/patch/0019-Add-standalone-freezero.patch @@ -0,0 +1,51 @@ +From 98a3b77cfa775c87010159d49f5b17d84fe1aa7b Mon Sep 17 00:00:00 2001 +From: Michael Forney +Date: Tue, 10 Oct 2017 03:07:56 -0700 +Subject: [PATCH] Add standalone freezero + +--- + lib/libc/stdlib/freezero.c | 32 ++++++++++++++++++++++++++++++++ + 1 file changed, 32 insertions(+) + create mode 100644 lib/libc/stdlib/freezero.c + +diff --git a/lib/libc/stdlib/freezero.c b/lib/libc/stdlib/freezero.c +new file mode 100644 +index 00000000000..31face3828b +--- /dev/null ++++ b/lib/libc/stdlib/freezero.c +@@ -0,0 +1,32 @@ ++/* ++ * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek ++ * Copyright (c) 2012 Matthew Dempsky ++ * Copyright (c) 2008 Damien Miller ++ * Copyright (c) 2000 Poul-Henning Kamp ++ * ++ * Permission to use, copy, modify, and distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ */ ++ ++#include ++#include ++ ++void ++freezero(void *ptr, size_t sz) ++{ ++ /* This is legal. */ ++ if (ptr == NULL) ++ return; ++ ++ explicit_bzero(ptr, sz); ++ free(ptr); ++} +-- +2.14.2 + diff --git a/pkg/openbsd/patch/0019-yacc-Remove-__unused.patch b/pkg/openbsd/patch/0019-yacc-Remove-__unused.patch deleted file mode 100644 index d8e49be7..00000000 --- a/pkg/openbsd/patch/0019-yacc-Remove-__unused.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 8c468833465d7fa0d5372807de01272414b1f4bb Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Tue, 10 Oct 2017 02:55:38 -0700 -Subject: [PATCH] yacc: Remove __unused - -We can't define this to __attribute__((unused)) because musl uses this -identifier as a structure field. ---- - usr.bin/yacc/main.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/usr.bin/yacc/main.c b/usr.bin/yacc/main.c -index 3d9f6add5c8..dd34a04c5bf 100644 ---- a/usr.bin/yacc/main.c -+++ b/usr.bin/yacc/main.c -@@ -122,7 +122,7 @@ done(int k) - - - void --onintr(__unused int signo) -+onintr(int signo) - { - sigdie = 1; - done(1); --- -2.14.2 - diff --git a/pkg/openbsd/patch/0020-Add-standalone-freezero.patch b/pkg/openbsd/patch/0020-Add-standalone-freezero.patch deleted file mode 100644 index 249a3e4d..00000000 --- a/pkg/openbsd/patch/0020-Add-standalone-freezero.patch +++ /dev/null @@ -1,51 +0,0 @@ -From 98a3b77cfa775c87010159d49f5b17d84fe1aa7b Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Tue, 10 Oct 2017 03:07:56 -0700 -Subject: [PATCH] Add standalone freezero - ---- - lib/libc/stdlib/freezero.c | 32 ++++++++++++++++++++++++++++++++ - 1 file changed, 32 insertions(+) - create mode 100644 lib/libc/stdlib/freezero.c - -diff --git a/lib/libc/stdlib/freezero.c b/lib/libc/stdlib/freezero.c -new file mode 100644 -index 00000000000..31face3828b ---- /dev/null -+++ b/lib/libc/stdlib/freezero.c -@@ -0,0 +1,32 @@ -+/* -+ * Copyright (c) 2008, 2010, 2011, 2016 Otto Moerbeek -+ * Copyright (c) 2012 Matthew Dempsky -+ * Copyright (c) 2008 Damien Miller -+ * Copyright (c) 2000 Poul-Henning Kamp -+ * -+ * Permission to use, copy, modify, and distribute this software for any -+ * purpose with or without fee is hereby granted, provided that the above -+ * copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ */ -+ -+#include -+#include -+ -+void -+freezero(void *ptr, size_t sz) -+{ -+ /* This is legal. */ -+ if (ptr == NULL) -+ return; -+ -+ explicit_bzero(ptr, sz); -+ free(ptr); -+} --- -2.14.2 - diff --git a/pkg/openbsd/patch/0020-m4-Use-hand-written-lexer-to-avoid-cycle-in-bootstra.patch b/pkg/openbsd/patch/0020-m4-Use-hand-written-lexer-to-avoid-cycle-in-bootstra.patch new file mode 100644 index 00000000..f58f366f --- /dev/null +++ b/pkg/openbsd/patch/0020-m4-Use-hand-written-lexer-to-avoid-cycle-in-bootstra.patch @@ -0,0 +1,327 @@ +From edf250c633bef40e7e37dafc9fc393dd2ad9074f Mon Sep 17 00:00:00 2001 +From: Michael Forney +Date: Tue, 10 Apr 2018 13:37:14 -0700 +Subject: [PATCH] m4: Use hand-written lexer to avoid cycle in bootstrap + +--- + usr.bin/m4/tokenizer.c | 191 +++++++++++++++++++++++++++++++++++++++++ + usr.bin/m4/tokenizer.l | 109 ----------------------- + 2 files changed, 191 insertions(+), 109 deletions(-) + create mode 100644 usr.bin/m4/tokenizer.c + delete mode 100644 usr.bin/m4/tokenizer.l + +diff --git a/usr.bin/m4/tokenizer.c b/usr.bin/m4/tokenizer.c +new file mode 100644 +index 00000000000..fa19fc65035 +--- /dev/null ++++ b/usr.bin/m4/tokenizer.c +@@ -0,0 +1,191 @@ ++/* $OpenBSD: tokenizer.l,v 1.10 2017/06/17 01:55:16 bcallah Exp $ */ ++/* ++ * Copyright (c) 2004 Marc Espie ++ * ++ * Permission to use, copy, modify, and distribute this software for any ++ * purpose with or without fee is hereby granted, provided that the above ++ * copyright notice and this permission notice appear in all copies. ++ * ++ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES ++ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF ++ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ++ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES ++ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ++ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF ++ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ++ */ ++#include "parser.tab.h" ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++#include ++ ++extern void m4_warnx(const char *, ...); ++extern int mimic_gnu; ++extern int32_t yylval; ++static const char *yypos; ++ ++void ++yy_scan_string(const char *s) ++{ ++ yypos = s; ++} ++ ++static int32_t ++number(const char *yytext, size_t yylen) ++{ ++ long l; ++ ++ errno = 0; ++ l = strtol(yytext, NULL, 0); ++ if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) || ++ l > INT32_MAX || l < INT32_MIN) ++ m4_warnx("numeric overflow in expr: %.*s", (int)yylen, yytext); ++ return l; ++} ++ ++static int32_t ++parse_radix(const char *yytext, size_t yylen) ++{ ++ long base; ++ char *next; ++ long l; ++ int d; ++ ++ l = 0; ++ base = strtol(yytext+2, &next, 0); ++ if (base > 36 || next == NULL) { ++ m4_warnx("error in number %.*s", (int)yylen, yytext); ++ } else { ++ next++; ++ while (*next != 0) { ++ if (*next >= '0' && *next <= '9') ++ d = *next - '0'; ++ else if (*next >= 'a' && *next <= 'z') ++ d = *next - 'a' + 10; ++ else { ++ assert(*next >= 'A' && *next <= 'Z'); ++ d = *next - 'A' + 10; ++ } ++ if (d >= base) { ++ m4_warnx("error in number %.*s", (int)yylen, yytext); ++ return 0; ++ } ++ l = base * l + d; ++ next++; ++ } ++ } ++ return l; ++} ++ ++static int ++isodigit(int c) ++{ ++ return c >= '0' && c <= '7'; ++} ++ ++int yylex(void) ++{ ++ const char *start; ++ ++next: ++ start = yypos; ++ switch (*yypos) { ++ case ' ': ++ case '\t': ++ case '\n': ++ ++yypos; ++ goto next; ++ case '<': ++ switch (yypos[1]) { ++ case '=': ++ yypos += 2; ++ return LE; ++ case '<': ++ yypos += 2; ++ return LSHIFT; ++ } ++ break; ++ case '>': ++ switch (yypos[1]) { ++ case '=': ++ yypos += 2; ++ return GE; ++ case '>': ++ yypos += 2; ++ return RSHIFT; ++ } ++ break; ++ case '=': ++ if (yypos[1] != '=') ++ break; ++ yypos += 2; ++ return EQ; ++ case '!': ++ if (yypos[1] != '=') ++ break; ++ yypos += 2; ++ return NE; ++ case '&': ++ if (yypos[1] != '&') ++ break; ++ yypos += 2; ++ return LAND; ++ case '|': ++ if (yypos[1] != '|') ++ break; ++ yypos += 2; ++ return LOR; ++ case '*': ++ if (!mimic_gnu || yypos[1] != '*') ++ break; ++ yypos += 2; ++ return EXPONENT; ++ case '0': ++ switch (*++yypos) { ++ case 'x': ++ case 'X': ++ if (!isxdigit(*++yypos)) ++ return ERROR; ++ do ++yypos; ++ while (isxdigit(*yypos)); ++ break; ++ case 'r': ++ case 'R': ++ if (!mimic_gnu) ++ break; ++ if (!isdigit(*++yypos)) ++ return ERROR; ++ do ++yypos; ++ while (isdigit(*yypos)); ++ if (*yypos != ':') ++ return ERROR; ++ if (!isalnum(*++yypos)) ++ return ERROR; ++ do ++yypos; ++ while (isalnum(*yypos)); ++ yylval = parse_radix(start, yypos - start); ++ return NUMBER; ++ default: ++ do ++yypos; ++ while (isodigit(*yypos)); ++ break; ++ } ++ yylval = number(start, yypos - start); ++ return NUMBER; ++ case '\0': ++ return '\0'; ++ } ++ if (isdigit(*yypos)) { ++ do ++yypos; ++ while (isdigit(*yypos)); ++ yylval = number(start, yypos - start); ++ return NUMBER; ++ } ++ ++ return *yypos++; ++} +diff --git a/usr.bin/m4/tokenizer.l b/usr.bin/m4/tokenizer.l +deleted file mode 100644 +index 94f02fb6085..00000000000 +--- a/usr.bin/m4/tokenizer.l ++++ /dev/null +@@ -1,109 +0,0 @@ +-%{ +-/* $OpenBSD: tokenizer.l,v 1.10 2017/06/17 01:55:16 bcallah Exp $ */ +-/* +- * Copyright (c) 2004 Marc Espie +- * +- * Permission to use, copy, modify, and distribute this software for any +- * purpose with or without fee is hereby granted, provided that the above +- * copyright notice and this permission notice appear in all copies. +- * +- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES +- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF +- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR +- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES +- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN +- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF +- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. +- */ +-#include "parser.h" +-#include +-#include +-#include +-#include +-#include +- +-extern void m4_warnx(const char *, ...); +-extern int mimic_gnu; +-extern int32_t yylval; +- +-int32_t number(void); +-int32_t parse_radix(void); +-%} +- +-delim [ \t\n] +-ws {delim}+ +-hex 0[xX][0-9a-fA-F]+ +-oct 0[0-7]* +-dec [1-9][0-9]* +-radix 0[rR][0-9]+:[0-9a-zA-Z]+ +- +-%option noyywrap +- +-%% +-{ws} {/* just skip it */} +-{hex}|{oct}|{dec} { yylval = number(); return(NUMBER); } +-{radix} { if (mimic_gnu) { +- yylval = parse_radix(); return(NUMBER); +- } else { +- return(ERROR); +- } +- } +-"<=" { return(LE); } +-">=" { return(GE); } +-"<<" { return(LSHIFT); } +-">>" { return(RSHIFT); } +-"==" { return(EQ); } +-"!=" { return(NE); } +-"&&" { return(LAND); } +-"||" { return(LOR); } +-"**" { if (mimic_gnu) { return (EXPONENT); } } +-. { return yytext[0]; } +-%% +- +-int32_t +-number() +-{ +- long l; +- +- errno = 0; +- l = strtol(yytext, NULL, 0); +- if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) || +- l > INT32_MAX || l < INT32_MIN) +- m4_warnx("numeric overflow in expr: %s", yytext); +- return l; +-} +- +-int32_t +-parse_radix() +-{ +- long base; +- char *next; +- long l; +- int d; +- +- l = 0; +- base = strtol(yytext+2, &next, 0); +- if (base > 36 || next == NULL) { +- m4_warnx("error in number %s", yytext); +- } else { +- next++; +- while (*next != 0) { +- if (*next >= '0' && *next <= '9') +- d = *next - '0'; +- else if (*next >= 'a' && *next <= 'z') +- d = *next - 'a' + 10; +- else { +- assert(*next >= 'A' && *next <= 'Z'); +- d = *next - 'A' + 10; +- } +- if (d >= base) { +- m4_warnx("error in number %s", yytext); +- return 0; +- } +- l = base * l + d; +- next++; +- } +- } +- return l; +-} +- +-- +2.17.0 + diff --git a/pkg/openbsd/patch/0021-m4-Use-_Noreturn-instead-of-__dead.patch b/pkg/openbsd/patch/0021-m4-Use-_Noreturn-instead-of-__dead.patch new file mode 100644 index 00000000..c78d504e --- /dev/null +++ b/pkg/openbsd/patch/0021-m4-Use-_Noreturn-instead-of-__dead.patch @@ -0,0 +1,25 @@ +From 0f0eb43f3d6fb749fac229e3d6c8f74b2c40ece2 Mon Sep 17 00:00:00 2001 +From: Michael Forney +Date: Tue, 10 Apr 2018 16:03:44 -0700 +Subject: [PATCH] m4: Use _Noreturn instead of __dead + +--- + usr.bin/m4/extern.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h +index ea8406b8540..0c07599777d 100644 +--- a/usr.bin/m4/extern.h ++++ b/usr.bin/m4/extern.h +@@ -113,7 +113,7 @@ extern void usage(void); + extern void resizedivs(int); + extern size_t buffer_mark(void); + extern void dump_buffer(FILE *, size_t); +-extern void __dead m4errx(int, const char *, ...); ++extern void _Noreturn m4errx(int, const char *, ...); + + extern int obtain_char(struct input_file *); + extern void set_input(struct input_file *, FILE *, const char *); +-- +2.17.0 + diff --git a/pkg/openbsd/patch/0021-m4-Use-hand-written-lexer-to-avoid-cycle-in-bootstra.patch b/pkg/openbsd/patch/0021-m4-Use-hand-written-lexer-to-avoid-cycle-in-bootstra.patch deleted file mode 100644 index f58f366f..00000000 --- a/pkg/openbsd/patch/0021-m4-Use-hand-written-lexer-to-avoid-cycle-in-bootstra.patch +++ /dev/null @@ -1,327 +0,0 @@ -From edf250c633bef40e7e37dafc9fc393dd2ad9074f Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Tue, 10 Apr 2018 13:37:14 -0700 -Subject: [PATCH] m4: Use hand-written lexer to avoid cycle in bootstrap - ---- - usr.bin/m4/tokenizer.c | 191 +++++++++++++++++++++++++++++++++++++++++ - usr.bin/m4/tokenizer.l | 109 ----------------------- - 2 files changed, 191 insertions(+), 109 deletions(-) - create mode 100644 usr.bin/m4/tokenizer.c - delete mode 100644 usr.bin/m4/tokenizer.l - -diff --git a/usr.bin/m4/tokenizer.c b/usr.bin/m4/tokenizer.c -new file mode 100644 -index 00000000000..fa19fc65035 ---- /dev/null -+++ b/usr.bin/m4/tokenizer.c -@@ -0,0 +1,191 @@ -+/* $OpenBSD: tokenizer.l,v 1.10 2017/06/17 01:55:16 bcallah Exp $ */ -+/* -+ * Copyright (c) 2004 Marc Espie -+ * -+ * Permission to use, copy, modify, and distribute this software for any -+ * purpose with or without fee is hereby granted, provided that the above -+ * copyright notice and this permission notice appear in all copies. -+ * -+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -+ */ -+#include "parser.tab.h" -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+#include -+ -+extern void m4_warnx(const char *, ...); -+extern int mimic_gnu; -+extern int32_t yylval; -+static const char *yypos; -+ -+void -+yy_scan_string(const char *s) -+{ -+ yypos = s; -+} -+ -+static int32_t -+number(const char *yytext, size_t yylen) -+{ -+ long l; -+ -+ errno = 0; -+ l = strtol(yytext, NULL, 0); -+ if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) || -+ l > INT32_MAX || l < INT32_MIN) -+ m4_warnx("numeric overflow in expr: %.*s", (int)yylen, yytext); -+ return l; -+} -+ -+static int32_t -+parse_radix(const char *yytext, size_t yylen) -+{ -+ long base; -+ char *next; -+ long l; -+ int d; -+ -+ l = 0; -+ base = strtol(yytext+2, &next, 0); -+ if (base > 36 || next == NULL) { -+ m4_warnx("error in number %.*s", (int)yylen, yytext); -+ } else { -+ next++; -+ while (*next != 0) { -+ if (*next >= '0' && *next <= '9') -+ d = *next - '0'; -+ else if (*next >= 'a' && *next <= 'z') -+ d = *next - 'a' + 10; -+ else { -+ assert(*next >= 'A' && *next <= 'Z'); -+ d = *next - 'A' + 10; -+ } -+ if (d >= base) { -+ m4_warnx("error in number %.*s", (int)yylen, yytext); -+ return 0; -+ } -+ l = base * l + d; -+ next++; -+ } -+ } -+ return l; -+} -+ -+static int -+isodigit(int c) -+{ -+ return c >= '0' && c <= '7'; -+} -+ -+int yylex(void) -+{ -+ const char *start; -+ -+next: -+ start = yypos; -+ switch (*yypos) { -+ case ' ': -+ case '\t': -+ case '\n': -+ ++yypos; -+ goto next; -+ case '<': -+ switch (yypos[1]) { -+ case '=': -+ yypos += 2; -+ return LE; -+ case '<': -+ yypos += 2; -+ return LSHIFT; -+ } -+ break; -+ case '>': -+ switch (yypos[1]) { -+ case '=': -+ yypos += 2; -+ return GE; -+ case '>': -+ yypos += 2; -+ return RSHIFT; -+ } -+ break; -+ case '=': -+ if (yypos[1] != '=') -+ break; -+ yypos += 2; -+ return EQ; -+ case '!': -+ if (yypos[1] != '=') -+ break; -+ yypos += 2; -+ return NE; -+ case '&': -+ if (yypos[1] != '&') -+ break; -+ yypos += 2; -+ return LAND; -+ case '|': -+ if (yypos[1] != '|') -+ break; -+ yypos += 2; -+ return LOR; -+ case '*': -+ if (!mimic_gnu || yypos[1] != '*') -+ break; -+ yypos += 2; -+ return EXPONENT; -+ case '0': -+ switch (*++yypos) { -+ case 'x': -+ case 'X': -+ if (!isxdigit(*++yypos)) -+ return ERROR; -+ do ++yypos; -+ while (isxdigit(*yypos)); -+ break; -+ case 'r': -+ case 'R': -+ if (!mimic_gnu) -+ break; -+ if (!isdigit(*++yypos)) -+ return ERROR; -+ do ++yypos; -+ while (isdigit(*yypos)); -+ if (*yypos != ':') -+ return ERROR; -+ if (!isalnum(*++yypos)) -+ return ERROR; -+ do ++yypos; -+ while (isalnum(*yypos)); -+ yylval = parse_radix(start, yypos - start); -+ return NUMBER; -+ default: -+ do ++yypos; -+ while (isodigit(*yypos)); -+ break; -+ } -+ yylval = number(start, yypos - start); -+ return NUMBER; -+ case '\0': -+ return '\0'; -+ } -+ if (isdigit(*yypos)) { -+ do ++yypos; -+ while (isdigit(*yypos)); -+ yylval = number(start, yypos - start); -+ return NUMBER; -+ } -+ -+ return *yypos++; -+} -diff --git a/usr.bin/m4/tokenizer.l b/usr.bin/m4/tokenizer.l -deleted file mode 100644 -index 94f02fb6085..00000000000 ---- a/usr.bin/m4/tokenizer.l -+++ /dev/null -@@ -1,109 +0,0 @@ --%{ --/* $OpenBSD: tokenizer.l,v 1.10 2017/06/17 01:55:16 bcallah Exp $ */ --/* -- * Copyright (c) 2004 Marc Espie -- * -- * Permission to use, copy, modify, and distribute this software for any -- * purpose with or without fee is hereby granted, provided that the above -- * copyright notice and this permission notice appear in all copies. -- * -- * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -- * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -- * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -- * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -- * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -- * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF -- * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. -- */ --#include "parser.h" --#include --#include --#include --#include --#include -- --extern void m4_warnx(const char *, ...); --extern int mimic_gnu; --extern int32_t yylval; -- --int32_t number(void); --int32_t parse_radix(void); --%} -- --delim [ \t\n] --ws {delim}+ --hex 0[xX][0-9a-fA-F]+ --oct 0[0-7]* --dec [1-9][0-9]* --radix 0[rR][0-9]+:[0-9a-zA-Z]+ -- --%option noyywrap -- --%% --{ws} {/* just skip it */} --{hex}|{oct}|{dec} { yylval = number(); return(NUMBER); } --{radix} { if (mimic_gnu) { -- yylval = parse_radix(); return(NUMBER); -- } else { -- return(ERROR); -- } -- } --"<=" { return(LE); } --">=" { return(GE); } --"<<" { return(LSHIFT); } --">>" { return(RSHIFT); } --"==" { return(EQ); } --"!=" { return(NE); } --"&&" { return(LAND); } --"||" { return(LOR); } --"**" { if (mimic_gnu) { return (EXPONENT); } } --. { return yytext[0]; } --%% -- --int32_t --number() --{ -- long l; -- -- errno = 0; -- l = strtol(yytext, NULL, 0); -- if (((l == LONG_MAX || l == LONG_MIN) && errno == ERANGE) || -- l > INT32_MAX || l < INT32_MIN) -- m4_warnx("numeric overflow in expr: %s", yytext); -- return l; --} -- --int32_t --parse_radix() --{ -- long base; -- char *next; -- long l; -- int d; -- -- l = 0; -- base = strtol(yytext+2, &next, 0); -- if (base > 36 || next == NULL) { -- m4_warnx("error in number %s", yytext); -- } else { -- next++; -- while (*next != 0) { -- if (*next >= '0' && *next <= '9') -- d = *next - '0'; -- else if (*next >= 'a' && *next <= 'z') -- d = *next - 'a' + 10; -- else { -- assert(*next >= 'A' && *next <= 'Z'); -- d = *next - 'A' + 10; -- } -- if (d >= base) { -- m4_warnx("error in number %s", yytext); -- return 0; -- } -- l = base * l + d; -- next++; -- } -- } -- return l; --} -- --- -2.17.0 - diff --git a/pkg/openbsd/patch/0022-m4-Add-missing-includes.patch b/pkg/openbsd/patch/0022-m4-Add-missing-includes.patch new file mode 100644 index 00000000..de80afe9 --- /dev/null +++ b/pkg/openbsd/patch/0022-m4-Add-missing-includes.patch @@ -0,0 +1,37 @@ +From 2213572d0ef5646c205f5d30e67ba7ad1ac0129e Mon Sep 17 00:00:00 2001 +From: Michael Forney +Date: Tue, 10 Apr 2018 16:24:12 -0700 +Subject: [PATCH] m4: Add missing includes + +--- + usr.bin/m4/look.c | 1 + + usr.bin/m4/main.c | 1 + + 2 files changed, 2 insertions(+) + +diff --git a/usr.bin/m4/look.c b/usr.bin/m4/look.c +index ac504570a9f..5feb0413cd6 100644 +--- a/usr.bin/m4/look.c ++++ b/usr.bin/m4/look.c +@@ -38,6 +38,7 @@ + * by: oz + */ + ++#include + #include + #include + #include +diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c +index f1b8fa5a55b..4e664c0a50b 100644 +--- a/usr.bin/m4/main.c ++++ b/usr.bin/m4/main.c +@@ -39,6 +39,7 @@ + * by: oz + */ + ++#include + #include + #include + #include +-- +2.17.0 + diff --git a/pkg/openbsd/patch/0022-m4-Use-_Noreturn-instead-of-__dead.patch b/pkg/openbsd/patch/0022-m4-Use-_Noreturn-instead-of-__dead.patch deleted file mode 100644 index c78d504e..00000000 --- a/pkg/openbsd/patch/0022-m4-Use-_Noreturn-instead-of-__dead.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 0f0eb43f3d6fb749fac229e3d6c8f74b2c40ece2 Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Tue, 10 Apr 2018 16:03:44 -0700 -Subject: [PATCH] m4: Use _Noreturn instead of __dead - ---- - usr.bin/m4/extern.h | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/usr.bin/m4/extern.h b/usr.bin/m4/extern.h -index ea8406b8540..0c07599777d 100644 ---- a/usr.bin/m4/extern.h -+++ b/usr.bin/m4/extern.h -@@ -113,7 +113,7 @@ extern void usage(void); - extern void resizedivs(int); - extern size_t buffer_mark(void); - extern void dump_buffer(FILE *, size_t); --extern void __dead m4errx(int, const char *, ...); -+extern void _Noreturn m4errx(int, const char *, ...); - - extern int obtain_char(struct input_file *); - extern void set_input(struct input_file *, FILE *, const char *); --- -2.17.0 - diff --git a/pkg/openbsd/patch/0023-libutil-Add-missing-includes.patch b/pkg/openbsd/patch/0023-libutil-Add-missing-includes.patch new file mode 100644 index 00000000..c441c199 --- /dev/null +++ b/pkg/openbsd/patch/0023-libutil-Add-missing-includes.patch @@ -0,0 +1,24 @@ +From 72cfeec702c7b76cce88be4c411ce40a8abb628c Mon Sep 17 00:00:00 2001 +From: Michael Forney +Date: Tue, 10 Apr 2018 16:23:22 -0700 +Subject: [PATCH] libutil: Add missing includes + +--- + lib/libutil/ohash.c | 1 + + 1 file changed, 1 insertion(+) + +diff --git a/lib/libutil/ohash.c b/lib/libutil/ohash.c +index 74ca4fafd9c..9537c60eac4 100644 +--- a/lib/libutil/ohash.c ++++ b/lib/libutil/ohash.c +@@ -15,6 +15,7 @@ + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. + */ + ++#include + #include + #include + #include +-- +2.17.0 + diff --git a/pkg/openbsd/patch/0023-m4-Add-missing-includes.patch b/pkg/openbsd/patch/0023-m4-Add-missing-includes.patch deleted file mode 100644 index de80afe9..00000000 --- a/pkg/openbsd/patch/0023-m4-Add-missing-includes.patch +++ /dev/null @@ -1,37 +0,0 @@ -From 2213572d0ef5646c205f5d30e67ba7ad1ac0129e Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Tue, 10 Apr 2018 16:24:12 -0700 -Subject: [PATCH] m4: Add missing includes - ---- - usr.bin/m4/look.c | 1 + - usr.bin/m4/main.c | 1 + - 2 files changed, 2 insertions(+) - -diff --git a/usr.bin/m4/look.c b/usr.bin/m4/look.c -index ac504570a9f..5feb0413cd6 100644 ---- a/usr.bin/m4/look.c -+++ b/usr.bin/m4/look.c -@@ -38,6 +38,7 @@ - * by: oz - */ - -+#include - #include - #include - #include -diff --git a/usr.bin/m4/main.c b/usr.bin/m4/main.c -index f1b8fa5a55b..4e664c0a50b 100644 ---- a/usr.bin/m4/main.c -+++ b/usr.bin/m4/main.c -@@ -39,6 +39,7 @@ - * by: oz - */ - -+#include - #include - #include - #include --- -2.17.0 - diff --git a/pkg/openbsd/patch/0024-libutil-Add-missing-includes.patch b/pkg/openbsd/patch/0024-libutil-Add-missing-includes.patch deleted file mode 100644 index c441c199..00000000 --- a/pkg/openbsd/patch/0024-libutil-Add-missing-includes.patch +++ /dev/null @@ -1,24 +0,0 @@ -From 72cfeec702c7b76cce88be4c411ce40a8abb628c Mon Sep 17 00:00:00 2001 -From: Michael Forney -Date: Tue, 10 Apr 2018 16:23:22 -0700 -Subject: [PATCH] libutil: Add missing includes - ---- - lib/libutil/ohash.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/lib/libutil/ohash.c b/lib/libutil/ohash.c -index 74ca4fafd9c..9537c60eac4 100644 ---- a/lib/libutil/ohash.c -+++ b/lib/libutil/ohash.c -@@ -15,6 +15,7 @@ - * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. - */ - -+#include - #include - #include - #include --- -2.17.0 - -- cgit v1.2.3