aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2016-12-29 13:32:25 +0200
committerTimo Teräs <timo.teras@iki.fi>2016-12-29 13:56:17 +0200
commit89a718d88ec7466e721f3bbe9ede5ffe58061d78 (patch)
treece82cc92b35b958fd354d92e608fe12c1015a625
parent81aa969f2f227eb7c2ebf2d70a7df1a8a2bb56e0 (diff)
downloadaports-89a718d88ec7466e721f3bbe9ede5ffe58061d78.tar.bz2
aports-89a718d88ec7466e721f3bbe9ede5ffe58061d78.tar.xz
main/musl: upstream fixes, and add ipv6 features to getent
fixes #6590
-rw-r--r--main/musl/0026-fix-typo-in-utmpx.h.patch25
-rw-r--r--main/musl/0027-fix-misspelling-of-a-legacy-macro-name-in-sys-param..patch25
-rw-r--r--main/musl/0028-fix-parsing-of-quoted-time-zone-names.patch27
-rw-r--r--main/musl/0029-fix-accidental-global-static-pointer-in-ldso.patch29
-rw-r--r--main/musl/0030-fix-ldso-reserved-library-name-handling.patch69
-rw-r--r--main/musl/0031-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch40
-rw-r--r--main/musl/0032-fix-swprintf-internal-buffer-state-and-error-handlin.patch37
-rw-r--r--main/musl/0033-work-around-gdb-issues-recognizing-sigreturn-trampol.patch101
-rw-r--r--main/musl/0034-fix-mrand48-jrand48-return-value-on-64-bit-archs.patch30
-rw-r--r--main/musl/0035-handle-and-in-BRE-subexpression-start-and-end-as-anc.patch112
-rw-r--r--main/musl/APKBUILD48
-rw-r--r--main/musl/getent.c78
12 files changed, 615 insertions, 6 deletions
diff --git a/main/musl/0026-fix-typo-in-utmpx.h.patch b/main/musl/0026-fix-typo-in-utmpx.h.patch
new file mode 100644
index 0000000000..d9a7e6e7e4
--- /dev/null
+++ b/main/musl/0026-fix-typo-in-utmpx.h.patch
@@ -0,0 +1,25 @@
+From 1fa2a32d1e2d25f493058812008face73d411b2b Mon Sep 17 00:00:00 2001
+From: Daniel Sabogal <dsabogalcc@gmail.com>
+Date: Sun, 4 Sep 2016 10:42:48 -0400
+Subject: [PATCH] fix typo in utmpx.h
+
+---
+ include/utmpx.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/utmpx.h b/include/utmpx.h
+index 9e5cc955..0429014d 100644
+--- a/include/utmpx.h
++++ b/include/utmpx.h
+@@ -38,7 +38,7 @@ struct utmpx *getutxline(const struct utmpx *);
+ struct utmpx *pututxline(const struct utmpx *);
+ void setutxent(void);
+
+-#if defined(_BSD_SOURCE) | defined(_GNU_SOURCE)
++#if defined(_BSD_SOURCE) || defined(_GNU_SOURCE)
+ #define e_exit __e_exit
+ #define e_termination __e_termination
+ void updwtmpx(const char *, const struct utmpx *);
+--
+2.11.0
+
diff --git a/main/musl/0027-fix-misspelling-of-a-legacy-macro-name-in-sys-param..patch b/main/musl/0027-fix-misspelling-of-a-legacy-macro-name-in-sys-param..patch
new file mode 100644
index 0000000000..b0a472a95e
--- /dev/null
+++ b/main/musl/0027-fix-misspelling-of-a-legacy-macro-name-in-sys-param..patch
@@ -0,0 +1,25 @@
+From 4b8f94c2501e6fea3db631b73b0c91e34e2134cf Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Thu, 20 Oct 2016 17:01:56 -0400
+Subject: [PATCH] fix misspelling of a legacy macro name in sys/param.h
+
+---
+ include/sys/param.h | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/include/sys/param.h b/include/sys/param.h
+index 344c0d23..ce6b8019 100644
+--- a/include/sys/param.h
++++ b/include/sys/param.h
+@@ -7,7 +7,7 @@
+ #define MAXPATHLEN 4096
+ #define NBBY 8
+ #define NGROUPS 32
+-#define CANBSIZE 255
++#define CANBSIZ 255
+ #define NOFILE 256
+ #define NCARGS 131072
+ #define DEV_BSIZE 512
+--
+2.11.0
+
diff --git a/main/musl/0028-fix-parsing-of-quoted-time-zone-names.patch b/main/musl/0028-fix-parsing-of-quoted-time-zone-names.patch
new file mode 100644
index 0000000000..ac99f08db8
--- /dev/null
+++ b/main/musl/0028-fix-parsing-of-quoted-time-zone-names.patch
@@ -0,0 +1,27 @@
+From 8ca27ac4bfe73bff785d0c26c1de0da92b55e5c6 Mon Sep 17 00:00:00 2001
+From: Hannu Nyman <hannu.nyman@iki.fi>
+Date: Mon, 24 Oct 2016 13:12:24 +0300
+Subject: [PATCH] fix parsing of quoted time zone names
+
+Fix parsing of the < > quoted time zone names. Compare the correct
+character instead of repeatedly comparing the first character.
+---
+ src/time/__tz.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/time/__tz.c b/src/time/__tz.c
+index 8b84b9bd..0e0c4ea2 100644
+--- a/src/time/__tz.c
++++ b/src/time/__tz.c
+@@ -84,7 +84,7 @@ static void getname(char *d, const char **p)
+ int i;
+ if (**p == '<') {
+ ++*p;
+- for (i=0; **p!='>' && i<TZNAME_MAX; i++)
++ for (i=0; (*p)[i]!='>' && i<TZNAME_MAX; i++)
+ d[i] = (*p)[i];
+ ++*p;
+ } else {
+--
+2.11.0
+
diff --git a/main/musl/0029-fix-accidental-global-static-pointer-in-ldso.patch b/main/musl/0029-fix-accidental-global-static-pointer-in-ldso.patch
new file mode 100644
index 0000000000..6d18c6a721
--- /dev/null
+++ b/main/musl/0029-fix-accidental-global-static-pointer-in-ldso.patch
@@ -0,0 +1,29 @@
+From 86e8cc0fd46f5789e80a16d68ae86f7358f64705 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Tue, 1 Nov 2016 02:44:56 +0100
+Subject: [PATCH] fix accidental global static pointer in ldso
+
+this was harmless as load_library is not called concurrently,
+but it used one word of bss.
+---
+ ldso/dynlink.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/ldso/dynlink.c b/ldso/dynlink.c
+index e458f386..d11776dc 100644
+--- a/ldso/dynlink.c
++++ b/ldso/dynlink.c
+@@ -905,8 +905,9 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
+
+ /* Catch and block attempts to reload the implementation itself */
+ if (name[0]=='l' && name[1]=='i' && name[2]=='b') {
+- static const char *rp, reserved[] =
++ static const char reserved[] =
+ "c\0pthread\0rt\0m\0dl\0util\0xnet\0";
++ const char *rp;
+ char *z = strchr(name, '.');
+ if (z) {
+ size_t l = z-name;
+--
+2.11.0
+
diff --git a/main/musl/0030-fix-ldso-reserved-library-name-handling.patch b/main/musl/0030-fix-ldso-reserved-library-name-handling.patch
new file mode 100644
index 0000000000..fc410c6a46
--- /dev/null
+++ b/main/musl/0030-fix-ldso-reserved-library-name-handling.patch
@@ -0,0 +1,69 @@
+From 5ffe515ca485c8e6e57cd5acda6bc6008f85660c Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Tue, 1 Nov 2016 02:49:09 +0100
+Subject: [PATCH] fix ldso reserved library name handling
+
+If a DT_NEEDED entry was the prefix of a reserved library name
+(up to the first dot) then it was incorrectly treated as a libc
+reserved name.
+
+e.g. libp.so dependency was not loaded as it matched libpthread
+reserved name.
+---
+ ldso/dynlink.c | 38 +++++++++++++++++++-------------------
+ 1 file changed, 19 insertions(+), 19 deletions(-)
+
+diff --git a/ldso/dynlink.c b/ldso/dynlink.c
+index d11776dc..acb73bc2 100644
+--- a/ldso/dynlink.c
++++ b/ldso/dynlink.c
+@@ -906,27 +906,27 @@ static struct dso *load_library(const char *name, struct dso *needed_by)
+ /* Catch and block attempts to reload the implementation itself */
+ if (name[0]=='l' && name[1]=='i' && name[2]=='b') {
+ static const char reserved[] =
+- "c\0pthread\0rt\0m\0dl\0util\0xnet\0";
+- const char *rp;
+- char *z = strchr(name, '.');
+- if (z) {
+- size_t l = z-name;
+- for (rp=reserved; *rp && strncmp(name+3, rp, l-3); rp+=strlen(rp)+1);
+- if (*rp) {
+- if (ldd_mode) {
+- /* Track which names have been resolved
+- * and only report each one once. */
+- static unsigned reported;
+- unsigned mask = 1U<<(rp-reserved);
+- if (!(reported & mask)) {
+- reported |= mask;
+- dprintf(1, "\t%s => %s (%p)\n",
+- name, ldso.name,
+- ldso.base);
+- }
++ "c.pthread.rt.m.dl.util.xnet.";
++ const char *rp, *next;
++ for (rp=reserved; *rp; rp=next) {
++ next = strchr(rp, '.') + 1;
++ if (strncmp(name+3, rp, next-rp) == 0)
++ break;
++ }
++ if (*rp) {
++ if (ldd_mode) {
++ /* Track which names have been resolved
++ * and only report each one once. */
++ static unsigned reported;
++ unsigned mask = 1U<<(rp-reserved);
++ if (!(reported & mask)) {
++ reported |= mask;
++ dprintf(1, "\t%s => %s (%p)\n",
++ name, ldso.name,
++ ldso.base);
+ }
+- is_self = 1;
+ }
++ is_self = 1;
+ }
+ }
+ if (!strcmp(name, ldso.name)) is_self = 1;
+--
+2.11.0
+
diff --git a/main/musl/0031-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch b/main/musl/0031-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch
new file mode 100644
index 0000000000..1a8e05010d
--- /dev/null
+++ b/main/musl/0031-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch
@@ -0,0 +1,40 @@
+From bc1e7731cee963e422575f81048792f4d5db9641 Mon Sep 17 00:00:00 2001
+From: Daniel Sabogal <dsabogal@ufl.edu>
+Date: Wed, 2 Nov 2016 22:29:36 -0400
+Subject: [PATCH] fix integer overflow of tm_year in __secs_to_tm
+
+the overflow check for years+100 did not account for the extra
+year computed from the remaining months. instead, perform this
+check after obtaining the final number of years.
+---
+ src/time/__secs_to_tm.c | 9 +++++----
+ 1 file changed, 5 insertions(+), 4 deletions(-)
+
+diff --git a/src/time/__secs_to_tm.c b/src/time/__secs_to_tm.c
+index 3a3123a1..093d9021 100644
+--- a/src/time/__secs_to_tm.c
++++ b/src/time/__secs_to_tm.c
+@@ -60,15 +60,16 @@ int __secs_to_tm(long long t, struct tm *tm)
+ for (months=0; days_in_month[months] <= remdays; months++)
+ remdays -= days_in_month[months];
+
++ if (months >= 10) {
++ months -= 12;
++ years++;
++ }
++
+ if (years+100 > INT_MAX || years+100 < INT_MIN)
+ return -1;
+
+ tm->tm_year = years + 100;
+ tm->tm_mon = months + 2;
+- if (tm->tm_mon >= 12) {
+- tm->tm_mon -=12;
+- tm->tm_year++;
+- }
+ tm->tm_mday = remdays + 1;
+ tm->tm_wday = wday;
+ tm->tm_yday = yday;
+--
+2.11.0
+
diff --git a/main/musl/0032-fix-swprintf-internal-buffer-state-and-error-handlin.patch b/main/musl/0032-fix-swprintf-internal-buffer-state-and-error-handlin.patch
new file mode 100644
index 0000000000..1cc419c640
--- /dev/null
+++ b/main/musl/0032-fix-swprintf-internal-buffer-state-and-error-handlin.patch
@@ -0,0 +1,37 @@
+From 7442442ccc665641a8827177e8e7ed45bbbd6584 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Mon, 7 Nov 2016 20:39:59 -0500
+Subject: [PATCH] fix swprintf internal buffer state and error handling
+
+the swprintf write callback never reset its buffer pointers, so after
+its 256-byte buffer filled up, it would keep repeating those bytes
+over and over in the output until the destination buffer filled up. it
+also failed to set the error indicator for the stream on EILSEQ,
+potentially allowing output to continue after the error.
+---
+ src/stdio/vswprintf.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/stdio/vswprintf.c b/src/stdio/vswprintf.c
+index 7d237bae..6eb2f6ac 100644
+--- a/src/stdio/vswprintf.c
++++ b/src/stdio/vswprintf.c
+@@ -24,7 +24,14 @@ static size_t sw_write(FILE *f, const unsigned char *s, size_t l)
+ c->ws++;
+ }
+ *c->ws = 0;
+- return i<0 ? i : l0;
++ if (i < 0) {
++ f->wpos = f->wbase = f->wend = 0;
++ f->flags |= F_ERR;
++ return i;
++ }
++ f->wend = f->buf + f->buf_size;
++ f->wpos = f->wbase = f->buf;
++ return l0;
+ }
+
+ int vswprintf(wchar_t *restrict s, size_t n, const wchar_t *restrict fmt, va_list ap)
+--
+2.11.0
+
diff --git a/main/musl/0033-work-around-gdb-issues-recognizing-sigreturn-trampol.patch b/main/musl/0033-work-around-gdb-issues-recognizing-sigreturn-trampol.patch
new file mode 100644
index 0000000000..a248464502
--- /dev/null
+++ b/main/musl/0033-work-around-gdb-issues-recognizing-sigreturn-trampol.patch
@@ -0,0 +1,101 @@
+From 54991729fd1e3d3a0cb71884d758d86afe6da9e0 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Sat, 12 Nov 2016 19:43:37 -0500
+Subject: [PATCH] work around gdb issues recognizing sigreturn trampoline on
+ x86_64
+
+gdb can only backtrace/unwind across signal handlers if it recognizes
+the sa_restorer trampoline. for x86_64, gdb first attempts to
+determine the symbol name for the function in which the program
+counter resides and match it against "__restore_rt". if no name can be
+found (e.g. in the case of a stripped binary), the exact instruction
+sequence is matched instead.
+
+when matching the function name, however, gdb's unwind code wrongly
+considers the interval [sym,sym+size] rather than [sym,sym+size).
+thus, if __restore_rt begins immediately after another function, gdb
+wrongly identifies pc as lying within the previous adjacent function.
+this patch adds a nop before __restore_rt to preclude that
+possibility. it also removes the symbol name __restore and replaces it
+with a macro since the stability of whether gdb identifies the
+function as __restore_rt or __restore is not clear.
+
+for the no-symbols case, the instruction sequence is changed to use
+%rax rather than %eax to match what gdb expects.
+
+based on patch by Szabolcs Nagy, with extended description and
+corresponding x32 changes added.
+---
+ arch/x32/ksigaction.h | 9 +++++++++
+ arch/x86_64/ksigaction.h | 9 +++++++++
+ src/signal/x32/restore.s | 7 +++----
+ src/signal/x86_64/restore.s | 7 +++----
+ 4 files changed, 24 insertions(+), 8 deletions(-)
+ create mode 100644 arch/x32/ksigaction.h
+ create mode 100644 arch/x86_64/ksigaction.h
+
+diff --git a/arch/x32/ksigaction.h b/arch/x32/ksigaction.h
+new file mode 100644
+index 00000000..7743c5c6
+--- /dev/null
++++ b/arch/x32/ksigaction.h
+@@ -0,0 +1,9 @@
++struct k_sigaction {
++ void (*handler)(int);
++ unsigned long flags;
++ void (*restorer)(void);
++ unsigned mask[2];
++};
++
++void __restore_rt();
++#define __restore __restore_rt
+diff --git a/arch/x86_64/ksigaction.h b/arch/x86_64/ksigaction.h
+new file mode 100644
+index 00000000..7743c5c6
+--- /dev/null
++++ b/arch/x86_64/ksigaction.h
+@@ -0,0 +1,9 @@
++struct k_sigaction {
++ void (*handler)(int);
++ unsigned long flags;
++ void (*restorer)(void);
++ unsigned mask[2];
++};
++
++void __restore_rt();
++#define __restore __restore_rt
+diff --git a/src/signal/x32/restore.s b/src/signal/x32/restore.s
+index 27cd3cef..2f06e787 100644
+--- a/src/signal/x32/restore.s
++++ b/src/signal/x32/restore.s
+@@ -1,8 +1,7 @@
++ nop
+ .global __restore_rt
+-.global __restore
+ .type __restore_rt,@function
+-.type __restore,@function
+ __restore_rt:
+-__restore:
+- movl $0x40000201, %eax /* SYS_rt_sigreturn */
++ mov $0x40000201, %rax /* SYS_rt_sigreturn */
+ syscall
++.size __restore_rt,.-__restore_rt
+diff --git a/src/signal/x86_64/restore.s b/src/signal/x86_64/restore.s
+index 682af2dd..b5c6e37f 100644
+--- a/src/signal/x86_64/restore.s
++++ b/src/signal/x86_64/restore.s
+@@ -1,8 +1,7 @@
++ nop
+ .global __restore_rt
+-.global __restore
+ .type __restore_rt,@function
+-.type __restore,@function
+ __restore_rt:
+-__restore:
+- movl $15, %eax
++ mov $15, %rax
+ syscall
++.size __restore_rt,.-__restore_rt
+--
+2.11.0
+
diff --git a/main/musl/0034-fix-mrand48-jrand48-return-value-on-64-bit-archs.patch b/main/musl/0034-fix-mrand48-jrand48-return-value-on-64-bit-archs.patch
new file mode 100644
index 0000000000..6d1cb1c6a4
--- /dev/null
+++ b/main/musl/0034-fix-mrand48-jrand48-return-value-on-64-bit-archs.patch
@@ -0,0 +1,30 @@
+From adfe682eb0d77c6afc751f5e407d9da39623c24e Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Fri, 16 Dec 2016 23:19:27 -0500
+Subject: [PATCH] fix mrand48/jrand48 return value on 64-bit archs
+
+POSIX specifies the result to have signed 32-bit range. on 32-bit
+archs, the implicit conversion to long achieved the desired range
+already, but when long is 64-bit, a cast is needed.
+
+patch by Ed Schouten.
+---
+ src/prng/mrand48.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/prng/mrand48.c b/src/prng/mrand48.c
+index ee650fc3..0519d667 100644
+--- a/src/prng/mrand48.c
++++ b/src/prng/mrand48.c
+@@ -6,7 +6,7 @@ extern unsigned short __seed48[7];
+
+ long jrand48(unsigned short s[3])
+ {
+- return __rand48_step(s, __seed48+3) >> 16;
++ return (int32_t)(__rand48_step(s, __seed48+3) >> 16);
+ }
+
+ long mrand48(void)
+--
+2.11.0
+
diff --git a/main/musl/0035-handle-and-in-BRE-subexpression-start-and-end-as-anc.patch b/main/musl/0035-handle-and-in-BRE-subexpression-start-and-end-as-anc.patch
new file mode 100644
index 0000000000..fee0ae8726
--- /dev/null
+++ b/main/musl/0035-handle-and-in-BRE-subexpression-start-and-end-as-anc.patch
@@ -0,0 +1,112 @@
+From 7a4c25d78030b3a43ed5c8dd1a456f73cb990f44 Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Thu, 24 Nov 2016 01:44:49 +0100
+Subject: [PATCH] handle ^ and $ in BRE subexpression start and end as anchors
+
+In BRE, ^ is an anchor at the beginning of an expression, optionally
+it may be an anchor at the beginning of a subexpression and must be
+treated as a literal otherwise.
+
+Previously musl treated ^ in subexpressions as literal, but at least
+glibc and gnu sed treats it as an anchor and that's the more useful
+behaviour: it can always be escaped to get back the literal meaning.
+
+Same for $ at the end of a subexpression.
+
+Portable BRE should not rely on this, but there are sed commands in
+build scripts which do.
+
+This changes the meaning of the BREs:
+
+ \(^a\)
+ \(a\|^b\)
+ \(a$\)
+ \(a$\|b\)
+---
+ src/regex/regcomp.c | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c
+index 65f2fd0b..5a7b53a7 100644
+--- a/src/regex/regcomp.c
++++ b/src/regex/regcomp.c
+@@ -401,8 +401,8 @@ typedef struct {
+ tre_ast_node_t *n;
+ /* Position in the regexp pattern after a parse function returns. */
+ const char *s;
+- /* The first character of the regexp. */
+- const char *re;
++ /* The first character of the last subexpression parsed. */
++ const char *start;
+ /* Current submatch ID. */
+ int submatch_id;
+ /* Current position (number of literal). */
+@@ -876,14 +876,14 @@ static reg_errcode_t parse_atom(tre_parse_ctx_t *ctx, const char *s)
+ break;
+ case '^':
+ /* '^' has a special meaning everywhere in EREs, and at beginning of BRE. */
+- if (!ere && s != ctx->re)
++ if (!ere && s != ctx->start)
+ goto parse_literal;
+ node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_BOL, -1);
+ s++;
+ break;
+ case '$':
+- /* '$' is special everywhere in EREs, and in the end of the string in BREs. */
+- if (!ere && s[1])
++ /* '$' is special everywhere in EREs, and at the end of a BRE subexpression. */
++ if (!ere && s[1] && (s[1]!='\\'|| (s[2]!=')' && s[2]!='|')))
+ goto parse_literal;
+ node = tre_ast_new_literal(ctx->mem, ASSERTION, ASSERT_AT_EOL, -1);
+ s++;
+@@ -944,7 +944,7 @@ static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx)
+ {
+ tre_ast_node_t *nbranch=0, *nunion=0;
+ int ere = ctx->cflags & REG_EXTENDED;
+- const char *s = ctx->re;
++ const char *s = ctx->start;
+ int subid = 0;
+ int depth = 0;
+ reg_errcode_t err;
+@@ -962,6 +962,7 @@ static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx)
+ s++;
+ depth++;
+ nbranch = nunion = 0;
++ ctx->start = s;
+ continue;
+ }
+ if ((!ere && *s == '\\' && s[1] == ')') ||
+@@ -994,8 +995,8 @@ static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx)
+ if (*s=='\\')
+ s++;
+
+- /* handle ^* at the start of a complete BRE. */
+- if (!ere && s==ctx->re+1 && s[-1]=='^')
++ /* handle ^* at the start of a BRE. */
++ if (!ere && s==ctx->start+1 && s[-1]=='^')
+ break;
+
+ /* extension: multiple consecutive *+?{,} is unspecified,
+@@ -1038,8 +1039,10 @@ static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx)
+
+ if (c == '\\' && s[1] == '|') {
+ s+=2;
++ ctx->start = s;
+ } else if (c == '|') {
+ s++;
++ ctx->start = s;
+ } else {
+ if (c == '\\') {
+ if (!depth) return REG_EPAREN;
+@@ -2705,7 +2708,7 @@ regcomp(regex_t *restrict preg, const char *restrict regex, int cflags)
+ memset(&parse_ctx, 0, sizeof(parse_ctx));
+ parse_ctx.mem = mem;
+ parse_ctx.stack = stack;
+- parse_ctx.re = regex;
++ parse_ctx.start = regex;
+ parse_ctx.cflags = cflags;
+ parse_ctx.max_backref = -1;
+ errcode = tre_parse(&parse_ctx);
+--
+2.11.0
+
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index 2e4632c0de..a311a2ba15 100644
--- a/main/musl/APKBUILD
+++ b/main/musl/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=1.1.15
-pkgrel=5
+pkgrel=6
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -40,6 +40,16 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch
0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch
0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch
+ 0026-fix-typo-in-utmpx.h.patch
+ 0027-fix-misspelling-of-a-legacy-macro-name-in-sys-param..patch
+ 0028-fix-parsing-of-quoted-time-zone-names.patch
+ 0029-fix-accidental-global-static-pointer-in-ldso.patch
+ 0030-fix-ldso-reserved-library-name-handling.patch
+ 0031-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch
+ 0032-fix-swprintf-internal-buffer-state-and-error-handlin.patch
+ 0033-work-around-gdb-issues-recognizing-sigreturn-trampol.patch
+ 0034-fix-mrand48-jrand48-return-value-on-64-bit-archs.patch
+ 0035-handle-and-in-BRE-subexpression-start-and-end-as-anc.patch
1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch
ldconfig
@@ -180,11 +190,21 @@ df48f35ff1e8084b5b01223917a11c32 0020-fix-float-formatting-of-some-exact-halfwa
0169f80be7c767e3f8cd736bbf773bde 0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch
e9ef5ab7879cc113895d37783b217a70 0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch
2019fe5ed6214ff647d499fcd00fdb66 0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch
+855dda2bd43cd4647bbbe187ae21c1e5 0026-fix-typo-in-utmpx.h.patch
+71e91fa6e59eb8dc2fbcff481f8d6940 0027-fix-misspelling-of-a-legacy-macro-name-in-sys-param..patch
+bbbddbc14f9868e2970847388c7eced3 0028-fix-parsing-of-quoted-time-zone-names.patch
+d7370f099f1f66a21f08e09ab565e2b2 0029-fix-accidental-global-static-pointer-in-ldso.patch
+487824144894dc7b2f681559e90c47a3 0030-fix-ldso-reserved-library-name-handling.patch
+ad302311ae40f2812f03978a6fd70c62 0031-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch
+ecccf2709616b972b03af5c6a5ef1433 0032-fix-swprintf-internal-buffer-state-and-error-handlin.patch
+fb41ec1bf483e92cf2b72e0efb700cc3 0033-work-around-gdb-issues-recognizing-sigreturn-trampol.patch
+b6913f0456cc06ed111d8b0e7fbee80a 0034-fix-mrand48-jrand48-return-value-on-64-bit-archs.patch
+abae86f7c5f1837c38affbe6e120adb9 0035-handle-and-in-BRE-subexpression-start-and-end-as-anc.patch
62806d6be9fa3aedc99831d948abca65 1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch
830d01f7821b978df770b06db3790921 ldconfig
0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c
57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c
-2b941c4251cac44988a4abfc50e21267 getent.c
+eadc8794eadb79dbc383b2b91a32084d getent.c
45f92f8d59cf84d765de698a9578dbf4 iconv.c"
sha256sums="97e447c7ee2a7f613186ec54a93054fe15469fe34d7d323080f7ef38f5ecb0fa musl-1.1.15.tar.gz
d157100aeed5b0866eb6d50288f63f26ea9900f1d4c7b8a1492294c912b5cc19 0001-fix-asctime-day-month-names-not-to-vary-by-locale.patch
@@ -214,11 +234,21 @@ a85b33f81034e3d801f2bdee5bc5ed85226dce49a652df59e436a45ed35a4701 0019-add-pthre
6254a8ec59f756cc044303650c18e55cb0afe9e5a6027f871da6537cdb2b08c5 0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch
8e074fa0f9434a8818951a48df08510b8c10c44ea9732a919f893476618a576d 0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch
301c1a16a84ec4c071e8a61360e3d3a21eb71cfcda581448938c7f3c40e11c85 0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch
+3f5cc9aede03bf2357b9cb3a2107b63dacb67c65c98eb71815658bbf6fab7528 0026-fix-typo-in-utmpx.h.patch
+41769360683b537de93d1e6119059a0d39bd369fd34338cd81f32276ee670a1b 0027-fix-misspelling-of-a-legacy-macro-name-in-sys-param..patch
+7ab31334e4b5d522cc9ed1e16b74c7cec7e4ca58a05aa56092d8dd9649a8a66d 0028-fix-parsing-of-quoted-time-zone-names.patch
+c66310e6dc429ba8a0fac52a2918609c21b2fc7aab2a2b06108617d127f376e8 0029-fix-accidental-global-static-pointer-in-ldso.patch
+9342ff13b01c12e3d2acd6faf7350c75048fb6a749610d98ee4994e16e829849 0030-fix-ldso-reserved-library-name-handling.patch
+5964976ebdda4e0ac99cc1323de02ef3a737d9be3d08ea66973020fb85283c98 0031-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch
+21bdaa2f602e898cbc665d4223c37316c3da45a27c4a56e2278a2d671a5da273 0032-fix-swprintf-internal-buffer-state-and-error-handlin.patch
+8603df3a8a487c070a5642f8a497e6e32ae6f319352627b3644d3ab1f9ef78b7 0033-work-around-gdb-issues-recognizing-sigreturn-trampol.patch
+96d3819f23f4f13a2c0c628070bfceedd90266f86154e09c6aa109f3a8a019ed 0034-fix-mrand48-jrand48-return-value-on-64-bit-archs.patch
+f45ddc4958b1d1615462926363b2fed0a7b69492ec9541da36a4314c7a04797a 0035-handle-and-in-BRE-subexpression-start-and-end-as-anc.patch
0403509c71580be517867be56b984359c3e7c413aba3f5b7f5b29d52561be328 1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch
b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c
d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c
-68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.c
+b323f20c9bf560a13c877eb05428bc4a203383697bac763e7b12865db5c5922c getent.c
f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c"
sha512sums="9e923572c0d6bad3dc2d2646d4b0699c10b477ce6300ac6c6224895192a90667f581ddf6eda2ab8c4c16f47bde4bccb03bb90478638d136d9df721430f4d0163 musl-1.1.15.tar.gz
1a74d5f5e0f6f2fe6029ed0f18b4603f80c990f19aa13d83c5d1f40f032b2ffb3819aae13ae1f96415bb08571774eec164e71d09028f2a5db4ae9b77e48cafe7 0001-fix-asctime-day-month-names-not-to-vary-by-locale.patch
@@ -248,9 +278,19 @@ d8aeffd16ca5df51d34341f92a452941daf94c69b112d74f4759773301c2753f9dde5858b0b10295
fe86988734ce3817182c25023ed2739c67f3d4c226570c1162713ea5849112cb98b6f9b778ecedafd086366b01392dbc0a871e427a51a8421949a64a97fd8214 0023-fix-strtod-and-strtof-rounding-with-many-trailing-ze.patch
3df8546a37467b716509bc0bbccef47aaf431e861442267aba0c08e19980d411f515d6a9c09c86b055dc709e83bcfab5f8bbfcb34d5c4b62e201a555839ff1fb 0024-fix-strtod-int-optimization-in-non-nearest-rounding-.patch
cc15bb90009ae546f3de75457fef6ea8bdccee2bacae9a1c3860a18120cbd610f2f1d4a358a41da25b7d16f3ae03fe9b40b235c9028af5319dc1bcc28d3a956f 0025-fix-minor-problem-in-previous-strtod-non-nearest-rou.patch
+1b4c3b7042f9b7f4ebb4d7dc8a6acac20326797e66583873c1de7bdcb08333a6f883196d6f4fdf364cd78c97093a4f90ebbeff8029aba3759fa358a2f99edc3b 0026-fix-typo-in-utmpx.h.patch
+02663915628523be2340898984c363da6cc7f648c79c4f1d0ecd3a3e7f79a1b91b0ca6c0c4174cc993abc9a612d1dd68c8b4978192c7325c47706e0b0e13ca39 0027-fix-misspelling-of-a-legacy-macro-name-in-sys-param..patch
+1ccdf7d82536023e494c000d2e5449ada3ec4a637e6f409d223c72251d76649af6545c44d2054acd5a373d739df1941933303b1eeabf7bccd20ae67724fa75d1 0028-fix-parsing-of-quoted-time-zone-names.patch
+e681cea8cb009661f3869faab1d6a8415c39553865fe0f13fff0e4c60b682871d4dda4645fcbb148172c7d89ab1efb7e284b4e83a49a242e0d3425f09093b04d 0029-fix-accidental-global-static-pointer-in-ldso.patch
+b3d68205157480a5527f98f2382fe4a6a7fbc218fc0c73c7797058ba481e1ca534c2f40d4b2e5eaa3dd7413301c89843b30cd4fcdf370f4cd833fbacb8fb43f3 0030-fix-ldso-reserved-library-name-handling.patch
+2784ab0539fa00a743a9eaf7cd4f45b0021313b728bfe53af8fd76e6925a04ffd6f1008a9258f3949a6d33d18b8d143d2163935aae4889f299a34a6388992588 0031-fix-integer-overflow-of-tm_year-in-__secs_to_tm.patch
+4e483752f3b84ac343045d214d7e4c495167cb56586ce456173a044b5c1c578ef34bde959da111ee4d599fda37065f002d88490f9923cd1c23324fabf29f25d7 0032-fix-swprintf-internal-buffer-state-and-error-handlin.patch
+a3d8d416c3109c5c9e81b7229718255695082c502e3890e12573ed7820eec657061416d6025d3cd1c8ad1ae5ccff88cb76765475b63ce9406588e2e655780deb 0033-work-around-gdb-issues-recognizing-sigreturn-trampol.patch
+84fc4f47651f1db66a4dc6bca050c55f2fb034e2d95fad94a440104cdd21610279b1f2f6d76f6fa048d0d9e951ca4950d194a1b063411a7b88eb2fe6577ef379 0034-fix-mrand48-jrand48-return-value-on-64-bit-archs.patch
+35390e0971e8ae6e9d30c790dca5950f5db22e23d1fe3801f7227ed8da04691356304c1202a4694b9965b39eb8fcc01edfece04c58a347719a902bd548501fb2 0035-handle-and-in-BRE-subexpression-start-and-end-as-anc.patch
dc15dcb71e576f42268721c1caa036d91f3f67ab628a8527cd80d5689acea326b27e73013c02383b432027bed4c68c2cba75020088b760fae64d1680febf7a7d 1001-add-support-for-pthread_-get-set-attr_default_np-GNU.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c
-b35de9847353b273516162ed4828a810c6130fc5b7de44ee4433003b3f99647b25792d9b1c40dfc67069add11f3fb850e5c35d4f1912dccac108059bbbdfd5a2 getent.c
+378d70e65bcc65bb4e1415354cecfa54b0c1146dfb24474b69e418cdbf7ad730472cd09f6f103e1c99ba6c324c9560bccdf287f5889bbc3ef0bdf0e08da47413 getent.c
9d42d66fb1facce2b85dad919be5be819ee290bd26ca2db00982b2f8e055a0196290a008711cbe2b18ec9eee8d2270e3b3a4692c5a1b807013baa5c2b70a2bbf iconv.c"
diff --git a/main/musl/getent.c b/main/musl/getent.c
index 1f97f8f32a..b10d75acc4 100644
--- a/main/musl/getent.c
+++ b/main/musl/getent.c
@@ -196,8 +196,8 @@ static int hosts(int argc, char *argv[])
he = gethostbyaddr(addr, IN6ADDRSZ, AF_INET6);
else if (inet_pton(AF_INET, argv[i], (void *)addr) > 0)
he = gethostbyaddr(addr, INADDRSZ, AF_INET);
- else
- he = gethostbyname(argv[i]);
+ else if ((he = gethostbyname2(argv[i], AF_INET6)) == NULL)
+ he = gethostbyname2(argv[i], AF_INET);
if (he == NULL) {
rv = RV_NOTFOUND;
break;
@@ -209,6 +209,77 @@ static int hosts(int argc, char *argv[])
return rv;
}
+static int ahosts_ex(int family, int flags, int argc, char *argv[])
+{
+ static const char *socktypes[] = {
+ [SOCK_STREAM] = "STREAM",
+ [SOCK_DGRAM] = "DGRAM",
+ [SOCK_RAW] = "RAW",
+ [SOCK_RDM] = "RDM",
+ [SOCK_SEQPACKET] = "SEQPACKET",
+ [SOCK_DCCP] = "DCCP",
+ [SOCK_PACKET] = "PACKET",
+ };
+ const char *sockstr;
+ char sockbuf[16], buf[INET6_ADDRSTRLEN];
+ struct addrinfo *res, *r, hint;
+ void *addr;
+ int i;
+
+ if (argc == 2)
+ return hosts(argc, argv);
+
+ hint = (struct addrinfo) {
+ .ai_family = family,
+ .ai_flags = AI_ADDRCONFIG | AI_CANONNAME | flags,
+ };
+
+ for (i = 2; i < argc; i++) {
+ if (getaddrinfo(argv[i], 0, &hint, &res) != 0)
+ return RV_NOTFOUND;
+
+ for (r = res; r; r = r->ai_next) {
+ sockstr = NULL;
+ if (r->ai_socktype >= 0 && r->ai_socktype < sizeof(socktypes)/sizeof(socktypes[0]))
+ sockstr = socktypes[r->ai_socktype];
+ if (!sockstr) {
+ sprintf(buf, "%d", r->ai_socktype);
+ sockstr = sockbuf;
+ }
+ switch (r->ai_family) {
+ case AF_INET:
+ addr = &((struct sockaddr_in*) r->ai_addr)->sin_addr;
+ break;
+ case AF_INET6:
+ addr = &((struct sockaddr_in6*) r->ai_addr)->sin6_addr;
+ break;
+ default:
+ continue;
+ }
+ if (inet_ntop(r->ai_family, addr, buf, sizeof(buf)) == NULL)
+ (void)strlcpy(buf, "# unknown", sizeof(buf));
+ printf("%-15s %-6s %s\n", buf, sockstr, r->ai_canonname ?: "");
+ }
+ }
+
+ return RV_OK;
+}
+
+static int ahosts(int argc, char *argv[])
+{
+ return ahosts_ex(AF_UNSPEC, 0, argc, argv);
+}
+
+static int ahostsv4(int argc, char *argv[])
+{
+ return ahosts_ex(AF_INET, 0, argc, argv);
+}
+
+static int ahostsv6(int argc, char *argv[])
+{
+ return ahosts_ex(AF_INET6, AI_V4MAPPED, argc, argv);
+}
+
static void networksprint(const struct netent *ne)
{
char buf[INET6_ADDRSTRLEN];
@@ -393,6 +464,9 @@ static struct getentdb {
{ "ethers", ethers, },
{ "group", group, },
{ "hosts", hosts, },
+ { "ahosts", ahosts, },
+ { "ahostsv4", ahostsv4, },
+ { "ahostsv6", ahostsv6, },
{ "networks", networks, },
{ "passwd", passwd, },
{ "protocols", protocols, },