From 0f79ca454f3f7d7ae00997cb41fbb4ec518f89a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 2 Mar 2016 14:07:09 +0200 Subject: main/musl: cherry-pick bre fixes from upstream git --- ...g-of-non-matching-address-family-entries-.patch | 26 --------- ...matching-address-family-entries-in-hosts-.patch | 62 ++++++++++++++++++++++ ...2-fix-at-the-start-of-a-BRE-subexpression.patch | 39 ++++++++++++++ .../0003-fix-at-the-start-of-a-complete-BRE.patch | 34 ++++++++++++ main/musl/APKBUILD | 18 +++++-- 5 files changed, 148 insertions(+), 31 deletions(-) delete mode 100644 main/musl/0001-fix-handling-of-non-matching-address-family-entries-.patch create mode 100644 main/musl/0001-handle-non-matching-address-family-entries-in-hosts-.patch create mode 100644 main/musl/0002-fix-at-the-start-of-a-BRE-subexpression.patch create mode 100644 main/musl/0003-fix-at-the-start-of-a-complete-BRE.patch (limited to 'main/musl') diff --git a/main/musl/0001-fix-handling-of-non-matching-address-family-entries-.patch b/main/musl/0001-fix-handling-of-non-matching-address-family-entries-.patch deleted file mode 100644 index 40c2a8512..000000000 --- a/main/musl/0001-fix-handling-of-non-matching-address-family-entries-.patch +++ /dev/null @@ -1,26 +0,0 @@ -From 8be65561a9f8c641dc22269ae33ff736fdc71f7c Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Tue, 23 Feb 2016 08:46:09 +0200 -Subject: [PATCH] fix handling of non-matching address family entries in - /etc/hosts - ---- - src/network/lookup_name.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/network/lookup_name.c b/src/network/lookup_name.c -index a26ad53..db0f237 100644 ---- a/src/network/lookup_name.c -+++ b/src/network/lookup_name.c -@@ -71,7 +71,7 @@ static int name_from_hosts(struct address buf[static MAXADDRS], char canon[stati - /* Isolate IP address to parse */ - for (p=line; *p && !isspace(*p); p++); - *p++ = 0; -- if (name_from_numeric(buf+cnt, line, family)) -+ if (name_from_numeric(buf+cnt, line, family) > 0) - cnt++; - - /* Extract first name as canonical name */ --- -2.7.1 - diff --git a/main/musl/0001-handle-non-matching-address-family-entries-in-hosts-.patch b/main/musl/0001-handle-non-matching-address-family-entries-in-hosts-.patch new file mode 100644 index 000000000..927106d57 --- /dev/null +++ b/main/musl/0001-handle-non-matching-address-family-entries-in-hosts-.patch @@ -0,0 +1,62 @@ +From 6d70c08a2c37745df637b231711f6dec79dbc6e1 Mon Sep 17 00:00:00 2001 +From: Rich Felker +Date: Wed, 2 Mar 2016 00:34:51 -0500 +Subject: [PATCH] handle non-matching address family entries in hosts file + +name_from_hosts failed to account for the possibility of an address +family error from name_from_numeric, wrongly counting such a return as +success and using the uninitialized address data as part of the +results passed up to the caller. + +non-matching address family entries cannot simply be ignored or +results would be inconsistent with respect to whether AF_UNSPEC or a +specific address family is queried. instead, record that a +non-matching entry was seen, and fail the lookup with EAI_NONAME of no +matching-family entries are found. +--- + src/network/lookup_name.c | 14 +++++++++++--- + 1 file changed, 11 insertions(+), 3 deletions(-) + +diff --git a/src/network/lookup_name.c b/src/network/lookup_name.c +index a26ad53..86f90ac 100644 +--- a/src/network/lookup_name.c ++++ b/src/network/lookup_name.c +@@ -49,7 +49,7 @@ static int name_from_hosts(struct address buf[static MAXADDRS], char canon[stati + { + char line[512]; + size_t l = strlen(name); +- int cnt = 0; ++ int cnt = 0, badfam = 0; + unsigned char _buf[1032]; + FILE _f, *f = __fopen_rb_ca("/etc/hosts", &_f, _buf, sizeof _buf); + if (!f) switch (errno) { +@@ -71,8 +71,16 @@ static int name_from_hosts(struct address buf[static MAXADDRS], char canon[stati + /* Isolate IP address to parse */ + for (p=line; *p && !isspace(*p); p++); + *p++ = 0; +- if (name_from_numeric(buf+cnt, line, family)) ++ switch (name_from_numeric(buf+cnt, line, family)) { ++ case 1: + cnt++; ++ break; ++ case 0: ++ continue; ++ default: ++ badfam = EAI_NONAME; ++ continue; ++ } + + /* Extract first name as canonical name */ + for (; *p && isspace(*p); p++); +@@ -81,7 +89,7 @@ static int name_from_hosts(struct address buf[static MAXADDRS], char canon[stati + if (is_valid_hostname(p)) memcpy(canon, p, z-p+1); + } + __fclose_ca(f); +- return cnt; ++ return cnt ? cnt : badfam; + } + + struct dpc_ctx { +-- +2.7.2 + diff --git a/main/musl/0002-fix-at-the-start-of-a-BRE-subexpression.patch b/main/musl/0002-fix-at-the-start-of-a-BRE-subexpression.patch new file mode 100644 index 000000000..7c5c82516 --- /dev/null +++ b/main/musl/0002-fix-at-the-start-of-a-BRE-subexpression.patch @@ -0,0 +1,39 @@ +From 39ea71fb8afddda879a1999f2a203dfdaf57a639 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Mon, 29 Feb 2016 15:04:46 +0000 +Subject: [PATCH] fix * at the start of a BRE subexpression + +commit 7eaa76fc2e7993582989d3838b1ac32dd8abac09 made * invalid at +the start of a BRE subexpression, but it should be accepted as +literal * there according to the standard. + +This patch does not fix subexpressions starting with ^*. +--- + src/regex/regcomp.c | 4 ---- + 1 file changed, 4 deletions(-) + +diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c +index da6abd1..7a2864c 100644 +--- a/src/regex/regcomp.c ++++ b/src/regex/regcomp.c +@@ -889,7 +889,6 @@ static reg_errcode_t parse_atom(tre_parse_ctx_t *ctx, const char *s) + s++; + break; + case '*': +- return REG_BADPAT; + case '{': + case '+': + case '?': +@@ -978,9 +977,6 @@ static reg_errcode_t tre_parse(tre_parse_ctx_t *ctx) + } + + parse_iter: +- /* extension: repetitions are rejected after an empty node +- eg. (+), |*, {2}, but assertions are not treated as empty +- so ^* or $? are accepted currently. */ + for (;;) { + int min, max; + +-- +2.7.2 + diff --git a/main/musl/0003-fix-at-the-start-of-a-complete-BRE.patch b/main/musl/0003-fix-at-the-start-of-a-complete-BRE.patch new file mode 100644 index 000000000..dac819d00 --- /dev/null +++ b/main/musl/0003-fix-at-the-start-of-a-complete-BRE.patch @@ -0,0 +1,34 @@ +From 29b13575376509bb21539711f30c1deaf0823033 Mon Sep 17 00:00:00 2001 +From: Szabolcs Nagy +Date: Mon, 29 Feb 2016 16:36:25 +0000 +Subject: [PATCH] fix ^* at the start of a complete BRE + +This is a workaround to treat * as literal * at the start of a BRE. + +Ideally ^ would be treated as an anchor at the start of any BRE +subexpression and similarly $ would be an anchor at the end of any +subexpression. This is not required by the standard and hard to do +with the current code, but it's the existing practice. If it is +changed, * should be treated as literal after such anchor as well. +--- + src/regex/regcomp.c | 4 ++++ + 1 file changed, 4 insertions(+) + +diff --git a/src/regex/regcomp.c b/src/regex/regcomp.c +index 7a2864c..5fad98b 100644 +--- a/src/regex/regcomp.c ++++ b/src/regex/regcomp.c +@@ -994,6 +994,10 @@ 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]=='^') ++ break; ++ + /* extension: multiple consecutive *+?{,} is unspecified, + but (a+)+ has to be supported so accepting a++ makes + sense, note however that the RE_DUP_MAX limit can be +-- +2.7.2 + diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index 9bd7feaa4..a9dcff0f0 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teräs pkgname=musl pkgver=1.1.14 -pkgrel=1 +pkgrel=2 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -12,7 +12,9 @@ depends_dev="!uclibc-dev" makedepends="$depends_dev" subpackages="$pkgname-dev $pkgname-utils $pkgname-dbg libc6-compat:compat" source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz - 0001-fix-handling-of-non-matching-address-family-entries-.patch + 0001-handle-non-matching-address-family-entries-in-hosts-.patch + 0002-fix-at-the-start-of-a-BRE-subexpression.patch + 0003-fix-at-the-start-of-a-complete-BRE.patch ldconfig __stack_chk_fail_local.c @@ -129,21 +131,27 @@ compat() { } md5sums="d529ce4a2f7f79d8c3fd4b8329417b57 musl-1.1.14.tar.gz -a92361d373756777fc0d8f188274207d 0001-fix-handling-of-non-matching-address-family-entries-.patch +c683094384c5726a99d1047f01aeb331 0001-handle-non-matching-address-family-entries-in-hosts-.patch +3b9089a017ac90b303fad94a6aa71219 0002-fix-at-the-start-of-a-BRE-subexpression.patch +6cee220f293754cd1e7126f3d4db5b43 0003-fix-at-the-start-of-a-complete-BRE.patch 830d01f7821b978df770b06db3790921 ldconfig 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c 57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c 2b941c4251cac44988a4abfc50e21267 getent.c 45f92f8d59cf84d765de698a9578dbf4 iconv.c" sha256sums="35f6c00c84a6091bd5dab29eedde7508dae755ead92dcc0239f3677d1055b9b5 musl-1.1.14.tar.gz -6c0663d834cfda068527608236ceb801996ba8c56d8df25a2e68df3379a23350 0001-fix-handling-of-non-matching-address-family-entries-.patch +87d3161c69b347c1cb826a886d098bc03a17a00172c5839c4e30ed1745fb92ec 0001-handle-non-matching-address-family-entries-in-hosts-.patch +0bd21cab29a7a2f6644d1046e7bd91dd5aadf6748e207ddda3ff99e353548775 0002-fix-at-the-start-of-a-BRE-subexpression.patch +13d285aba7e5e33dca32e6adbb5ada69f0f88f0320968b201d03fe02f1a70d4c 0003-fix-at-the-start-of-a-complete-BRE.patch b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c 68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.c f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c" sha512sums="9016246b44a7e6ef51477f0a246373c79f3e796c70031c3323be1b6c4c0518a2d4578f1aa712adfd9a80cdc1d71918bd7a35855052a0452b854755bf0cc2424e musl-1.1.14.tar.gz -b479a30d596328cefcf9ae8cbd0123027da09639fcfd85a06008ea2f0b4f04e82d7196b9e62c221c74734869a35a93d7c8349c1da82dcd7fd16f736f47a5cc62 0001-fix-handling-of-non-matching-address-family-entries-.patch +8546b31b04effe8d863e26ecd1677890e925b0f65f46e09f03804024c36595c944c3d7e758160f57862b9e6c85e431139ff8b2412a29c57eb9773cce327647a5 0001-handle-non-matching-address-family-entries-in-hosts-.patch +18b2f436de9e1c3b8720c93d4a013f069f1f7bb8d71203c157a4670b4fa5749347fd2eba74b47e527f9bb7d98442eaf69837ee69ea1840bf6d1577f14029f089 0002-fix-at-the-start-of-a-BRE-subexpression.patch +51a16e88f602d1db175d82d8276273006b74dc7e87340207e26db80820bab368c50f4d1539175bf3b5b3b23ae6da2e452e81f858029bfef49c54f548bc1a4674 0003-fix-at-the-start-of-a-complete-BRE.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c 0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c -- cgit v1.2.3