summaryrefslogtreecommitdiffstats
path: root/main
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2014-07-08 12:00:44 +0300
committerTimo Teräs <timo.teras@iki.fi>2014-07-08 12:01:26 +0300
commit614de3f348e53eb80ddfbdf8ceef7b32fe546606 (patch)
treefaf3138fd66ec4b39cb518c824278619eebddc04 /main
parent8b7245596cb245a424f00548646c9162b5ff42ce (diff)
downloadaports-614de3f348e53eb80ddfbdf8ceef7b32fe546606.tar.bz2
aports-614de3f348e53eb80ddfbdf8ceef7b32fe546606.tar.xz
main/musl: cherry-pick fixes from upstream git
Diffstat (limited to 'main')
-rw-r--r--main/musl/0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch58
-rw-r--r--main/musl/0003-fix-incorrect-return-value-for-fwide-function.patch29
-rw-r--r--main/musl/0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch42
-rw-r--r--main/musl/0005-fix-multiple-issues-in-legacy-function-getpass.patch61
-rw-r--r--main/musl/APKBUILD18
5 files changed, 207 insertions, 1 deletions
diff --git a/main/musl/0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch b/main/musl/0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch
new file mode 100644
index 000000000..8e2d8e6ff
--- /dev/null
+++ b/main/musl/0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch
@@ -0,0 +1,58 @@
+From e89cfe51d2001af08fc2a13e5133ba8157f90beb Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Tue, 1 Jul 2014 18:27:19 -0400
+Subject: [PATCH] fix aliasing violations in mbtowc and mbrtowc
+
+these functions were setting wc to point to wchar_t aliasing itself as
+a "cheap" way to support null wc arguments. doing so was anything but
+cheap, since even without the aliasing violation, it would limit the
+compiler's ability to optimize.
+
+making wc point to a dummy object is equally easy and does not suffer
+from the above problems.
+---
+ src/multibyte/mbrtowc.c | 3 ++-
+ src/multibyte/mbtowc.c | 3 ++-
+ 2 files changed, 4 insertions(+), 2 deletions(-)
+
+diff --git a/src/multibyte/mbrtowc.c b/src/multibyte/mbrtowc.c
+index 35e834e..e7b3654 100644
+--- a/src/multibyte/mbrtowc.c
++++ b/src/multibyte/mbrtowc.c
+@@ -14,6 +14,7 @@ size_t mbrtowc(wchar_t *restrict wc, const char *restrict src, size_t n, mbstate
+ unsigned c;
+ const unsigned char *s = (const void *)src;
+ const unsigned N = n;
++ wchar_t dummy;
+
+ if (!st) st = (void *)&internal_state;
+ c = *(unsigned *)st;
+@@ -21,7 +22,7 @@ size_t mbrtowc(wchar_t *restrict wc, const char *restrict src, size_t n, mbstate
+ if (!s) {
+ if (c) goto ilseq;
+ return 0;
+- } else if (!wc) wc = (void *)&wc;
++ } else if (!wc) wc = &dummy;
+
+ if (!n) return -2;
+ if (!c) {
+diff --git a/src/multibyte/mbtowc.c b/src/multibyte/mbtowc.c
+index 6710637..803d221 100644
+--- a/src/multibyte/mbtowc.c
++++ b/src/multibyte/mbtowc.c
+@@ -12,10 +12,11 @@ int mbtowc(wchar_t *restrict wc, const char *restrict src, size_t n)
+ {
+ unsigned c;
+ const unsigned char *s = (const void *)src;
++ wchar_t dummy;
+
+ if (!s) return 0;
+ if (!n) goto ilseq;
+- if (!wc) wc = (void *)&wc;
++ if (!wc) wc = &dummy;
+
+ if (*s < 0x80) return !!(*wc = *s);
+ if (*s-SA > SB-SA) goto ilseq;
+--
+2.0.1
+
diff --git a/main/musl/0003-fix-incorrect-return-value-for-fwide-function.patch b/main/musl/0003-fix-incorrect-return-value-for-fwide-function.patch
new file mode 100644
index 000000000..7e5087858
--- /dev/null
+++ b/main/musl/0003-fix-incorrect-return-value-for-fwide-function.patch
@@ -0,0 +1,29 @@
+From ebd8142a6ae19db1a5440d11c01afc7529eae0cd Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Tue, 1 Jul 2014 18:49:54 -0400
+Subject: [PATCH] fix incorrect return value for fwide function
+
+when the orientation of the stream was already set, fwide was
+incorrectly returning its argument (the requested orientation) rather
+than the actual orientation of the stream.
+---
+ src/stdio/fwide.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/stdio/fwide.c b/src/stdio/fwide.c
+index fdf8e4b..8088e7a 100644
+--- a/src/stdio/fwide.c
++++ b/src/stdio/fwide.c
+@@ -7,7 +7,8 @@
+ int fwide(FILE *f, int mode)
+ {
+ FLOCK(f);
+- if (!f->mode) mode = f->mode = NORMALIZE(mode);
++ if (!f->mode) f->mode = NORMALIZE(mode);
++ mode = f->mode;
+ FUNLOCK(f);
+ return mode;
+ }
+--
+2.0.1
+
diff --git a/main/musl/0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch b/main/musl/0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
new file mode 100644
index 000000000..54edaf8c3
--- /dev/null
+++ b/main/musl/0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
@@ -0,0 +1,42 @@
+From 984c25b74da085c6ae6b44a87bbd5f8afc9be331 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Wed, 2 Jul 2014 12:09:48 -0400
+Subject: [PATCH] fix failure of wide printf/scanf functions to set wide
+ orientation
+
+in some cases, these functions internally call a byte-based input or
+output function before calling getwc/putwc, so they cannot rely on the
+latter to set the orientation.
+---
+ src/stdio/vfwprintf.c | 1 +
+ src/stdio/vfwscanf.c | 2 ++
+ 2 files changed, 3 insertions(+)
+
+diff --git a/src/stdio/vfwprintf.c b/src/stdio/vfwprintf.c
+index 984ff7b..c640059 100644
+--- a/src/stdio/vfwprintf.c
++++ b/src/stdio/vfwprintf.c
+@@ -355,6 +355,7 @@ int vfwprintf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
+ }
+
+ FLOCK(f);
++ f->mode |= f->mode+1;
+ ret = wprintf_core(f, fmt, &ap2, nl_arg, nl_type);
+ FUNLOCK(f);
+ va_end(ap2);
+diff --git a/src/stdio/vfwscanf.c b/src/stdio/vfwscanf.c
+index f8f4b70..ac5c2c2 100644
+--- a/src/stdio/vfwscanf.c
++++ b/src/stdio/vfwscanf.c
+@@ -104,6 +104,8 @@ int vfwscanf(FILE *restrict f, const wchar_t *restrict fmt, va_list ap)
+
+ FLOCK(f);
+
++ f->mode |= f->mode+1;
++
+ for (p=fmt; *p; p++) {
+
+ alloc = 0;
+--
+2.0.1
+
diff --git a/main/musl/0005-fix-multiple-issues-in-legacy-function-getpass.patch b/main/musl/0005-fix-multiple-issues-in-legacy-function-getpass.patch
new file mode 100644
index 000000000..8f3a7dd12
--- /dev/null
+++ b/main/musl/0005-fix-multiple-issues-in-legacy-function-getpass.patch
@@ -0,0 +1,61 @@
+From ea496d6c63ecbb5ea475111808e5c0f799354450 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Sun, 6 Jul 2014 01:34:13 -0400
+Subject: [PATCH] fix multiple issues in legacy function getpass
+
+1. failure to output a newline after the password is read
+2. fd leaks via missing FD_CLOEXEC
+3. fd leaks via failure-to-close when any of the standard streams are
+ closed at the time of the call
+4. wrongful fallback to use of stdin when opening /dev/tty fails
+5. wrongful use of stderr rather than /dev/tty for prompt
+6. failure to report error reading password
+---
+ src/legacy/getpass.c | 11 ++++++-----
+ 1 file changed, 6 insertions(+), 5 deletions(-)
+
+diff --git a/src/legacy/getpass.c b/src/legacy/getpass.c
+index 3565d95..15ab985 100644
+--- a/src/legacy/getpass.c
++++ b/src/legacy/getpass.c
+@@ -3,6 +3,7 @@
+ #include <termios.h>
+ #include <unistd.h>
+ #include <fcntl.h>
++#include <string.h>
+
+ char *getpass(const char *prompt)
+ {
+@@ -11,7 +12,7 @@ char *getpass(const char *prompt)
+ ssize_t l;
+ static char password[128];
+
+- if ((fd = open("/dev/tty", O_RDONLY|O_NOCTTY)) < 0) fd = 0;
++ if ((fd = open("/dev/tty", O_RDWR|O_NOCTTY|O_CLOEXEC)) < 0) return 0;
+
+ tcgetattr(fd, &t);
+ s = t;
+@@ -22,8 +23,7 @@ char *getpass(const char *prompt)
+ tcsetattr(fd, TCSAFLUSH, &t);
+ tcdrain(fd);
+
+- fputs(prompt, stderr);
+- fflush(stderr);
++ dprintf(fd, "%s", prompt);
+
+ l = read(fd, password, sizeof password);
+ if (l >= 0) {
+@@ -33,7 +33,8 @@ char *getpass(const char *prompt)
+
+ tcsetattr(fd, TCSAFLUSH, &s);
+
+- if (fd > 2) close(fd);
++ dprintf(fd, "\n");
++ close(fd);
+
+- return password;
++ return l<0 ? 0 : password;
+ }
+--
+2.0.1
+
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index a9d5f34c7..6d59a395e 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.3
-pkgrel=1
+pkgrel=2
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -14,6 +14,10 @@ install="$pkgname.post-upgrade"
subpackages="$pkgname-dev $pkgname-utils $pkgname-dbg"
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
0001-fix-regression-in-dynamic-linker-error-reporting.patch
+ 0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch
+ 0003-fix-incorrect-return-value-for-fwide-function.patch
+ 0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
+ 0005-fix-multiple-issues-in-legacy-function-getpass.patch
1001-add-basic-dns-record-parsing-functions.patch
1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
@@ -118,6 +122,10 @@ utils() {
md5sums="1628bd4c86b14b90447e1dcf8421aed7 musl-1.1.3.tar.gz
672514299b9b0f3fca1ba389c03b23a5 0001-fix-regression-in-dynamic-linker-error-reporting.patch
+fe9d6f28d19f0e8d22073572df7f4e86 0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch
+43790c32ecd7cad6622a1b08e2ec14a7 0003-fix-incorrect-return-value-for-fwide-function.patch
+73c7c31ef8a93e5a8a3dfba5fe4b970d 0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
+ec24fa025b9a24e5c2ca05839956c1fb 0005-fix-multiple-issues-in-legacy-function-getpass.patch
a3810683ef61ac27e2f6ec9801280c81 1001-add-basic-dns-record-parsing-functions.patch
83c3bd2a50b1de5ef948704d3f4e0583 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
013be8897f27c3909ada59c62020502f ldconfig
@@ -128,6 +136,10 @@ cb82d21fed17a116b44b830adba71c5a getconf.c
45f92f8d59cf84d765de698a9578dbf4 iconv.c"
sha256sums="4ef8a7559b947808d41dbea98e24d9f36be38326fb2754a91a35520b4ca4af9f musl-1.1.3.tar.gz
b41d785a8550843febd5e1b5aae55a4fc1847518fd52f76476a0643deb822ff0 0001-fix-regression-in-dynamic-linker-error-reporting.patch
+cb21b6af4a9f9ff478a838b05362a63215fe5721e909acf0f09115ea22be677f 0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch
+f555678ed344f2d06eff9f2e1e46eff95c7df974023ac2ffee3a7aa72dec699d 0003-fix-incorrect-return-value-for-fwide-function.patch
+788279d797f08e8be5857e3124b2684e6d34e5473c0ac9fba60883c518b26d5f 0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
+b72394ced802d6b4e88a2bd9eed24f239c787d0a63d8c2862db13b102c118ce1 0005-fix-multiple-issues-in-legacy-function-getpass.patch
758390768b1bc4159d56908ca332b9640cd0552ed3b4b2b8d4a6d499c54c11a1 1001-add-basic-dns-record-parsing-functions.patch
1c25880095e869b827f02997e864fdf4bf157a4e923e52d97dbd05e657aedb70 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
398dc26ec82cc6af056c738e8ac62da212ba978229d9839eb8b61f7ce536da4a ldconfig
@@ -138,6 +150,10 @@ d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c
f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c"
sha512sums="c580c700d609eced15dc398ff6dcbc2e38fab24eaa5ea80a58c3d41d9f749579cce328bbad149f2b5975533d6ec051e6cc08be3bea4d65e143fc850745bf24c2 musl-1.1.3.tar.gz
c41219cfd0ee302ca0f8063102ec42cbaabf809ac7cc2ea3c7a7aa1d2aec246be843e6225eb23409e90710e4be0ebcc1c7f0bafaa4060e66f99c6c84f0f4956d 0001-fix-regression-in-dynamic-linker-error-reporting.patch
+d621e097f8b23c9bd1dffa4dbc471db0fee0aa3665d9c4588daa1b1479d011f0963b615af559433073e5b92d6207dd6ed7ab3f4b02cdd20ac3149e2024d531d1 0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch
+bc06965a05d1e482a7ab0bcba8230b45778ab19ee907bddb68cf5496c38d23d51780d12980bb68344ff43b4c7c5f8e6edbbb576632f3e2ff50cc515b43e7985c 0003-fix-incorrect-return-value-for-fwide-function.patch
+e16fc1a78c128212fc82488b0e2291cb64656d1c0938bda9c6e96aa285676bd959d1cd10192287c339a20a6e76a32176c04a3697b8f6b068629d63eb8494b5dd 0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch
+8868b29c1fc520b081601b2c4b750e2b4fdb76166cd64702aa2b22aca86b5a541fbd393243c55a3d59aca9944e17b0fe9c93673547da04b2517163c271c30fbf 0005-fix-multiple-issues-in-legacy-function-getpass.patch
dad965258daf69371b844f76bfe5a914b0eca0ca76f3fc340b8fd7acf598b5f87bbe6d68b1f43ed0293ee0ed3bfd85d5173ccc169aa6265646248d5b8a906708 1001-add-basic-dns-record-parsing-functions.patch
72cf33738d2cf31f6ec02312bc494d754c17470b519172bb8bd7e2e29ac3b119023088a2b3fbc0dbc2fddd0078ccbae62096106cae361f8c31d6a9950043af25 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch
33e13d2242063f3dc9ec199ae9528e469a52ccae4d3726faa3c866e0c7dcf546f69294f9c00307324cee05fd965f84350ae100b8b1138f9d9c8c916de04ab0d1 ldconfig