aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-06-21 11:29:38 +0300
committerTimo Teräs <timo.teras@iki.fi>2017-06-21 11:29:38 +0300
commitd985d2b50a41eb5f9ba682f4afe72ac2c59b53e8 (patch)
tree767a67cd54db1beb8549106f1b729699411df431 /main/musl
parent6b899d49bd1d15c8390bd53e710da0b26a36218e (diff)
downloadaports-d985d2b50a41eb5f9ba682f4afe72ac2c59b53e8.tar.bz2
aports-d985d2b50a41eb5f9ba682f4afe72ac2c59b53e8.tar.xz
main/musl: cherry-pick upstream fixes
Diffstat (limited to 'main/musl')
-rw-r--r--main/musl/0042-fix-glob-failure-to-match-plain-to-root-directory.patch30
-rw-r--r--main/musl/0043-catopen-set-errno-to-EOPNOTSUPP.patch29
-rw-r--r--main/musl/0044-getdate-correctly-specify-error-number.patch33
-rw-r--r--main/musl/0045-handle-mremap-failure-in-realloc-of-mmap-serviced-al.patch39
-rw-r--r--main/musl/0046-handle-localtime-errors-in-ctime.patch30
-rw-r--r--main/musl/0047-set-errno-when-getpw-_r-getgr-_r-and-getspnam_r-fail.patch74
-rw-r--r--main/musl/0048-handle-errors-from-localtime_r-in-ctime_r.patch31
-rw-r--r--main/musl/0049-fix-iconv-conversions-for-iso88592-iso885916.patch29
-rw-r--r--main/musl/APKBUILD18
9 files changed, 312 insertions, 1 deletions
diff --git a/main/musl/0042-fix-glob-failure-to-match-plain-to-root-directory.patch b/main/musl/0042-fix-glob-failure-to-match-plain-to-root-directory.patch
new file mode 100644
index 0000000000..cc9166248e
--- /dev/null
+++ b/main/musl/0042-fix-glob-failure-to-match-plain-to-root-directory.patch
@@ -0,0 +1,30 @@
+From 84eff797e3e38210cc311b000b1586b948b4fc35 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Thu, 8 Jun 2017 19:50:23 -0400
+Subject: [PATCH] fix glob failure to match plain "/" to root directory
+
+the check to prevent matching empty string wrongly blocked matching
+of "/" due to checking emptiness after stripping leading slashes
+rather than checking the full original argument string.
+
+simplified from patch by Julien Ramseier.
+---
+ src/regex/glob.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/regex/glob.c b/src/regex/glob.c
+index 5b6ff124..2d4d562e 100644
+--- a/src/regex/glob.c
++++ b/src/regex/glob.c
+@@ -179,7 +179,7 @@ int glob(const char *restrict pat, int flags, int (*errfunc)(const char *path, i
+
+ if (strnlen(p, PATH_MAX+1) > PATH_MAX) return GLOB_NOSPACE;
+
+- if (*p) error = match_in_dir(d, p, flags, errfunc, &tail);
++ if (*pat) error = match_in_dir(d, p, flags, errfunc, &tail);
+ if (error == GLOB_NOSPACE) {
+ freelist(&head);
+ return error;
+--
+2.13.0
+
diff --git a/main/musl/0043-catopen-set-errno-to-EOPNOTSUPP.patch b/main/musl/0043-catopen-set-errno-to-EOPNOTSUPP.patch
new file mode 100644
index 0000000000..4d87ad4429
--- /dev/null
+++ b/main/musl/0043-catopen-set-errno-to-EOPNOTSUPP.patch
@@ -0,0 +1,29 @@
+From af0517301677b4206c605caaef25f5d57a31b5b8 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Fri, 9 Jun 2017 00:26:16 -0500
+Subject: [PATCH] catopen: set errno to EOPNOTSUPP
+
+Per 1003.1-2008 (2016 ed.), catopen must set errno on failure.
+
+We set errno to EOPNOTSUPP because musl does not currently support
+message catalogues.
+---
+ src/locale/catopen.c | 2 ++
+ 1 file changed, 2 insertions(+)
+
+diff --git a/src/locale/catopen.c b/src/locale/catopen.c
+index 4423c4d9..3fbc7717 100644
+--- a/src/locale/catopen.c
++++ b/src/locale/catopen.c
+@@ -1,6 +1,8 @@
+ #include <nl_types.h>
++#include <errno.h>
+
+ nl_catd catopen (const char *name, int oflag)
+ {
++ errno = EOPNOTSUPP;
+ return (nl_catd)-1;
+ }
+--
+2.13.0
+
diff --git a/main/musl/0044-getdate-correctly-specify-error-number.patch b/main/musl/0044-getdate-correctly-specify-error-number.patch
new file mode 100644
index 0000000000..e9e48068a9
--- /dev/null
+++ b/main/musl/0044-getdate-correctly-specify-error-number.patch
@@ -0,0 +1,33 @@
+From 10800088099ec4c27c1db6c613c8bbf9f76e4057 Mon Sep 17 00:00:00 2001
+From: "A. Wilcox" <AWilcox@Wilcox-Tech.com>
+Date: Fri, 9 Jun 2017 00:26:18 -0500
+Subject: [PATCH] getdate: correctly specify error number
+
+POSIX defines getdate error #5 as:
+"An I/O error is encountered while reading the template file."
+
+POSIX defines getdate error #7 as:
+"There is no line in the template that matches the input."
+
+This change correctly disambiguates between the two error conditions.
+---
+ src/time/getdate.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/time/getdate.c b/src/time/getdate.c
+index 89f21699..420cd8e4 100644
+--- a/src/time/getdate.c
++++ b/src/time/getdate.c
+@@ -37,7 +37,8 @@ struct tm *getdate(const char *s)
+ }
+ }
+
+- getdate_err = 7;
++ if (ferror(f)) getdate_err = 5;
++ else getdate_err = 7;
+ out:
+ if (f) fclose(f);
+ pthread_setcancelstate(cs, 0);
+--
+2.13.0
+
diff --git a/main/musl/0045-handle-mremap-failure-in-realloc-of-mmap-serviced-al.patch b/main/musl/0045-handle-mremap-failure-in-realloc-of-mmap-serviced-al.patch
new file mode 100644
index 0000000000..b5c86231d1
--- /dev/null
+++ b/main/musl/0045-handle-mremap-failure-in-realloc-of-mmap-serviced-al.patch
@@ -0,0 +1,39 @@
+From 1c86c7f5c26dd0569df7afc23ee9866fb3f645dc Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Thu, 15 Jun 2017 12:54:40 -0400
+Subject: [PATCH] handle mremap failure in realloc of mmap-serviced allocations
+
+mremap seems to always fail on nommu, and on some non-Linux
+implementations of the Linux syscall API, it at least fails to
+increase allocation size, and may fail to move (i.e. defragment) the
+existing mapping when shrinking it too. instead of failing realloc or
+leaving an over-sized allocation that may waste a large amount of
+memory, fallback to malloc-memcpy-free if mremap fails.
+---
+ src/malloc/malloc.c | 3 ++-
+ 1 file changed, 2 insertions(+), 1 deletion(-)
+
+diff --git a/src/malloc/malloc.c b/src/malloc/malloc.c
+index c38c46fe..d5ee4280 100644
+--- a/src/malloc/malloc.c
++++ b/src/malloc/malloc.c
+@@ -406,7 +406,7 @@ void *realloc(void *p, size_t n)
+ if (oldlen == newlen) return p;
+ base = __mremap(base, oldlen, newlen, MREMAP_MAYMOVE);
+ if (base == (void *)-1)
+- return newlen < oldlen ? p : 0;
++ goto copy_realloc;
+ self = (void *)(base + extra);
+ self->csize = newlen - extra;
+ return CHUNK_TO_MEM(self);
+@@ -439,6 +439,7 @@ void *realloc(void *p, size_t n)
+ return CHUNK_TO_MEM(self);
+ }
+
++copy_realloc:
+ /* As a last resort, allocate a new chunk and copy to it. */
+ new = malloc(n-OVERHEAD);
+ if (!new) return 0;
+--
+2.13.0
+
diff --git a/main/musl/0046-handle-localtime-errors-in-ctime.patch b/main/musl/0046-handle-localtime-errors-in-ctime.patch
new file mode 100644
index 0000000000..00a4dce65e
--- /dev/null
+++ b/main/musl/0046-handle-localtime-errors-in-ctime.patch
@@ -0,0 +1,30 @@
+From 5c10c33d2a35204ee76931625a007fcc8cca3228 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Thu, 15 Jun 2017 12:58:08 -0400
+Subject: [PATCH] handle localtime errors in ctime
+
+ctime passes the result from localtime directly to asctime. But in case
+of error, localtime returns 0. This causes an error (NULL pointer
+dereference) in asctime.
+
+based on patch by Omer Anson.
+---
+ src/time/ctime.c | 4 +++-
+ 1 file changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/src/time/ctime.c b/src/time/ctime.c
+index 185ec554..36029315 100644
+--- a/src/time/ctime.c
++++ b/src/time/ctime.c
+@@ -2,5 +2,7 @@
+
+ char *ctime(const time_t *t)
+ {
+- return asctime(localtime(t));
++ struct tm *tm = localtime(t);
++ if (!tm) return 0;
++ return asctime(tm);
+ }
+--
+2.13.0
+
diff --git a/main/musl/0047-set-errno-when-getpw-_r-getgr-_r-and-getspnam_r-fail.patch b/main/musl/0047-set-errno-when-getpw-_r-getgr-_r-and-getspnam_r-fail.patch
new file mode 100644
index 0000000000..fa687c429d
--- /dev/null
+++ b/main/musl/0047-set-errno-when-getpw-_r-getgr-_r-and-getspnam_r-fail.patch
@@ -0,0 +1,74 @@
+From 2d7d05f031e014068a61d3076c6178513395d2ae Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Thu, 15 Jun 2017 13:01:34 -0400
+Subject: [PATCH] set errno when getpw*_r, getgr*_r, and getspnam_r fail
+
+these functions return an error code, and are not explicitly
+documented to set errno, but they are nonstandard and the historical
+implementations do set errno as well, and some applications expect
+this behavior. do likewise for compatibility.
+
+patch by Rudolph Pereira.
+---
+ src/passwd/getgr_r.c | 1 +
+ src/passwd/getpw_r.c | 1 +
+ src/passwd/getspnam_r.c | 8 +++++---
+ 3 files changed, 7 insertions(+), 3 deletions(-)
+
+diff --git a/src/passwd/getgr_r.c b/src/passwd/getgr_r.c
+index 7246e8a4..f3e8f603 100644
+--- a/src/passwd/getgr_r.c
++++ b/src/passwd/getgr_r.c
+@@ -34,6 +34,7 @@ static int getgr_r(const char *name, gid_t gid, struct group *gr, char *buf, siz
+ free(mem);
+ free(line);
+ pthread_setcancelstate(cs, 0);
++ if (rv) errno = rv;
+ return rv;
+ }
+
+diff --git a/src/passwd/getpw_r.c b/src/passwd/getpw_r.c
+index e8cc811e..0c87ab05 100644
+--- a/src/passwd/getpw_r.c
++++ b/src/passwd/getpw_r.c
+@@ -27,6 +27,7 @@ static int getpw_r(const char *name, uid_t uid, struct passwd *pw, char *buf, si
+ }
+ free(line);
+ pthread_setcancelstate(cs, 0);
++ if (rv) errno = rv;
+ return rv;
+ }
+
+diff --git a/src/passwd/getspnam_r.c b/src/passwd/getspnam_r.c
+index 92339528..e488b67f 100644
+--- a/src/passwd/getspnam_r.c
++++ b/src/passwd/getspnam_r.c
+@@ -72,14 +72,15 @@ int getspnam_r(const char *name, struct spwd *sp, char *buf, size_t size, struct
+
+ /* Disallow potentially-malicious user names */
+ if (*name=='.' || strchr(name, '/') || !l)
+- return EINVAL;
++ return errno = EINVAL;
+
+ /* Buffer size must at least be able to hold name, plus some.. */
+- if (size < l+100) return ERANGE;
++ if (size < l+100)
++ return errno = EINVAL;
+
+ /* Protect against truncation */
+ if (snprintf(path, sizeof path, "/etc/tcb/%s/shadow", name) >= sizeof path)
+- return EINVAL;
++ return errno = EINVAL;
+
+ fd = open(path, O_RDONLY|O_NOFOLLOW|O_NONBLOCK|O_CLOEXEC);
+ if (fd >= 0) {
+@@ -112,5 +113,6 @@ int getspnam_r(const char *name, struct spwd *sp, char *buf, size_t size, struct
+ break;
+ }
+ pthread_cleanup_pop(1);
++ if (rv) errno = rv;
+ return rv;
+ }
+--
+2.13.0
+
diff --git a/main/musl/0048-handle-errors-from-localtime_r-in-ctime_r.patch b/main/musl/0048-handle-errors-from-localtime_r-in-ctime_r.patch
new file mode 100644
index 0000000000..37d608e4a3
--- /dev/null
+++ b/main/musl/0048-handle-errors-from-localtime_r-in-ctime_r.patch
@@ -0,0 +1,31 @@
+From 64f855874c32e192382df69f4765a7e32057a005 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Tue, 20 Jun 2017 20:31:35 -0400
+Subject: [PATCH] handle errors from localtime_r in ctime_r
+
+POSIX requires ctime_r return a null pointer on failure, which can
+occur if the input time_t value is not representable in broken down
+form.
+
+based on patch by Alexander Monakov.
+---
+ src/time/ctime_r.c | 5 ++---
+ 1 file changed, 2 insertions(+), 3 deletions(-)
+
+diff --git a/src/time/ctime_r.c b/src/time/ctime_r.c
+index d2260a16..3e24aa68 100644
+--- a/src/time/ctime_r.c
++++ b/src/time/ctime_r.c
+@@ -2,7 +2,6 @@
+
+ char *ctime_r(const time_t *t, char *buf)
+ {
+- struct tm tm;
+- localtime_r(t, &tm);
+- return asctime_r(&tm, buf);
++ struct tm tm, *tm_p = localtime_r(t, &tm);
++ return tm_p ? asctime_r(tm_p, buf) : 0;
+ }
+--
+2.13.0
+
diff --git a/main/musl/0049-fix-iconv-conversions-for-iso88592-iso885916.patch b/main/musl/0049-fix-iconv-conversions-for-iso88592-iso885916.patch
new file mode 100644
index 0000000000..721c2b31b9
--- /dev/null
+++ b/main/musl/0049-fix-iconv-conversions-for-iso88592-iso885916.patch
@@ -0,0 +1,29 @@
+From b7bfb5c3a8330002250f304cb5deb522fa054eae Mon Sep 17 00:00:00 2001
+From: Bartosz Brachaczek <b.brachaczek@gmail.com>
+Date: Thu, 15 Jun 2017 23:30:48 +0200
+Subject: [PATCH] fix iconv conversions for iso88592-iso885916
+
+commit 97bd6b09dbe7478d5a90a06ecd9e5b59389d8eb9 refactored the table
+lookup into a function and introduced an error in index computation.
+the error caused garbage to be read from the table if the given charmap
+had a non-zero number of elided entries.
+---
+ src/locale/iconv.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/locale/iconv.c b/src/locale/iconv.c
+index 4636307f..fd2f2e01 100644
+--- a/src/locale/iconv.c
++++ b/src/locale/iconv.c
+@@ -153,7 +153,7 @@ static void put_32(unsigned char *s, unsigned c, int e)
+
+ static unsigned legacy_map(const unsigned char *map, unsigned c)
+ {
+- unsigned x = c - 128 + map[-1];
++ unsigned x = c - 128 - map[-1];
+ x = legacy_chars[ map[x*5/4]>>2*x%8 |
+ map[x*5/4+1]<<8-2*x%8 & 1023 ];
+ return x ? x : c;
+--
+2.13.0
+
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index a2d82e75f6..6317ea7657 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.16
-pkgrel=12
+pkgrel=13
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -58,6 +58,14 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
0039-fix-iconv-conversions-to-legacy-8bit-encodings.patch
0040-fix-fchown-fallback-on-arches-without-chown-2.patch
0041-towupper-towlower-fast-path-for-ascii-chars.patch
+ 0042-fix-glob-failure-to-match-plain-to-root-directory.patch
+ 0043-catopen-set-errno-to-EOPNOTSUPP.patch
+ 0044-getdate-correctly-specify-error-number.patch
+ 0045-handle-mremap-failure-in-realloc-of-mmap-serviced-al.patch
+ 0046-handle-localtime-errors-in-ctime.patch
+ 0047-set-errno-when-getpw-_r-getgr-_r-and-getspnam_r-fail.patch
+ 0048-handle-errors-from-localtime_r-in-ctime_r.patch
+ 0049-fix-iconv-conversions-for-iso88592-iso885916.patch
1000-implement-strftime-GNU-extension-padding-specifiers-.patch
ldconfig
@@ -223,6 +231,14 @@ be15b749bec54ef342afa252d7fe46a644d2fcb77336719e57db613036d5f65531a03b17c9c5f92a
0f0cea53dba8a9ecbd493ce94fe17a22f814f3a35dbbb0a40749b926f78f5cec29d39d2dd3e803a9006e7a2b52f93917d6b19230457932c2681e4c395d752715 0039-fix-iconv-conversions-to-legacy-8bit-encodings.patch
9c71b7382cfe7a4480671b4e3bc18db79e68935ae271f0b6d43cd46d0ae87b059322592a0ca96f9e95779c57953708f1891e588e1b17d4b73f286a2d45ee1fd4 0040-fix-fchown-fallback-on-arches-without-chown-2.patch
11bde485e070cdbca2f7c1a441152f608dad1273fb8a3c3206e02e81308806e9bb9ff5a50e50a00486d4d69c65d9eda6b9a1ad4897e828241b8c07acaaf869ea 0041-towupper-towlower-fast-path-for-ascii-chars.patch
+d0e11ff77cfbe1473ae90497180fa6c8972a8acdaafdb732ce42da5762cf0f4ed5fd9a60b0bb19009ca27b5d301257ef5ad6af0a6af487a2dfea57ea881321dd 0042-fix-glob-failure-to-match-plain-to-root-directory.patch
+8719e563b48458bcadfa7e8ffad1e6ad808d99af837437ea055d4a7d684742e0e2ff6b730fe4bf63efc81a0802952cfe53394578188b6bf9fc63c5bfa20db83e 0043-catopen-set-errno-to-EOPNOTSUPP.patch
+343d4177e8059461a1df93c6517fe6a4b3ad140653ff173458062714b512d58d45050e03087e375d986552ea825cbca1f77542fc934e35dc1c51d056268029f5 0044-getdate-correctly-specify-error-number.patch
+a8bc306ca7109f3e2a81fde2ef0d9468428551eb47a4b083c17c7659dac1bca126a8330ce3cc580db79e2eb89bbc299c16878ecf17988cdc9f72ff489d2f415d 0045-handle-mremap-failure-in-realloc-of-mmap-serviced-al.patch
+c6c97ccc7b5a88a6e32ab8bb0cd35ae4689c144fd8b0f40e880061d374e5a71365066f89263d181affcd83613e2d92602a6adbf3ab2893c4dc88f667320a1f26 0046-handle-localtime-errors-in-ctime.patch
+b3e00f1d83314736d2c7b4bee59bc1055fdbc2bb4ce75b62a293c99abeb372afc1c5e73c4d878bf1d865964daf93e2e413890c60e0be6c72982c257d067c4b73 0047-set-errno-when-getpw-_r-getgr-_r-and-getspnam_r-fail.patch
+fc2c08156e755a9e178ede1642673b1f1ba06be467ff607fc3f9ea9052ddb2fa8d0ff425fd764aa7f4fc9bbd6ae0db86ad95c128e4f0da0a901980b449efa659 0048-handle-errors-from-localtime_r-in-ctime_r.patch
+053f5a09494dc117ae83ff801241fa71f1401303c53587bb01c2e7367a8149912c74dbe52373fc19f82eef9df41091e33faab5728598f99d7c9bb655701e331c 0049-fix-iconv-conversions-for-iso88592-iso885916.patch
7e4c703e57a3564cd3ee1d5334b806cbe654355179ba55d4d25361dfc555eb4a7d081d80d64fdaff8476949afd04558d278b124d1fb108080beaa5ba2f8ce2b9 1000-implement-strftime-GNU-extension-padding-specifiers-.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c