diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-12-10 11:33:36 +0200 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-12-10 16:54:44 +0200 |
commit | 216abf915ceb481f6b30e7f1b3b0929bab3d48e9 (patch) | |
tree | 8ae61c5739222f85d5e8867b803f6110c5064e96 | |
parent | 8327d72e3684534eb1b0ea4352d972ed0e52cc8c (diff) | |
download | aports-216abf915ceb481f6b30e7f1b3b0929bab3d48e9.tar.bz2 aports-216abf915ceb481f6b30e7f1b3b0929bab3d48e9.tar.xz |
main/musl: additional fixes
6 files changed, 322 insertions, 1 deletions
diff --git a/main/musl/0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch b/main/musl/0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch new file mode 100644 index 0000000000..dc41304726 --- /dev/null +++ b/main/musl/0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch @@ -0,0 +1,57 @@ +From 014275b547e3059db5c45986408757c250e8198d Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Thu, 4 Dec 2014 10:23:33 -0500 +Subject: [PATCH] fix getopt handling of ':' modifier for multibyte option + characters + +the previous hard-coded offsets of +1 and +2 contained a hidden +assumption that the option character matched was single-byte, despite +this implementation of getopt attempting to support multibyte option +characters. this patch reworks the matching logic to leave the final +index pointing just past the matched character so that fixed offsets +can be used to check for ':'. +--- + src/misc/getopt.c | 13 +++++++++---- + 1 file changed, 9 insertions(+), 4 deletions(-) + +diff --git a/src/misc/getopt.c b/src/misc/getopt.c +index a698c8d..52aa7a3 100644 +--- a/src/misc/getopt.c ++++ b/src/misc/getopt.c +@@ -58,7 +58,12 @@ int getopt(int argc, char * const argv[], const char *optstring) + if (optstring[0] == '-') + optstring++; + +- for (i=0; (l = mbtowc(&d, optstring+i, MB_LEN_MAX)) && d!=c; i+=l>0?l:1); ++ i = 0; ++ d = 0; ++ do { ++ l = mbtowc(&d, optstring+i, MB_LEN_MAX); ++ if (l>0) i+=l; else i++; ++ } while (l && d != c); + + if (d != c) { + if (optstring[0] != ':' && opterr) { +@@ -69,8 +74,8 @@ int getopt(int argc, char * const argv[], const char *optstring) + } + return '?'; + } +- if (optstring[i+1] == ':') { +- if (optstring[i+2] == ':') optarg = 0; ++ if (optstring[i] == ':') { ++ if (optstring[i+1] == ':') optarg = 0; + else if (optind >= argc) { + if (optstring[0] == ':') return ':'; + if (opterr) { +@@ -81,7 +86,7 @@ int getopt(int argc, char * const argv[], const char *optstring) + } + return '?'; + } +- if (optstring[i+2] != ':' || optpos) { ++ if (optstring[i+1] != ':' || optpos) { + optarg = argv[optind++] + optpos; + optpos = 0; + } +-- +2.2.0 + diff --git a/main/musl/0016-don-t-fail-posix_spawn-on-failed-close.patch b/main/musl/0016-don-t-fail-posix_spawn-on-failed-close.patch new file mode 100644 index 0000000000..b7aff4f610 --- /dev/null +++ b/main/musl/0016-don-t-fail-posix_spawn-on-failed-close.patch @@ -0,0 +1,30 @@ +From 1c12c24364d1058ffdbb28fca72a51de85082778 Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Fri, 5 Dec 2014 21:15:41 -0500 +Subject: [PATCH] don't fail posix_spawn on failed close + +the resolution of austin group issue #370 removes the requirement that +posix_spawn fail when the close file action is performed on an +already-closed fd. since there are no other meaningful errors for +close, just ignoring the return value completely is the simplest fix. +--- + src/process/posix_spawn.c | 3 +-- + 1 file changed, 1 insertion(+), 2 deletions(-) + +diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c +index ae262f7..af12731 100644 +--- a/src/process/posix_spawn.c ++++ b/src/process/posix_spawn.c +@@ -102,8 +102,7 @@ static int child(void *args_vp) + } + switch(op->cmd) { + case FDOP_CLOSE: +- if ((ret=__syscall(SYS_close, op->fd))) +- goto fail; ++ __syscall(SYS_close, op->fd); + break; + case FDOP_DUP2: + if ((ret=__sys_dup2(op->srcfd, op->fd))<0) +-- +2.2.0 + diff --git a/main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch b/main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch new file mode 100644 index 0000000000..e7d39dd71e --- /dev/null +++ b/main/musl/0017-use-direct-syscall-rather-than-write-function-in-pos.patch @@ -0,0 +1,31 @@ +From 8f7bc690f07e90177b176b6e19736ad7c1d49840 Mon Sep 17 00:00:00 2001 +From: Rich Felker <dalias@aerifal.cx> +Date: Fri, 5 Dec 2014 21:19:39 -0500 +Subject: [PATCH] use direct syscall rather than write function in posix_spawn + child + +the write function is a cancellation point and accesses thread-local +state belonging to the calling thread in the parent process. since +cancellation is blocked for the duration of posix_spawn, this is +probably safe, but it's fragile and unnecessary. making the syscall +directly is just as easy and clearly safe. +--- + src/process/posix_spawn.c | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c +index af12731..0bdf71c 100644 +--- a/src/process/posix_spawn.c ++++ b/src/process/posix_spawn.c +@@ -136,7 +136,7 @@ static int child(void *args_vp) + fail: + /* Since sizeof errno < PIPE_BUF, the write is atomic. */ + ret = -ret; +- if (ret) while (write(p, &ret, sizeof ret) < 0); ++ if (ret) while (__syscall(SYS_write, p, &ret, sizeof ret) < 0); + _exit(127); + } + +-- +2.2.0 + diff --git a/main/musl/0018-don-t-shadow-functions-with-macros-in-C.patch b/main/musl/0018-don-t-shadow-functions-with-macros-in-C.patch new file mode 100644 index 0000000000..1078ec32cf --- /dev/null +++ b/main/musl/0018-don-t-shadow-functions-with-macros-in-C.patch @@ -0,0 +1,69 @@ +From f164875a84c35d0e0d132f99330d3fcda76ee7aa Mon Sep 17 00:00:00 2001 +From: Bobby Bingham <koorogi@koorogi.info> +Date: Mon, 8 Dec 2014 20:18:12 -0600 +Subject: [PATCH] don't shadow functions with macros in C++ + +C++ programmers typically expect something like "::function(x,y)" to work +and may be surprised to find that "(::function)(x,y)" is actually required +due to the headers declaring a macro version of some standard functions. + +We already omit function-like macros for C++ in most cases where there is +a real function available. This commit extends this to the remaining +function-like macros which have a real function version. +--- + include/complex.h | 2 ++ + include/pthread.h | 2 ++ + include/threads.h | 2 ++ + 3 files changed, 6 insertions(+) + +diff --git a/include/complex.h b/include/complex.h +index 13a45c5..e1af0d5 100644 +--- a/include/complex.h ++++ b/include/complex.h +@@ -101,6 +101,7 @@ double creal(double complex); + float crealf(float complex); + long double creall(long double complex); + ++#ifndef __cplusplus + #define __CIMAG(x, t) \ + ((union { _Complex t __z; t __xy[2]; }){(_Complex t)(x)}.__xy[1]) + +@@ -111,6 +112,7 @@ long double creall(long double complex); + #define cimag(x) __CIMAG(x, double) + #define cimagf(x) __CIMAG(x, float) + #define cimagl(x) __CIMAG(x, long double) ++#endif + + #define __CMPLX(x, y, t) \ + ((union { _Complex t __z; t __xy[2]; }){.__xy = {(x),(y)}}.__z) +diff --git a/include/pthread.h b/include/pthread.h +index f7c9568..2697e8b 100644 +--- a/include/pthread.h ++++ b/include/pthread.h +@@ -84,7 +84,9 @@ __attribute__((const)) + pthread_t pthread_self(void); + + int pthread_equal(pthread_t, pthread_t); ++#ifndef __cplusplus + #define pthread_equal(x,y) ((x)==(y)) ++#endif + + int pthread_setcancelstate(int, int *); + int pthread_setcanceltype(int, int *); +diff --git a/include/threads.h b/include/threads.h +index 0e5836c..0179482 100644 +--- a/include/threads.h ++++ b/include/threads.h +@@ -51,7 +51,9 @@ void thrd_yield(void); + + thrd_t thrd_current(void); + int thrd_equal(thrd_t, thrd_t); ++#ifndef __cplusplus + #define thrd_equal(A, B) ((A) == (B)) ++#endif + + void call_once(once_flag *, void (*)(void)); + +-- +2.2.0 + diff --git a/main/musl/1002-implement-FNM_CASEFOLD-gnu-extension.patch b/main/musl/1002-implement-FNM_CASEFOLD-gnu-extension.patch new file mode 100644 index 0000000000..21a4308b5a --- /dev/null +++ b/main/musl/1002-implement-FNM_CASEFOLD-gnu-extension.patch @@ -0,0 +1,114 @@ +From bfc8d9df41d16bb8beb3625286576c44f10cb898 Mon Sep 17 00:00:00 2001 +From: Nagy Szabolcs <nsz@port70.net> +Date: Fri, 10 Oct 2014 12:09:03 +0200 +Subject: [PATCH] implement FNM_CASEFOLD gnu extension + +--- + src/regex/fnmatch.c | 36 +++++++++++++++++++++++++----------- + 1 file changed, 25 insertions(+), 11 deletions(-) + +diff --git a/src/regex/fnmatch.c b/src/regex/fnmatch.c +index 4df10a3..7f6b65f 100644 +--- a/src/regex/fnmatch.c ++++ b/src/regex/fnmatch.c +@@ -97,7 +97,13 @@ escaped: + return pat[0]; + } + +-static int match_bracket(const char *p, int k) ++static int casefold(int k) ++{ ++ int c = towupper(k); ++ return c == k ? towlower(k) : c; ++} ++ ++static int match_bracket(const char *p, int k, int kfold) + { + wchar_t wc; + int inv = 0; +@@ -119,7 +125,10 @@ static int match_bracket(const char *p, int k) + wchar_t wc2; + int l = mbtowc(&wc2, p+1, 4); + if (l < 0) return 0; +- if (wc<=wc2 && (unsigned)k-wc <= wc2-wc) return !inv; ++ if (wc <= wc2) ++ if ((unsigned)k-wc <= wc2-wc || ++ (unsigned)kfold-wc <= wc2-wc) ++ return !inv; + p += l-1; + continue; + } +@@ -132,7 +141,9 @@ static int match_bracket(const char *p, int k) + char buf[16]; + memcpy(buf, p0, p-1-p0); + buf[p-1-p0] = 0; +- if (iswctype(k, wctype(buf))) return !inv; ++ if (iswctype(k, wctype(buf)) || ++ iswctype(kfold, wctype(buf))) ++ return !inv; + } + continue; + } +@@ -143,7 +154,7 @@ static int match_bracket(const char *p, int k) + if (l < 0) return 0; + p += l-1; + } +- if (wc==k) return !inv; ++ if (wc==k || wc==kfold) return !inv; + } + return inv; + } +@@ -153,7 +164,7 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n + const char *p, *ptail, *endpat; + const char *s, *stail, *endstr; + size_t pinc, sinc, tailcnt=0; +- int c, k; ++ int c, k, kfold; + + if (flags & FNM_PERIOD) { + if (*str == '.' && *pat != '.') +@@ -173,10 +184,11 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n + return (c==END) ? 0 : FNM_NOMATCH; + str += sinc; + n -= sinc; ++ kfold = flags & FNM_CASEFOLD ? casefold(k) : k; + if (c == BRACKET) { +- if (!match_bracket(pat, k)) ++ if (!match_bracket(pat, k, kfold)) + return FNM_NOMATCH; +- } else if (c != QUESTION && k != c) { ++ } else if (c != QUESTION && k != c && kfold != c) { + return FNM_NOMATCH; + } + pat+=pinc; +@@ -233,10 +245,11 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n + break; + } + s += sinc; ++ kfold = flags & FNM_CASEFOLD ? casefold(k) : k; + if (c == BRACKET) { +- if (!match_bracket(p-pinc, k)) ++ if (!match_bracket(p-pinc, k, kfold)) + return FNM_NOMATCH; +- } else if (c != QUESTION && k != c) { ++ } else if (c != QUESTION && k != c && kfold != c) { + return FNM_NOMATCH; + } + } +@@ -261,10 +274,11 @@ static int fnmatch_internal(const char *pat, size_t m, const char *str, size_t n + k = str_next(s, endstr-s, &sinc); + if (!k) + return FNM_NOMATCH; ++ kfold = flags & FNM_CASEFOLD ? casefold(k) : k; + if (c == BRACKET) { +- if (!match_bracket(p-pinc, k)) ++ if (!match_bracket(p-pinc, k, kfold)) + break; +- } else if (c != QUESTION && k != c) { ++ } else if (c != QUESTION && k != c && kfold != c) { + break; + } + s += sinc; +-- +2.1.0 + diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index 0c77871f9e..92913fe210 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.5 -pkgrel=1 +pkgrel=2 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -27,7 +27,12 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz 0012-fix-uninitialized-output-from-sched_getaffinity.patch 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch 0014-add-arm-private-syscall-numbers.patch + 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch + 0016-don-t-fail-posix_spawn-on-failed-close.patch + 0017-use-direct-syscall-rather-than-write-function-in-pos.patch + 0018-don-t-shadow-functions-with-macros-in-C.patch 1001-add-basic-dns-record-parsing-functions.patch + 1002-implement-FNM_CASEFOLD-gnu-extension.patch 1003-remove-ulimit-fiddling-from-setxid.patch ldconfig @@ -146,7 +151,12 @@ d7cc03dbd77755b25c7108aada242980 0008-implement-a-private-state-for-the-uchar.h d9b4d921348fa86e57c44bf4c95714bd 0012-fix-uninitialized-output-from-sched_getaffinity.patch 4ac6a08107b65927400f59f8f5e07f15 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch 5d8dde8258654d404d0b7a06c5046829 0014-add-arm-private-syscall-numbers.patch +256165e3059e1b2ed76397d53870eb5d 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch +346d4db3e125b0679a4e5fedcbd99644 0016-don-t-fail-posix_spawn-on-failed-close.patch +b3e9f774ca938dcd1833dbe4af44fea8 0017-use-direct-syscall-rather-than-write-function-in-pos.patch +c59cc913f8ce2daffe4ceecc136ff81d 0018-don-t-shadow-functions-with-macros-in-C.patch 2371eb1ce057fcb709a0e6a81f0d356c 1001-add-basic-dns-record-parsing-functions.patch +c4c2f5b48af0aef958d191659b9e5192 1002-implement-FNM_CASEFOLD-gnu-extension.patch 71b2a4dcc39c436a6b89173943424043 1003-remove-ulimit-fiddling-from-setxid.patch 830d01f7821b978df770b06db3790921 ldconfig 61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c @@ -169,7 +179,12 @@ bb48d16025f1a8323673141a0d6e5b5e54ddfbf7056cf8e2e38343e55a85a67e 0010-adapt-dyn e3622c3b84c0f984b864ecdf5d26f602723d81afee0c9c5dd5a2f0f1b6325965 0012-fix-uninitialized-output-from-sched_getaffinity.patch a6fa226f2bc0b2f56ef38df09bfe066b70e00d915b99657c2ced29c1262dfce4 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch fa2306adeda1a2ee733fcbc64fc8e0bb377b3c0dd6870ea15322722f08d135e1 0014-add-arm-private-syscall-numbers.patch +8c3ca04de81c487c7c8a237adeae3800adcc00996a2535fbdccd3d683be30abf 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch +598856ea334962a36b3ff99d1909306deb7dfe235b0ab8c5e20e531027fe4cf4 0016-don-t-fail-posix_spawn-on-failed-close.patch +0f7a2a055c87c2a2616b106fcf5d9f35c8a710c12383e652744f7429e0bfae96 0017-use-direct-syscall-rather-than-write-function-in-pos.patch +da4d97570b552e332859f66c1a6fe8f4dee66b809e1e9f39fb1a3fc5a6e3574d 0018-don-t-shadow-functions-with-macros-in-C.patch 75053a31f6b84a64846d92c0ec631c76d7f747a9c0dc92a6dc1aa1bddfe2ea76 1001-add-basic-dns-record-parsing-functions.patch +57cb534a603dce32efa48be04ce7b1ca3f287fd8cc72258589fd529e86c1dd47 1002-implement-FNM_CASEFOLD-gnu-extension.patch fb542c2bd5081ff2f601c519edb3dac8f54ca5c888f44bc6cfb84e6565472025 1003-remove-ulimit-fiddling-from-setxid.patch b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c @@ -192,7 +207,12 @@ c15f3a2cbc7e83efbad86930d64e3dd131a4ecc0c0956a395d344ef7e6d2e60d70b2181aefe7c2dd fcd04e66c812d108712d2ad937f117500d73311a0d1390bd6834d2093d844751bb0644f8b4ea820a3430b7b73e318a84e58f26419d5e664fb56b4507f5cf8e9c 0012-fix-uninitialized-output-from-sched_getaffinity.patch 85c3082a4fde1ec2739eb78b820792430cba9aeb082c53718698681b929675ee73546968cc3a41b38711afa2d140296bee7d9e7f43e9d5279cc7fd508835b1fc 0013-fix-return-value-of-pthread_getaffinity_np-and-pthre.patch 3374b983f6a5e4f8f0dc3e67c0cfb0d6fac153c6d5f7e604381e898b318f183faf8fc3995b960cd5a5fd7df0127b16cc6a98e3b0a534b1f156412af492f90ba1 0014-add-arm-private-syscall-numbers.patch +9a7a8a5acb59f45d9fd950d508419ccf10213d954659f454de2fe0542be132497cf19605bb59ed641c171d27053c22789b4d6012b6574721587358e7b6efdad1 0015-fix-getopt-handling-of-modifier-for-multibyte-option.patch +54a747fb14b38ffdd0abcd6b202a01e3e778cf853152a4554f7941a2e2544ab1c4c498e2646f421b421180e934ff0ff3372bbd8e08b59b800378cfb2db179940 0016-don-t-fail-posix_spawn-on-failed-close.patch +59060226956ddef64ade61b98a46a6faa5896061186abfa5a8adf1786584beff79acfa6197e2dc7ee1104ad300eda979ad18b6d5466a5dc98ae8957576a5b09d 0017-use-direct-syscall-rather-than-write-function-in-pos.patch +a627055d150087fae4d484c60ac7be8cccae0c1b8ddb88684d7b03255c72c1306dc55b7a1ee08ef691691a6b79bfd335609ea5271363c9f4824e48043dd5b037 0018-don-t-shadow-functions-with-macros-in-C.patch 5b8ffa0a50419581adbf6ce2dae5797774022551c6331fa5aa2ff13635eb72b74eedd8a92cb478d45d73e1956af2f588669681ac414f3a255abd4d8ba8579448 1001-add-basic-dns-record-parsing-functions.patch +f379f2308a8ed04560d08db90935acf56617d1b650f6227212e9ad530b53318aaecfea326ad4727439112b602a810db6857d1fe72d6e3ddeec519c99cd3608d2 1002-implement-FNM_CASEFOLD-gnu-extension.patch dae010b45419fcab64410568466f659cdc874e63113025e2cbc2fbab047b470fec23851ecbef08886505924482a069caf37c16b483b6922535fbd31832f1c4a3 1003-remove-ulimit-fiddling-from-setxid.patch 8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c |