aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2017-06-01 13:29:51 +0300
committerTimo Teräs <timo.teras@iki.fi>2017-06-01 13:31:29 +0300
commitf6baa2aad98a418cd21b857f825e772a987b7c93 (patch)
tree510f68566eabbb6c8960020099b454ee5819bd18 /main/musl
parentacf34d0e48d8c8999406c748bfcf68c1ba61ddae (diff)
downloadaports-f6baa2aad98a418cd21b857f825e772a987b7c93.tar.bz2
aports-f6baa2aad98a418cd21b857f825e772a987b7c93.tar.xz
main/musl: cherry-pick upstream fixes, add strftime gnu extensions
ref #5907
Diffstat (limited to 'main/musl')
-rw-r--r--main/musl/0033-fix-scalbn-when-result-is-in-the-subnormal-range.patch89
-rw-r--r--main/musl/0034-fix-regression-in-support-for-resolv.conf-attempts-o.patch32
-rw-r--r--main/musl/0035-make-ttyname-_r-return-ENODEV-rather-than-ENOENT.patch35
-rw-r--r--main/musl/0036-implement-new-posix_spawn-flag-POSIX_SPAWN_SETSID.patch44
-rw-r--r--main/musl/0037-add-no-op-POSIX_SPAWN_USEVFORK-to-spawn.h.patch27
-rw-r--r--main/musl/0038-have-posix_spawnattr_setflags-check-for-supported-fl.patch44
-rw-r--r--main/musl/0039-fix-iconv-conversions-to-legacy-8bit-encodings.patch71
-rw-r--r--main/musl/0040-fix-fchown-fallback-on-arches-without-chown-2.patch28
-rw-r--r--main/musl/0041-towupper-towlower-fast-path-for-ascii-chars.patch46
-rw-r--r--main/musl/1000-implement-strftime-GNU-extension-padding-specifiers-.patch113
-rw-r--r--main/musl/APKBUILD22
11 files changed, 550 insertions, 1 deletions
diff --git a/main/musl/0033-fix-scalbn-when-result-is-in-the-subnormal-range.patch b/main/musl/0033-fix-scalbn-when-result-is-in-the-subnormal-range.patch
new file mode 100644
index 0000000000..a29a18efe5
--- /dev/null
+++ b/main/musl/0033-fix-scalbn-when-result-is-in-the-subnormal-range.patch
@@ -0,0 +1,89 @@
+From 8c44a060243f04283ca68dad199aab90336141db Mon Sep 17 00:00:00 2001
+From: Szabolcs Nagy <nsz@port70.net>
+Date: Mon, 3 Apr 2017 02:38:13 +0200
+Subject: [PATCH] fix scalbn when result is in the subnormal range
+
+in nearest rounding mode scalbn could introduce double rounding error
+when an intermediate value and the final result were both in the
+subnormal range e.g.
+
+ scalbn(0x1.7ffffffffffffp-1, -1073)
+
+returned 0x1p-1073 instead of 0x1p-1074, because the intermediate
+computation got rounded to 0x1.8p-1023.
+
+with the fix an intermediate value can only be in the subnormal range
+if the final result is 0 which is correct even after double rounding.
+(there still can be two roundings so signals may be raised twice, but
+that's only observable with trapping exceptions which is not supported.)
+---
+ src/math/scalbn.c | 10 ++++++----
+ src/math/scalbnf.c | 8 ++++----
+ src/math/scalbnl.c | 8 ++++----
+ 3 files changed, 14 insertions(+), 12 deletions(-)
+
+diff --git a/src/math/scalbn.c b/src/math/scalbn.c
+index 530e07c7..182f5610 100644
+--- a/src/math/scalbn.c
++++ b/src/math/scalbn.c
+@@ -16,11 +16,13 @@ double scalbn(double x, int n)
+ n = 1023;
+ }
+ } else if (n < -1022) {
+- y *= 0x1p-1022;
+- n += 1022;
++ /* make sure final n < -53 to avoid double
++ rounding in the subnormal range */
++ y *= 0x1p-1022 * 0x1p53;
++ n += 1022 - 53;
+ if (n < -1022) {
+- y *= 0x1p-1022;
+- n += 1022;
++ y *= 0x1p-1022 * 0x1p53;
++ n += 1022 - 53;
+ if (n < -1022)
+ n = -1022;
+ }
+diff --git a/src/math/scalbnf.c b/src/math/scalbnf.c
+index 0b62c3c7..a5ad208b 100644
+--- a/src/math/scalbnf.c
++++ b/src/math/scalbnf.c
+@@ -16,11 +16,11 @@ float scalbnf(float x, int n)
+ n = 127;
+ }
+ } else if (n < -126) {
+- y *= 0x1p-126f;
+- n += 126;
++ y *= 0x1p-126f * 0x1p24f;
++ n += 126 - 24;
+ if (n < -126) {
+- y *= 0x1p-126f;
+- n += 126;
++ y *= 0x1p-126f * 0x1p24f;
++ n += 126 - 24;
+ if (n < -126)
+ n = -126;
+ }
+diff --git a/src/math/scalbnl.c b/src/math/scalbnl.c
+index 08a4c587..db44dab0 100644
+--- a/src/math/scalbnl.c
++++ b/src/math/scalbnl.c
+@@ -20,11 +20,11 @@ long double scalbnl(long double x, int n)
+ n = 16383;
+ }
+ } else if (n < -16382) {
+- x *= 0x1p-16382L;
+- n += 16382;
++ x *= 0x1p-16382L * 0x1p113L;
++ n += 16382 - 113;
+ if (n < -16382) {
+- x *= 0x1p-16382L;
+- n += 16382;
++ x *= 0x1p-16382L * 0x1p113L;
++ n += 16382 - 113;
+ if (n < -16382)
+ n = -16382;
+ }
+--
+2.13.0
+
diff --git a/main/musl/0034-fix-regression-in-support-for-resolv.conf-attempts-o.patch b/main/musl/0034-fix-regression-in-support-for-resolv.conf-attempts-o.patch
new file mode 100644
index 0000000000..fdd9c028ce
--- /dev/null
+++ b/main/musl/0034-fix-regression-in-support-for-resolv.conf-attempts-o.patch
@@ -0,0 +1,32 @@
+From 1a7fa5e5211a67e89861583516ee1566609467a1 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Fri, 21 Apr 2017 17:34:26 -0400
+Subject: [PATCH] fix regression in support for resolv.conf attempts option
+
+commit d6cb08bcaca4ff1f921375510ca72bccea969c75 moved the code and
+introduced an incorrect string offset for the new parsing, probably
+due to a copy-and-paste error.
+
+patch by Stefan Sedich.
+---
+ src/network/resolvconf.c | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/src/network/resolvconf.c b/src/network/resolvconf.c
+index 2cf1f475..4c3e4c4b 100644
+--- a/src/network/resolvconf.c
++++ b/src/network/resolvconf.c
+@@ -45,8 +45,8 @@ int __get_resolv_conf(struct resolvconf *conf, char *search, size_t search_sz)
+ if (z != p) conf->ndots = x > 15 ? 15 : x;
+ }
+ p = strstr(line, "attempts:");
+- if (p && isdigit(p[6])) {
+- p += 6;
++ if (p && isdigit(p[9])) {
++ p += 9;
+ unsigned long x = strtoul(p, &z, 10);
+ if (z != p) conf->attempts = x > 10 ? 10 : x;
+ }
+--
+2.13.0
+
diff --git a/main/musl/0035-make-ttyname-_r-return-ENODEV-rather-than-ENOENT.patch b/main/musl/0035-make-ttyname-_r-return-ENODEV-rather-than-ENOENT.patch
new file mode 100644
index 0000000000..c6fed3afd4
--- /dev/null
+++ b/main/musl/0035-make-ttyname-_r-return-ENODEV-rather-than-ENOENT.patch
@@ -0,0 +1,35 @@
+From e1232f5b5185e8f337806841018369407e32e77d Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Fri, 21 Apr 2017 17:41:10 -0400
+Subject: [PATCH] make ttyname[_r] return ENODEV rather than ENOENT
+
+commit 0a950dcf15bb9f7274c804dca490e9e20e475f3e added checking that
+the pathname a tty device was opened with actually matches the device,
+which can fail to hold when a container inherits a tty from outside
+the container. the error code added at the time was ENOENT; however,
+discussions between affected applications and glibc developers
+resulted in glibc adopting ENODEV as the error for this condition, and
+this has now been documented in the man pages project as well. adopt
+the same error code for consistency.
+
+patch by Christian Brauner.
+---
+ src/unistd/ttyname_r.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/unistd/ttyname_r.c b/src/unistd/ttyname_r.c
+index a38ba4f2..33aa4ae1 100644
+--- a/src/unistd/ttyname_r.c
++++ b/src/unistd/ttyname_r.c
+@@ -23,7 +23,7 @@ int ttyname_r(int fd, char *name, size_t size)
+ if (stat(name, &st1) || fstat(fd, &st2))
+ return errno;
+ if (st1.st_dev != st2.st_dev || st1.st_ino != st2.st_ino)
+- return ENOENT;
++ return ENODEV;
+
+ return 0;
+ }
+--
+2.13.0
+
diff --git a/main/musl/0036-implement-new-posix_spawn-flag-POSIX_SPAWN_SETSID.patch b/main/musl/0036-implement-new-posix_spawn-flag-POSIX_SPAWN_SETSID.patch
new file mode 100644
index 0000000000..4e39d63697
--- /dev/null
+++ b/main/musl/0036-implement-new-posix_spawn-flag-POSIX_SPAWN_SETSID.patch
@@ -0,0 +1,44 @@
+From bb439bb17108b67f3df9c9af824d3a607b5b059d Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Sat, 22 Apr 2017 18:39:40 -0400
+Subject: [PATCH] implement new posix_spawn flag POSIX_SPAWN_SETSID
+
+this functionality has been adopted for inclusion in the next issue of
+POSIX as the result of Austin Group issue #1044.
+
+based on patch by Daurnimator.
+---
+ include/spawn.h | 1 +
+ src/process/posix_spawn.c | 4 ++++
+ 2 files changed, 5 insertions(+)
+
+diff --git a/include/spawn.h b/include/spawn.h
+index 29c799ee..f3e9e23c 100644
+--- a/include/spawn.h
++++ b/include/spawn.h
+@@ -21,6 +21,7 @@ struct sched_param;
+ #define POSIX_SPAWN_SETSIGMASK 8
+ #define POSIX_SPAWN_SETSCHEDPARAM 16
+ #define POSIX_SPAWN_SETSCHEDULER 32
++#define POSIX_SPAWN_SETSID 128
+
+ typedef struct {
+ int __flags;
+diff --git a/src/process/posix_spawn.c b/src/process/posix_spawn.c
+index 0bdf71cd..ea5d2998 100644
+--- a/src/process/posix_spawn.c
++++ b/src/process/posix_spawn.c
+@@ -73,6 +73,10 @@ static int child(void *args_vp)
+ __libc_sigaction(i, &sa, 0);
+ }
+
++ if (attr->__flags & POSIX_SPAWN_SETSID)
++ if ((ret=__syscall(SYS_setsid)) < 0)
++ goto fail;
++
+ if (attr->__flags & POSIX_SPAWN_SETPGROUP)
+ if ((ret=__syscall(SYS_setpgid, 0, attr->__pgrp)))
+ goto fail;
+--
+2.13.0
+
diff --git a/main/musl/0037-add-no-op-POSIX_SPAWN_USEVFORK-to-spawn.h.patch b/main/musl/0037-add-no-op-POSIX_SPAWN_USEVFORK-to-spawn.h.patch
new file mode 100644
index 0000000000..735e919210
--- /dev/null
+++ b/main/musl/0037-add-no-op-POSIX_SPAWN_USEVFORK-to-spawn.h.patch
@@ -0,0 +1,27 @@
+From 77e895dcfadb156c9f378d26c9d0497ce2baf13f Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Sat, 22 Apr 2017 20:40:09 -0400
+Subject: [PATCH] add no-op POSIX_SPAWN_USEVFORK to spawn.h
+
+the bit is reserved anyway for ABI-compat reasons; this documents it
+and makes it so we can have posix_spawnattr_setflags check for flag
+validity without hard-coding an anonymous bit value.
+---
+ include/spawn.h | 1 +
+ 1 file changed, 1 insertion(+)
+
+diff --git a/include/spawn.h b/include/spawn.h
+index f3e9e23c..bba57ce4 100644
+--- a/include/spawn.h
++++ b/include/spawn.h
+@@ -21,6 +21,7 @@ struct sched_param;
+ #define POSIX_SPAWN_SETSIGMASK 8
+ #define POSIX_SPAWN_SETSCHEDPARAM 16
+ #define POSIX_SPAWN_SETSCHEDULER 32
++#define POSIX_SPAWN_USEVFORK 64
+ #define POSIX_SPAWN_SETSID 128
+
+ typedef struct {
+--
+2.13.0
+
diff --git a/main/musl/0038-have-posix_spawnattr_setflags-check-for-supported-fl.patch b/main/musl/0038-have-posix_spawnattr_setflags-check-for-supported-fl.patch
new file mode 100644
index 0000000000..3c2e944bbb
--- /dev/null
+++ b/main/musl/0038-have-posix_spawnattr_setflags-check-for-supported-fl.patch
@@ -0,0 +1,44 @@
+From f9f686b7721e2cc35e20fa5c6df6da2dc4ac3f50 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Sat, 22 Apr 2017 20:45:16 -0400
+Subject: [PATCH] have posix_spawnattr_setflags check for supported flags
+
+per POSIX, EINVAL is not a mandatory error, only an optional one. but
+reporting unsupported flags allows an application to fallback
+gracefully when a requested feature is not supported. this is not
+helpful now, but it may be in the future if additional flags are
+added.
+
+had this checking been present before, applications would have been
+able to check for the newly-added POSIX_SPAWN_SETSID feature (added in
+commit bb439bb17108b67f3df9c9af824d3a607b5b059d) at runtime.
+---
+ src/process/posix_spawnattr_setflags.c | 11 +++++++++++
+ 1 file changed, 11 insertions(+)
+
+diff --git a/src/process/posix_spawnattr_setflags.c b/src/process/posix_spawnattr_setflags.c
+index f750c040..68780992 100644
+--- a/src/process/posix_spawnattr_setflags.c
++++ b/src/process/posix_spawnattr_setflags.c
+@@ -1,7 +1,18 @@
+ #include <spawn.h>
++#include <errno.h>
+
+ int posix_spawnattr_setflags(posix_spawnattr_t *attr, short flags)
+ {
++ const unsigned all_flags =
++ POSIX_SPAWN_RESETIDS |
++ POSIX_SPAWN_SETPGROUP |
++ POSIX_SPAWN_SETSIGDEF |
++ POSIX_SPAWN_SETSIGMASK |
++ POSIX_SPAWN_SETSCHEDPARAM |
++ POSIX_SPAWN_SETSCHEDULER |
++ POSIX_SPAWN_USEVFORK |
++ POSIX_SPAWN_SETSID;
++ if (flags & ~all_flags) return EINVAL;
+ attr->__flags = flags;
+ return 0;
+ }
+--
+2.13.0
+
diff --git a/main/musl/0039-fix-iconv-conversions-to-legacy-8bit-encodings.patch b/main/musl/0039-fix-iconv-conversions-to-legacy-8bit-encodings.patch
new file mode 100644
index 0000000000..be89291505
--- /dev/null
+++ b/main/musl/0039-fix-iconv-conversions-to-legacy-8bit-encodings.patch
@@ -0,0 +1,71 @@
+From 97bd6b09dbe7478d5a90a06ecd9e5b59389d8eb9 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Sat, 27 May 2017 21:36:00 -0400
+Subject: [PATCH] fix iconv conversions to legacy 8bit encodings
+
+there was missing reverse-conversion logic for the case, handled
+specially in the character set tables, where a byte represents a
+unicode codepoint with the same value.
+
+this patch adds code to handle the case, and refactors the two-level
+10-bit table lookup for legacy character sets into a function to avoid
+repeating it yet another time as part of the fix.
+---
+ src/locale/iconv.c | 21 ++++++++++++---------
+ 1 file changed, 12 insertions(+), 9 deletions(-)
+
+diff --git a/src/locale/iconv.c b/src/locale/iconv.c
+index 1eeea94e..4636307f 100644
+--- a/src/locale/iconv.c
++++ b/src/locale/iconv.c
+@@ -151,6 +151,14 @@ static void put_32(unsigned char *s, unsigned c, int e)
+ #define mbrtowc_utf8 mbrtowc
+ #define wctomb_utf8 wctomb
+
++static unsigned legacy_map(const unsigned char *map, unsigned c)
++{
++ 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;
++}
++
+ size_t iconv(iconv_t cd0, char **restrict in, size_t *restrict inb, char **restrict out, size_t *restrict outb)
+ {
+ size_t x=0;
+@@ -364,10 +372,7 @@ size_t iconv(iconv_t cd0, char **restrict in, size_t *restrict inb, char **restr
+ break;
+ default:
+ if (c < 128+type) break;
+- c -= 128+type;
+- c = legacy_chars[ map[c*5/4]>>2*c%8 |
+- map[c*5/4+1]<<8-2*c%8 & 1023 ];
+- if (!c) c = *(unsigned char *)*in;
++ c = legacy_map(map, c);
+ if (c==1) goto ilseq;
+ }
+
+@@ -392,17 +397,15 @@ size_t iconv(iconv_t cd0, char **restrict in, size_t *restrict inb, char **restr
+ if (c > 0x7f) subst: x++, c='*';
+ default:
+ if (*outb < 1) goto toobig;
+- if (c < 128+totype) {
++ if (c < 128+totype || (c<256 && c==legacy_map(tomap, c))) {
+ revout:
+ *(*out)++ = c;
+ *outb -= 1;
+ break;
+ }
+ d = c;
+- for (c=0; c<128-totype; c++) {
+- if (d == legacy_chars[ tomap[c*5/4]>>2*c%8 |
+- tomap[c*5/4+1]<<8-2*c%8 & 1023 ]) {
+- c += 128;
++ for (c=128+totype; c<256; c++) {
++ if (d == legacy_map(tomap, c)) {
+ goto revout;
+ }
+ }
+--
+2.13.0
+
diff --git a/main/musl/0040-fix-fchown-fallback-on-arches-without-chown-2.patch b/main/musl/0040-fix-fchown-fallback-on-arches-without-chown-2.patch
new file mode 100644
index 0000000000..bfe3a93ed9
--- /dev/null
+++ b/main/musl/0040-fix-fchown-fallback-on-arches-without-chown-2.patch
@@ -0,0 +1,28 @@
+From 81f4a1200a58a84c83e73da645d4f226a8785bdf Mon Sep 17 00:00:00 2001
+From: Samuel Holland <samuel@sholland.org>
+Date: Sat, 27 May 2017 15:20:01 -0500
+Subject: [PATCH] fix fchown fallback on arches without chown(2)
+
+The flags argument was missing, causing uninitalized data to be passed
+to fchownat(2). The correct value of flags should match the fallback for
+chown(3).
+---
+ src/unistd/fchown.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/unistd/fchown.c b/src/unistd/fchown.c
+index 03459849..75075eec 100644
+--- a/src/unistd/fchown.c
++++ b/src/unistd/fchown.c
+@@ -16,7 +16,7 @@ int fchown(int fd, uid_t uid, gid_t gid)
+ #ifdef SYS_chown
+ return syscall(SYS_chown, buf, uid, gid);
+ #else
+- return syscall(SYS_fchownat, AT_FDCWD, buf, uid, gid);
++ return syscall(SYS_fchownat, AT_FDCWD, buf, uid, gid, 0);
+ #endif
+
+ }
+--
+2.13.0
+
diff --git a/main/musl/0041-towupper-towlower-fast-path-for-ascii-chars.patch b/main/musl/0041-towupper-towlower-fast-path-for-ascii-chars.patch
new file mode 100644
index 0000000000..5a45eb39eb
--- /dev/null
+++ b/main/musl/0041-towupper-towlower-fast-path-for-ascii-chars.patch
@@ -0,0 +1,46 @@
+From 179766aa2ef06df854bc1d9616bf6f00ce49b7f9 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Tue, 30 May 2017 14:23:24 +0200
+Subject: [PATCH] towupper/towlower: fast path for ascii chars
+
+Make a fast path for ascii chars which is assumed to be the most common
+case. This has significant performance benefit on xml json and similar
+---
+ src/ctype/towctrans.c | 6 +++---
+ 1 file changed, 3 insertions(+), 3 deletions(-)
+
+diff --git a/src/ctype/towctrans.c b/src/ctype/towctrans.c
+index 6af61875..cf13a862 100644
+--- a/src/ctype/towctrans.c
++++ b/src/ctype/towctrans.c
+@@ -1,3 +1,4 @@
++#include <ctype.h>
+ #include <wctype.h>
+ #include "libc.h"
+
+@@ -9,7 +10,6 @@ static const struct {
+ signed char lower;
+ unsigned char len;
+ } casemaps[] = {
+- CASEMAP('A','Z','a'),
+ CASEMAP(0xc0,0xde,0xe0),
+
+ CASELACE(0x0100,0x012e),
+@@ -257,12 +257,12 @@ static wchar_t __towcase(wchar_t wc, int lower)
+
+ wint_t towupper(wint_t wc)
+ {
+- return __towcase(wc, 0);
++ return (unsigned)wc < 128 ? toupper(wc) : __towcase(wc, 0);
+ }
+
+ wint_t towlower(wint_t wc)
+ {
+- return __towcase(wc, 1);
++ return (unsigned)wc < 128 ? tolower(wc) : __towcase(wc, 1);
+ }
+
+ wint_t __towupper_l(wint_t c, locale_t l)
+--
+2.13.0
+
diff --git a/main/musl/1000-implement-strftime-GNU-extension-padding-specifiers-.patch b/main/musl/1000-implement-strftime-GNU-extension-padding-specifiers-.patch
new file mode 100644
index 0000000000..d943d5bef5
--- /dev/null
+++ b/main/musl/1000-implement-strftime-GNU-extension-padding-specifiers-.patch
@@ -0,0 +1,113 @@
+From 07285bbc354fa2882b01b01ccec439f3a986e966 Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi>
+Date: Tue, 22 Nov 2016 09:17:46 +0200
+Subject: [PATCH] implement strftime GNU extension padding specifiers '_', '-'
+ and '0'
+
+---
+ src/time/strftime.c | 31 +++++++++++++++++++++----------
+ 1 file changed, 21 insertions(+), 10 deletions(-)
+
+diff --git a/src/time/strftime.c b/src/time/strftime.c
+index a3039204..733e4e28 100644
+--- a/src/time/strftime.c
++++ b/src/time/strftime.c
+@@ -46,9 +46,9 @@ static int week_num(const struct tm *tm)
+ }
+
+ const char *__tm_to_tzname(const struct tm *);
+-size_t __strftime_l(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t);
++static size_t __strftime_impl(char *restrict, size_t, const char *restrict, const struct tm *restrict, locale_t, int);
+
+-const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc)
++const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *tm, locale_t loc, int pad)
+ {
+ nl_item item;
+ long long val;
+@@ -79,15 +79,14 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
+ case 'C':
+ val = (1900LL+tm->tm_year) / 100;
+ goto number;
++ case 'e':
++ pad = '_';
+ case 'd':
+ val = tm->tm_mday;
+ goto number;
+ case 'D':
+ fmt = "%m/%d/%y";
+ goto recu_strftime;
+- case 'e':
+- *l = snprintf(*s, sizeof *s, "%2d", tm->tm_mday);
+- return *s;
+ case 'F':
+ fmt = "%Y-%m-%d";
+ goto recu_strftime;
+@@ -200,7 +199,12 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
+ return 0;
+ }
+ number:
+- *l = snprintf(*s, sizeof *s, "%0*lld", width, val);
++ switch (pad) {
++ case '-': *l = snprintf(*s, sizeof *s, "%lld", val); break;
++ case '_': *l = snprintf(*s, sizeof *s, "%*lld", width, val); break;
++ case '0':
++ default: *l = snprintf(*s, sizeof *s, "%0*lld", width, val); break;
++ }
+ return *s;
+ nl_strcat:
+ fmt = __nl_langinfo_l(item, loc);
+@@ -210,18 +214,18 @@ string:
+ nl_strftime:
+ fmt = __nl_langinfo_l(item, loc);
+ recu_strftime:
+- *l = __strftime_l(*s, sizeof *s, fmt, tm, loc);
++ *l = __strftime_impl(*s, sizeof *s, fmt, tm, loc, pad);
+ if (!*l) return 0;
+ return *s;
+ }
+
+-size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm, locale_t loc)
++static size_t __strftime_impl(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm, locale_t loc, int def_pad)
+ {
+ size_t l, k;
+ char buf[100];
+ char *p;
+ const char *t;
+- int plus;
++ int plus, pad;
+ unsigned long width;
+ for (l=0; l<n; f++) {
+ if (!*f) {
+@@ -233,6 +237,8 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
+ continue;
+ }
+ f++;
++ pad = def_pad;
++ if (*f == '-' || *f == '_' || *f == '0') pad = *f++;
+ if ((plus = (*f == '+'))) f++;
+ width = strtoul(f, &p, 10);
+ if (*p == 'C' || *p == 'F' || *p == 'G' || *p == 'Y') {
+@@ -242,7 +248,7 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
+ }
+ f = p;
+ if (*f == 'E' || *f == 'O') f++;
+- t = __strftime_fmt_1(&buf, &k, *f, tm, loc);
++ t = __strftime_fmt_1(&buf, &k, *f, tm, loc, pad);
+ if (!t) break;
+ if (width) {
+ for (; *t=='+' || *t=='-' || (*t=='0'&&t[1]); t++, k--);
+@@ -267,6 +273,11 @@ size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const st
+ return 0;
+ }
+
++size_t __strftime_l(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm, locale_t loc)
++{
++ return __strftime_impl(s, n, f, tm, loc, '0');
++}
++
+ size_t strftime(char *restrict s, size_t n, const char *restrict f, const struct tm *restrict tm)
+ {
+ return __strftime_l(s, n, f, tm, CURRENT_LOCALE);
+--
+2.13.0
+
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index ee790a95f1..8152a95d46 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=9
+pkgrel=10
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -49,6 +49,16 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
0030-fix-dlopen-dlsym-regression-opening-libs-already-loa.patch
0031-s390x-provide-a-working-sigcontext-struct-definition.patch
0032-fix-support-for-dl_iterate_phdr-in-static-pie-binaries.patch
+ 0033-fix-scalbn-when-result-is-in-the-subnormal-range.patch
+ 0034-fix-regression-in-support-for-resolv.conf-attempts-o.patch
+ 0035-make-ttyname-_r-return-ENODEV-rather-than-ENOENT.patch
+ 0036-implement-new-posix_spawn-flag-POSIX_SPAWN_SETSID.patch
+ 0037-add-no-op-POSIX_SPAWN_USEVFORK-to-spawn.h.patch
+ 0038-have-posix_spawnattr_setflags-check-for-supported-fl.patch
+ 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
+ 1000-implement-strftime-GNU-extension-padding-specifiers-.patch
ldconfig
__stack_chk_fail_local.c
@@ -201,6 +211,16 @@ dad1ed979898ddaa0a49c601160a948ba229b251307210a14240e4ebf6230b16ffc0138f396fc226
adcb5b213ebd9fc5d50cc46d4444ed64a4f928a6b4767428d7d720c6a563ba1d4a3173d6546b41379356b155a26eaad652d7b831776cc3f31e942f155db9239d 0030-fix-dlopen-dlsym-regression-opening-libs-already-loa.patch
5601b5b56b0b2f4703ec4eb628f7eef78a130afc26979fb3d29c459cb168c62c13c3698a779ad7bbea8fb78d5f7cc02d465185a24bf9a06f6764a01fbd41dc04 0031-s390x-provide-a-working-sigcontext-struct-definition.patch
690daa7f4c7ba0d24e103299406226849ad1314e2f3ea32cc571a6cdf0bac097b24fa3efa228b03ea495d9d437c9dd90eebe7b0268f94b7e19861100f84fa66e 0032-fix-support-for-dl_iterate_phdr-in-static-pie-binaries.patch
+324a933364e20f9ceb390bc6e8a1f5486fb44db5b83147a701be52be8f87b98155810ea2e8b13c433dfc8c326c0ef930f83f434fa61b7103cb055c34c34d1c3f 0033-fix-scalbn-when-result-is-in-the-subnormal-range.patch
+db79ea5c8f6ffa1d60a99320370814fda4c42a20b7e18fee73f27ad76d26ef0380b033c116d7beec7c5f7b061f04fd9f776048d8cebd7381f07bf6ecc3cbc62d 0034-fix-regression-in-support-for-resolv.conf-attempts-o.patch
+af9c68842ae13588a2fbbae0c32a39e34d21fb21fe360457f0964b89dfc845f7579c3b2e50c9a59e816d72388c50702eeb35b8acf70b36664be7abcb8c77b606 0035-make-ttyname-_r-return-ENODEV-rather-than-ENOENT.patch
+e20524ef4acea8c6c0be53dfa65c8d40054637cc5e475b80d81949fc24609714eaba302957a4d6d8c29e0c77153b7631969349f59716fd2eb1144136ae244b6b 0036-implement-new-posix_spawn-flag-POSIX_SPAWN_SETSID.patch
+4fee74a7e7a16fed6e5c3e4d2cee79e0720d8db616b7571318c2ebfa622339724543bc02221a50324521c67845db3f74cbe2c3800efdcab15ed54fbf8bcdeae6 0037-add-no-op-POSIX_SPAWN_USEVFORK-to-spawn.h.patch
+be15b749bec54ef342afa252d7fe46a644d2fcb77336719e57db613036d5f65531a03b17c9c5f92abcffebe45df4116b0adc477cc11533e656ee0fc82908cd76 0038-have-posix_spawnattr_setflags-check-for-supported-fl.patch
+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
+7e4c703e57a3564cd3ee1d5334b806cbe654355179ba55d4d25361dfc555eb4a7d081d80d64fdaff8476949afd04558d278b124d1fb108080beaa5ba2f8ce2b9 1000-implement-strftime-GNU-extension-padding-specifiers-.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c