diff options
author | Timo Teräs <timo.teras@iki.fi> | 2014-08-01 09:18:05 +0300 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2014-08-01 09:18:05 +0300 |
commit | 8fc70ddb18663e5e3d0393f59257a0e80127c35e (patch) | |
tree | 5120c241d31ea5fbcea1771ad9dc6e18e4e3024c | |
parent | 5e94e0490d937bfafbdfd40ae17fd9c36f5c6a8a (diff) | |
download | aports-8fc70ddb18663e5e3d0393f59257a0e80127c35e.tar.bz2 aports-8fc70ddb18663e5e3d0393f59257a0e80127c35e.tar.xz |
main/musl: upgrade to 1.1.4
11 files changed, 11 insertions, 1124 deletions
diff --git a/main/musl/0001-fix-regression-in-dynamic-linker-error-reporting.patch b/main/musl/0001-fix-regression-in-dynamic-linker-error-reporting.patch deleted file mode 100644 index ef3a6a0be..000000000 --- a/main/musl/0001-fix-regression-in-dynamic-linker-error-reporting.patch +++ /dev/null @@ -1,68 +0,0 @@ -From 9a4ad02214a859e93d2c980e4535378a6a74e3a6 Mon Sep 17 00:00:00 2001 -From: Rich Felker <dalias@aerifal.cx> -Date: Sun, 29 Jun 2014 21:52:54 -0400 -Subject: [PATCH] fix regression in dynamic linker error reporting - -due to a mistake when refactoring the error printing for the dynamic -linker (commit 7c73cacd09a51a87484db5689864743e4984a84d), all messages -were suppressed and replaced by blank lines. ---- - src/ldso/dynlink.c | 14 +++++--------- - 1 file changed, 5 insertions(+), 9 deletions(-) - -diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c -index bc4f2f6..a08300d 100644 ---- a/src/ldso/dynlink.c -+++ b/src/ldso/dynlink.c -@@ -290,8 +290,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri - if (!astype) continue; - type = remap_rel(astype); - if (!type) { -- error(errbuf, sizeof errbuf, -- "Error relocating %s: unsupported relocation type %d", -+ error("Error relocating %s: unsupported relocation type %d", - dso->name, astype); - continue; - } -@@ -304,8 +303,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri - def = find_sym(ctx, name, type==REL_PLT); - if (!def.sym && (sym->st_shndx != SHN_UNDEF - || sym->st_info>>4 != STB_WEAK)) { -- error(errbuf, sizeof errbuf, -- "Error relocating %s: %s: symbol not found", -+ error("Error relocating %s: %s: symbol not found", - dso->name, name); - continue; - } -@@ -366,7 +364,7 @@ static void do_relocs(struct dso *dso, size_t *rel, size_t rel_size, size_t stri - if (stride<3) addend = reloc_addr[1]; - if (runtime && def.dso->tls_id >= static_tls_cnt) { - struct td_index *new = malloc(sizeof *new); -- if (!new) error(errbuf, sizeof errbuf, -+ if (!new) error( - "Error relocating %s: cannot allocate TLSDESC for %s", - dso->name, sym ? name : "(local)" ); - new->next = dso->td_index; -@@ -839,8 +837,7 @@ static void load_deps(struct dso *p) - if (p->dynv[i] != DT_NEEDED) continue; - dep = load_library(p->strings + p->dynv[i+1], p); - if (!dep) { -- error(errbuf, sizeof errbuf, -- "Error loading shared library %s: %m (needed by %s)", -+ error("Error loading shared library %s: %m (needed by %s)", - p->strings + p->dynv[i+1], p->name); - continue; - } -@@ -890,8 +887,7 @@ static void reloc_all(struct dso *p) - - if (p->relro_start != p->relro_end && - mprotect(p->base+p->relro_start, p->relro_end-p->relro_start, PROT_READ) < 0) { -- error(errbuf, sizeof errbuf, -- "Error relocating %s: RELRO protection failed: %m", -+ error("Error relocating %s: RELRO protection failed: %m", - p->name); - } - --- -2.0.1 - 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 deleted file mode 100644 index 8e2d8e6ff..000000000 --- a/main/musl/0002-fix-aliasing-violations-in-mbtowc-and-mbrtowc.patch +++ /dev/null @@ -1,58 +0,0 @@ -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 deleted file mode 100644 index 7e5087858..000000000 --- a/main/musl/0003-fix-incorrect-return-value-for-fwide-function.patch +++ /dev/null @@ -1,29 +0,0 @@ -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 deleted file mode 100644 index 54edaf8c3..000000000 --- a/main/musl/0004-fix-failure-of-wide-printf-scanf-functions-to-set-wi.patch +++ /dev/null @@ -1,42 +0,0 @@ -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 deleted file mode 100644 index 8f3a7dd12..000000000 --- a/main/musl/0005-fix-multiple-issues-in-legacy-function-getpass.patch +++ /dev/null @@ -1,61 +0,0 @@ -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/0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch b/main/musl/0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch deleted file mode 100644 index 032b3cbf6..000000000 --- a/main/musl/0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch +++ /dev/null @@ -1,28 +0,0 @@ -From 349381aa8c0fc385e54e1068dd5f2b27af55cd12 Mon Sep 17 00:00:00 2001 -From: Rich Felker <dalias@aerifal.cx> -Date: Fri, 11 Jul 2014 00:26:12 -0400 -Subject: [PATCH] make dynamic linker accept colon as a separator for - LD_PRELOAD - ---- - src/ldso/dynlink.c | 4 ++-- - 1 file changed, 2 insertions(+), 2 deletions(-) - -diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c -index 55124ff..6b7f0f3 100644 ---- a/src/ldso/dynlink.c -+++ b/src/ldso/dynlink.c -@@ -862,8 +862,8 @@ static void load_preload(char *s) - int tmp; - char *z; - for (z=s; *z; s=z) { -- for ( ; *s && isspace(*s); s++); -- for (z=s; *z && !isspace(*z); z++); -+ for ( ; *s && (isspace(*s) || *s==':'); s++); -+ for (z=s; *z && !isspace(*z) && *z!=':'; z++); - tmp = *z; - *z = 0; - load_library(s, 0); --- -2.0.2 - diff --git a/main/musl/0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch b/main/musl/0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch deleted file mode 100644 index fe6fe31da..000000000 --- a/main/musl/0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch +++ /dev/null @@ -1,35 +0,0 @@ -From 59549313d85fa9a0168ff8164cfe734255585f46 Mon Sep 17 00:00:00 2001 -From: Rich Felker <dalias@aerifal.cx> -Date: Fri, 11 Jul 2014 00:29:44 -0400 -Subject: [PATCH] explicitly reject empty names in dynamic linker load_library - function - -previously passing an empty string for name resulted in failure, as -expected, but only after spurious syscalls, and it produced confusing -errno values (and thus dlerror strings). - -in addition to dlopen calls, this issue affected use of LD_PRELOAD -with trailing whitespace or colon characters. ---- - src/ldso/dynlink.c | 5 +++++ - 1 file changed, 5 insertions(+) - -diff --git a/src/ldso/dynlink.c b/src/ldso/dynlink.c -index 6b7f0f3..12f14f7 100644 ---- a/src/ldso/dynlink.c -+++ b/src/ldso/dynlink.c -@@ -663,6 +663,11 @@ static struct dso *load_library(const char *name, struct dso *needed_by) - int n_th = 0; - int is_self = 0; - -+ if (!*name) { -+ errno = EINVAL; -+ return 0; -+ } -+ - /* Catch and block attempts to reload the implementation itself */ - if (name[0]=='l' && name[1]=='i' && name[2]=='b') { - static const char *rp, reserved[] = --- -2.0.2 - diff --git a/main/musl/0008-fix-the-m-specifier-in-syslog.patch b/main/musl/0008-fix-the-m-specifier-in-syslog.patch deleted file mode 100644 index acf44a9d0..000000000 --- a/main/musl/0008-fix-the-m-specifier-in-syslog.patch +++ /dev/null @@ -1,43 +0,0 @@ -From da27118157c2942d7652138b8d8b0056fc8f872f Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Cl=C3=A9ment=20Vasseur?= <clement.vasseur@gmail.com> -Date: Wed, 9 Jul 2014 14:34:18 +0200 -Subject: [PATCH] fix the %m specifier in syslog - -errno must be saved upon vsyslog entry, otherwise its value could be -changed by some libc function before reaching the %m handler in -vsnprintf. ---- - src/misc/syslog.c | 3 +++ - 1 file changed, 3 insertions(+) - -diff --git a/src/misc/syslog.c b/src/misc/syslog.c -index 1cd61ce..57f1d75 100644 ---- a/src/misc/syslog.c -+++ b/src/misc/syslog.c -@@ -7,6 +7,7 @@ - #include <signal.h> - #include <string.h> - #include <pthread.h> -+#include <errno.h> - #include "libc.h" - #include "atomic.h" - -@@ -76,6 +77,7 @@ static void _vsyslog(int priority, const char *message, va_list ap) - time_t now; - struct tm tm; - char buf[256]; -+ int errno_save = errno; - int pid; - int l, l2; - -@@ -93,6 +95,7 @@ static void _vsyslog(int priority, const char *message, va_list ap) - pid = (log_opt & LOG_PID) ? getpid() : 0; - l = snprintf(buf, sizeof buf, "<%d>%s %s%s%.0d%s: ", - priority, timebuf, log_ident, "["+!pid, pid, "]"+!pid); -+ errno = errno_save; - l2 = vsnprintf(buf+l, sizeof buf - l, message, ap); - if (l2 >= 0) { - if (l2 >= sizeof buf - l) l = sizeof buf - 1; --- -2.0.2 - diff --git a/main/musl/0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch b/main/musl/0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch deleted file mode 100644 index ffef918c0..000000000 --- a/main/musl/0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 72ed3d47e567b1635a35d3c1d174c8a8b2787e30 Mon Sep 17 00:00:00 2001 -From: Rich Felker <dalias@aerifal.cx> -Date: Thu, 17 Jul 2014 19:56:27 -0400 -Subject: [PATCH] fix crash in regexec for nonzero nmatch argument with - REG_NOSUB - -per POSIX, the nmatch and pmatch arguments are ignored when the regex -was compiled with REG_NOSUB. ---- - src/regex/regexec.c | 1 + - 1 file changed, 1 insertion(+) - -diff --git a/src/regex/regexec.c b/src/regex/regexec.c -index 855cef5..2e35b83 100644 ---- a/src/regex/regexec.c -+++ b/src/regex/regexec.c -@@ -983,6 +983,7 @@ regexec(const regex_t *restrict preg, const char *restrict string, - tre_tnfa_t *tnfa = (void *)preg->TRE_REGEX_T_FIELD; - reg_errcode_t status; - int *tags = NULL, eo; -+ if (tnfa->cflags & REG_NOSUB) nmatch = 0; - if (tnfa->num_tags > 0 && nmatch > 0) - { - tags = xmalloc(sizeof(*tags) * tnfa->num_tags); --- -2.0.2 - diff --git a/main/musl/1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch b/main/musl/1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch deleted file mode 100644 index 909b5b26c..000000000 --- a/main/musl/1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch +++ /dev/null @@ -1,684 +0,0 @@ -From 2ab2413e746a5b0e6996eeb7bc10739207b0b560 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> -Date: Tue, 8 Apr 2014 14:03:16 +0000 -Subject: [PATCH] reimplement if_nameindex and getifaddrs using netlink - ---- - src/network/__netlink.c | 52 ++++++++ - src/network/__netlink.h | 100 +++++++++++++++ - src/network/getifaddrs.c | 312 ++++++++++++++++++++++++--------------------- - src/network/if_nameindex.c | 130 +++++++++++++------ - 4 files changed, 409 insertions(+), 185 deletions(-) - create mode 100644 src/network/__netlink.c - create mode 100644 src/network/__netlink.h - -diff --git a/src/network/__netlink.c b/src/network/__netlink.c -new file mode 100644 -index 0000000..d02714c ---- /dev/null -+++ b/src/network/__netlink.c -@@ -0,0 +1,52 @@ -+#include <errno.h> -+#include <string.h> -+#include <syscall.h> -+#include <sys/socket.h> -+#include "__netlink.h" -+ -+static int __netlink_enumerate(int fd, unsigned int seq, int type, int af, -+ int (*cb)(void *ctx, struct nlmsghdr *h), void *ctx) -+{ -+ struct nlmsghdr *h; -+ union { -+ uint8_t buf[8192]; -+ struct { -+ struct nlmsghdr nlh; -+ struct rtgenmsg g; -+ } req; -+ struct nlmsghdr reply; -+ } u; -+ int r, ret; -+ -+ memset(&u.req, 0, sizeof(u.req)); -+ u.req.nlh.nlmsg_len = sizeof(u.req); -+ u.req.nlh.nlmsg_type = type; -+ u.req.nlh.nlmsg_flags = NLM_F_DUMP | NLM_F_REQUEST; -+ u.req.nlh.nlmsg_seq = seq; -+ u.req.g.rtgen_family = af; -+ r = send(fd, &u.req, sizeof(u.req), 0); -+ if (r < 0) return r; -+ -+ while (1) { -+ r = recv(fd, u.buf, sizeof(u.buf), MSG_DONTWAIT); -+ if (r <= 0) return -1; -+ for (h = &u.reply; NLMSG_OK(h, (void*)&u.buf[r]); h = NLMSG_NEXT(h)) { -+ if (h->nlmsg_type == NLMSG_DONE) return 0; -+ if (h->nlmsg_type == NLMSG_ERROR) return -1; -+ ret = cb(ctx, h); -+ if (ret) return ret; -+ } -+ } -+} -+ -+int __rtnetlink_enumerate(int link_af, int addr_af, int (*cb)(void *ctx, struct nlmsghdr *h), void *ctx) -+{ -+ int fd, r; -+ -+ fd = socket(PF_NETLINK, SOCK_RAW|SOCK_CLOEXEC, NETLINK_ROUTE); -+ if (fd < 0) return -1; -+ r = __netlink_enumerate(fd, 1, RTM_GETLINK, link_af, cb, ctx); -+ if (!r) r = __netlink_enumerate(fd, 2, RTM_GETADDR, addr_af, cb, ctx); -+ __syscall(SYS_close,fd); -+ return r; -+} -diff --git a/src/network/__netlink.h b/src/network/__netlink.h -new file mode 100644 -index 0000000..2476da1 ---- /dev/null -+++ b/src/network/__netlink.h -@@ -0,0 +1,100 @@ -+#include <stdint.h> -+ -+/* linux/netlink.h */ -+ -+#define NETLINK_ROUTE 0 -+ -+struct nlmsghdr { -+ uint32_t nlmsg_len; -+ uint16_t nlmsg_type; -+ uint16_t nlmsg_flags; -+ uint32_t nlmsg_seq; -+ uint32_t nlmsg_pid; -+}; -+ -+#define NLM_F_REQUEST 1 -+#define NLM_F_MULTI 2 -+#define NLM_F_ACK 4 -+ -+#define NLM_F_ROOT 0x100 -+#define NLM_F_MATCH 0x200 -+#define NLM_F_ATOMIC 0x400 -+#define NLM_F_DUMP (NLM_F_ROOT|NLM_F_MATCH) -+ -+#define NLMSG_NOOP 0x1 -+#define NLMSG_ERROR 0x2 -+#define NLMSG_DONE 0x3 -+#define NLMSG_OVERRUN 0x4 -+ -+/* linux/rtnetlink.h */ -+ -+#define RTM_NEWLINK 16 -+#define RTM_GETLINK 18 -+#define RTM_NEWADDR 20 -+#define RTM_GETADDR 22 -+ -+struct rtattr { -+ unsigned short rta_len; -+ unsigned short rta_type; -+}; -+ -+struct rtgenmsg { -+ unsigned char rtgen_family; -+}; -+ -+struct ifinfomsg { -+ unsigned char ifi_family; -+ unsigned char __ifi_pad; -+ unsigned short ifi_type; -+ int ifi_index; -+ unsigned ifi_flags; -+ unsigned ifi_change; -+}; -+ -+/* linux/if_link.h */ -+ -+#define IFLA_ADDRESS 1 -+#define IFLA_BROADCAST 2 -+#define IFLA_IFNAME 3 -+#define IFLA_STATS 7 -+ -+/* linux/if_addr.h */ -+ -+struct ifaddrmsg { -+ uint8_t ifa_family; -+ uint8_t ifa_prefixlen; -+ uint8_t ifa_flags; -+ uint8_t ifa_scope; -+ uint32_t ifa_index; -+}; -+ -+#define IFA_ADDRESS 1 -+#define IFA_LOCAL 2 -+#define IFA_LABEL 3 -+#define IFA_BROADCAST 4 -+ -+/* musl */ -+ -+#define NETLINK_ALIGN(len) (((len)+3) & ~3) -+#define NLMSG_DATA(nlh) ((void*)((char*)(nlh)+sizeof(struct nlmsghdr))) -+#define NLMSG_DATALEN(nlh) ((nlh)->nlmsg_len-sizeof(struct nlmsghdr)) -+#define NLMSG_DATAEND(nlh) ((char*)(nlh)+(nlh)->nlmsg_len) -+#define NLMSG_NEXT(nlh) (struct nlmsghdr*)((char*)(nlh)+NETLINK_ALIGN((nlh)->nlmsg_len)) -+#define NLMSG_OK(nlh,end) (NLMSG_DATA(nlh) <= (end) && \ -+ (nlh)->nlmsg_len >= sizeof(struct nlmsghdr) && \ -+ (void*)NLMSG_NEXT(nlh) <= (end)) -+ -+#define RTA_DATA(rta) ((void*)((char*)(rta)+sizeof(struct rtattr))) -+#define RTA_DATALEN(rta) ((rta)->rta_len-sizeof(struct rtattr)) -+#define RTA_DATAEND(rta) ((char*)(rta)+(rta)->rta_len) -+#define RTA_NEXT(rta) (struct rtattr*)((char*)(rta)+NETLINK_ALIGN((rta)->rta_len)) -+#define RTA_OK(rta,end) (RTA_DATA(rta) <= (void*)(end) && \ -+ (rta)->rta_len >= sizeof(struct rtattr) && \ -+ (void*)RTA_NEXT(rta) <= (void*)(end)) -+ -+#define NLMSG_RTA(nlh,len) ((void*)((char*)(nlh)+sizeof(struct nlmsghdr)+NETLINK_ALIGN(len))) -+#define NLMSG_RTAOK(rta,nlh) RTA_OK(rta,NLMSG_DATAEND(nlh)) -+ -+#define IFADDRS_HASH_SIZE 64 -+ -+int __rtnetlink_enumerate(int link_af, int addr_af, int (*cb)(void *ctx, struct nlmsghdr *h), void *ctx); -diff --git a/src/network/getifaddrs.c b/src/network/getifaddrs.c -index 5a94cc7..18fc710 100644 ---- a/src/network/getifaddrs.c -+++ b/src/network/getifaddrs.c -@@ -1,181 +1,201 @@ --/* (C) 2013 John Spencer. released under musl's standard MIT license. */ --#undef _GNU_SOURCE - #define _GNU_SOURCE --#include <ifaddrs.h> --#include <stdlib.h> --#include <net/if.h> /* IFNAMSIZ, ifreq, ifconf */ --#include <stdio.h> --#include <ctype.h> --#include <string.h> - #include <errno.h> --#include <arpa/inet.h> /* inet_pton */ -+#include <string.h> -+#include <stdlib.h> - #include <unistd.h> --#include <sys/ioctl.h> --#include <sys/socket.h> -+#include <ifaddrs.h> -+#include <syscall.h> -+#include <net/if.h> -+#include <netinet/in.h> -+#include "__netlink.h" - --typedef union { -- struct sockaddr_in6 v6; -+/* getifaddrs() reports hardware addresses with PF_PACKET that implies -+ * struct sockaddr_ll. But e.g. Infiniband socket address length is -+ * longer than sockaddr_ll.ssl_addr[8] can hold. Use this hack struct -+ * to extend ssl_addr - callers should be able to still use it. */ -+struct sockaddr_ll_hack { -+ unsigned short sll_family, sll_protocol; -+ int sll_ifindex; -+ unsigned short sll_hatype; -+ unsigned char sll_pkttype, sll_halen; -+ unsigned char sll_addr[24]; -+}; -+ -+union sockany { -+ struct sockaddr sa; -+ struct sockaddr_ll_hack ll; - struct sockaddr_in v4; --} soa; -+ struct sockaddr_in6 v6; -+}; - --typedef struct ifaddrs_storage { -+struct ifaddrs_storage { - struct ifaddrs ifa; -- soa addr; -- soa netmask; -- soa dst; -+ struct ifaddrs_storage *hash_next; -+ union sockany addr, netmask, ifu; -+ unsigned int index; - char name[IFNAMSIZ+1]; --} stor; --#define next ifa.ifa_next -+}; - --static stor* list_add(stor** list, stor** head, char* ifname) -+struct ifaddrs_ctx { -+ struct ifaddrs_storage *first; -+ struct ifaddrs_storage *last; -+ struct ifaddrs_storage *hash[IFADDRS_HASH_SIZE]; -+}; -+ -+void freeifaddrs(struct ifaddrs *ifp) - { -- stor* curr = calloc(1, sizeof(stor)); -- if(curr) { -- strcpy(curr->name, ifname); -- curr->ifa.ifa_name = curr->name; -- if(*head) (*head)->next = (struct ifaddrs*) curr; -- *head = curr; -- if(!*list) *list = curr; -+ struct ifaddrs *n; -+ while (ifp) { -+ n = ifp->ifa_next; -+ free(ifp); -+ ifp = n; - } -- return curr; - } - --void freeifaddrs(struct ifaddrs *ifp) -+static void copy_addr(struct sockaddr **r, int af, union sockany *sa, void *addr, size_t addrlen, int ifindex) - { -- stor *head = (stor *) ifp; -- while(head) { -- void *p = head; -- head = (stor *) head->next; -- free(p); -+ uint8_t *dst; -+ int len; -+ -+ switch (af) { -+ case AF_INET: -+ dst = (uint8_t*) &sa->v4.sin_addr; -+ len = 4; -+ break; -+ case AF_INET6: -+ dst = (uint8_t*) &sa->v6.sin6_addr; -+ len = 16; -+ if (IN6_IS_ADDR_LINKLOCAL(addr) || IN6_IS_ADDR_MC_LINKLOCAL(addr)) -+ sa->v6.sin6_scope_id = ifindex; -+ break; -+ default: -+ return; - } -+ if (addrlen < len) return; -+ sa->sa.sa_family = af; -+ memcpy(dst, addr, len); -+ *r = &sa->sa; - } - --static void ipv6netmask(unsigned prefix_length, struct sockaddr_in6 *sa) -+static void gen_netmask(struct sockaddr **r, int af, union sockany *sa, int prefixlen) - { -- unsigned char* hb = sa->sin6_addr.s6_addr; -- unsigned onebytes = prefix_length / 8; -- unsigned bits = prefix_length % 8; -- unsigned nullbytes = 16 - onebytes; -- memset(hb, -1, onebytes); -- memset(hb+onebytes, 0, nullbytes); -- if(bits) { -- unsigned char x = -1; -- x <<= 8 - bits; -- hb[onebytes] = x; -- } -+ uint8_t addr[16] = {0}; -+ int i; -+ -+ if (prefixlen > 8*sizeof(addr)) prefixlen = 8*sizeof(addr); -+ i = prefixlen / 8; -+ memset(addr, 0xff, i); -+ if (i < sizeof(addr)) addr[i++] = 0xff << (8 - (prefixlen % 8)); -+ copy_addr(r, af, sa, addr, sizeof(addr), 0); - } - --static void dealwithipv6(stor **list, stor** head) -+static void copy_lladdr(struct sockaddr **r, union sockany *sa, void *addr, size_t addrlen, int ifindex, unsigned short hatype) - { -- FILE* f = fopen("/proc/net/if_inet6", "rbe"); -- /* 00000000000000000000000000000001 01 80 10 80 lo -- A B C D E F -- all numbers in hex -- A = addr B=netlink device#, C=prefix length, -- D = scope value (ipv6.h) E = interface flags (rnetlink.h, addrconf.c) -- F = if name */ -- char v6conv[32 + 7 + 1], *v6; -- char *line, linebuf[512]; -- if(!f) return; -- while((line = fgets(linebuf, sizeof linebuf, f))) { -- v6 = v6conv; -- size_t i = 0; -- for(; i < 8; i++) { -- memcpy(v6, line, 4); -- v6+=4; -- *v6++=':'; -- line+=4; -- } -- --v6; *v6 = 0; -- line++; -- unsigned b, c, d, e; -- char name[IFNAMSIZ+1]; -- if(5 == sscanf(line, "%x %x %x %x %s", &b, &c, &d, &e, name)) { -- struct sockaddr_in6 sa = {0}; -- if(1 == inet_pton(AF_INET6, v6conv, &sa.sin6_addr)) { -- sa.sin6_family = AF_INET6; -- stor* curr = list_add(list, head, name); -- if(!curr) goto out; -- curr->addr.v6 = sa; -- curr->ifa.ifa_addr = (struct sockaddr*) &curr->addr; -- ipv6netmask(c, &sa); -- curr->netmask.v6 = sa; -- curr->ifa.ifa_netmask = (struct sockaddr*) &curr->netmask; -- /* find ipv4 struct with the same interface name to copy flags */ -- stor* scan = *list; -- for(;scan && strcmp(name, scan->name);scan=(stor*)scan->next); -- if(scan) curr->ifa.ifa_flags = scan->ifa.ifa_flags; -- else curr->ifa.ifa_flags = 0; -- } else errno = 0; -- } -- } -- out: -- fclose(f); -+ if (addrlen > sizeof(sa->ll.sll_addr)) return; -+ sa->ll.sll_family = AF_PACKET; -+ sa->ll.sll_ifindex = ifindex; -+ sa->ll.sll_hatype = hatype; -+ sa->ll.sll_halen = addrlen; -+ memcpy(sa->ll.sll_addr, addr, addrlen); -+ *r = &sa->sa; - } - --int getifaddrs(struct ifaddrs **ifap) -+static int __handle(void *pctx, struct nlmsghdr *h) - { -- stor *list = 0, *head = 0; -- struct if_nameindex* ii = if_nameindex(); -- if(!ii) return -1; -- size_t i; -- for(i = 0; ii[i].if_index || ii[i].if_name; i++) { -- stor* curr = list_add(&list, &head, ii[i].if_name); -- if(!curr) { -- if_freenameindex(ii); -- goto err2; -+ struct ifaddrs_ctx *ctx = pctx; -+ struct ifaddrs_storage *ifs, *ifs0; -+ struct ifinfomsg *ifi = NLMSG_DATA(h); -+ struct ifaddrmsg *ifa = NLMSG_DATA(h); -+ struct rtattr *rta; -+ int stats_len = 0; -+ -+ if (h->nlmsg_type == RTM_NEWLINK) { -+ for (rta = NLMSG_RTA(h, sizeof(*ifi)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) { -+ if (rta->rta_type != IFLA_STATS) continue; -+ stats_len = RTA_DATALEN(rta); -+ break; - } -+ } else { -+ for (ifs0 = ctx->hash[ifa->ifa_index % IFADDRS_HASH_SIZE]; ifs0; ifs0 = ifs0->hash_next) -+ if (ifs0->index == ifa->ifa_index) -+ break; -+ if (!ifs0) return 0; - } -- if_freenameindex(ii); -- -- int sock = socket(PF_INET, SOCK_DGRAM|SOCK_CLOEXEC, IPPROTO_IP); -- if(sock == -1) goto err2; -- struct ifreq reqs[32]; /* arbitrary chosen boundary */ -- struct ifconf conf = {.ifc_len = sizeof reqs, .ifc_req = reqs}; -- if(-1 == ioctl(sock, SIOCGIFCONF, &conf)) goto err; -- size_t reqitems = conf.ifc_len / sizeof(struct ifreq); -- for(head = list; head; head = (stor*)head->next) { -- for(i = 0; i < reqitems; i++) { -- // get SIOCGIFADDR of active interfaces. -- if(!strcmp(reqs[i].ifr_name, head->name)) { -- head->addr.v4 = *(struct sockaddr_in*)&reqs[i].ifr_addr; -- head->ifa.ifa_addr = (struct sockaddr*) &head->addr; -+ -+ ifs = calloc(1, sizeof(struct ifaddrs_storage) + stats_len); -+ if (ifs == 0) return -1; -+ -+ if (h->nlmsg_type == RTM_NEWLINK) { -+ ifs->index = ifi->ifi_index; -+ ifs->ifa.ifa_flags = ifi->ifi_flags; -+ -+ for (rta = NLMSG_RTA(h, sizeof(*ifi)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) { -+ switch (rta->rta_type) { -+ case IFLA_IFNAME: -+ if (RTA_DATALEN(rta) < sizeof(ifs->name)) { -+ memcpy(ifs->name, RTA_DATA(rta), RTA_DATALEN(rta)); -+ ifs->ifa.ifa_name = ifs->name; -+ } -+ break; -+ case IFLA_ADDRESS: -+ copy_lladdr(&ifs->ifa.ifa_addr, &ifs->addr, RTA_DATA(rta), RTA_DATALEN(rta), ifi->ifi_index, ifi->ifi_type); -+ break; -+ case IFLA_BROADCAST: -+ copy_lladdr(&ifs->ifa.ifa_broadaddr, &ifs->ifu, RTA_DATA(rta), RTA_DATALEN(rta), ifi->ifi_index, ifi->ifi_type); -+ break; -+ case IFLA_STATS: -+ ifs->ifa.ifa_data = (void*)(ifs+1); -+ memcpy(ifs->ifa.ifa_data, RTA_DATA(rta), RTA_DATALEN(rta)); - break; - } - } -- struct ifreq req; -- snprintf(req.ifr_name, sizeof req.ifr_name, "%s", head->name); -- if(-1 == ioctl(sock, SIOCGIFFLAGS, &req)) goto err; -- -- head->ifa.ifa_flags = req.ifr_flags; -- if(head->ifa.ifa_addr) { -- /* or'ing flags with IFF_LOWER_UP on active interfaces to mimic glibc */ -- head->ifa.ifa_flags |= IFF_LOWER_UP; -- if(-1 == ioctl(sock, SIOCGIFNETMASK, &req)) goto err; -- head->netmask.v4 = *(struct sockaddr_in*)&req.ifr_netmask; -- head->ifa.ifa_netmask = (struct sockaddr*) &head->netmask; -- -- if(head->ifa.ifa_flags & IFF_POINTOPOINT) { -- if(-1 == ioctl(sock, SIOCGIFDSTADDR, &req)) goto err; -- head->dst.v4 = *(struct sockaddr_in*)&req.ifr_dstaddr; -- } else { -- if(-1 == ioctl(sock, SIOCGIFBRDADDR, &req)) goto err; -- head->dst.v4 = *(struct sockaddr_in*)&req.ifr_broadaddr; -+ if (ifs->ifa.ifa_name) { -+ unsigned int bucket = ifs->index % IFADDRS_HASH_SIZE; -+ ifs->hash_next = ctx->hash[bucket]; -+ ctx->hash[bucket] = ifs; -+ } -+ } else { -+ ifs->ifa.ifa_name = ifs0->ifa.ifa_name; -+ ifs->ifa.ifa_flags = ifs0->ifa.ifa_flags; -+ for (rta = NLMSG_RTA(h, sizeof(*ifa)); NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) { -+ switch (rta->rta_type) { -+ case IFA_ADDRESS: -+ copy_addr(&ifs->ifa.ifa_addr, ifa->ifa_family, &ifs->addr, RTA_DATA(rta), RTA_DATALEN(rta), ifa->ifa_index); -+ break; -+ case IFA_BROADCAST: -+ /* For point-to-point links this is peer, but ifa_broadaddr -+ * and ifa_dstaddr are union, so this works for both. */ -+ copy_addr(&ifs->ifa.ifa_broadaddr, ifa->ifa_family, &ifs->ifu, RTA_DATA(rta), RTA_DATALEN(rta), ifa->ifa_index); -+ break; -+ case IFA_LABEL: -+ if (RTA_DATALEN(rta) < sizeof(ifs->name)) { -+ memcpy(ifs->name, RTA_DATA(rta), RTA_DATALEN(rta)); -+ ifs->ifa.ifa_name = ifs->name; -+ } -+ break; - } -- head->ifa.ifa_ifu.ifu_dstaddr = (struct sockaddr*) &head->dst; - } -+ if (ifs->ifa.ifa_addr) -+ gen_netmask(&ifs->ifa.ifa_netmask, ifa->ifa_family, &ifs->netmask, ifa->ifa_prefixlen); -+ } -+ -+ if (ifs->ifa.ifa_name) { -+ if (!ctx->first) ctx->first = ifs; -+ if (ctx->last) ctx->last->ifa.ifa_next = &ifs->ifa; -+ ctx->last = ifs; -+ } else { -+ free(ifs); - } -- close(sock); -- void* last = 0; -- for(head = list; head; head=(stor*)head->next) last=head; -- head = last; -- dealwithipv6(&list, &head); -- *ifap = (struct ifaddrs*) list; - return 0; -- err: -- close(sock); -- err2: -- freeifaddrs((struct ifaddrs*) list); -- return -1; - } - -+int getifaddrs(struct ifaddrs **ifap) -+{ -+ struct ifaddrs_ctx _ctx, *ctx = &_ctx; -+ int r; -+ memset(ctx, 0, sizeof *ctx); -+ r = __rtnetlink_enumerate(AF_UNSPEC, AF_UNSPEC, __handle, ctx); -+ if (r == 0) *ifap = &ctx->first->ifa; -+ else freeifaddrs(&ctx->first->ifa); -+ return r; -+} -diff --git a/src/network/if_nameindex.c b/src/network/if_nameindex.c -index 53b80b2..2ad7474 100644 ---- a/src/network/if_nameindex.c -+++ b/src/network/if_nameindex.c -@@ -1,55 +1,107 @@ - #define _GNU_SOURCE - #include <net/if.h> --#include <stdlib.h> --#include <sys/socket.h> --#include <sys/ioctl.h> - #include <errno.h> --#include "syscall.h" -+#include <unistd.h> -+#include <stdlib.h> -+#include <string.h> -+#include "__netlink.h" - --static void *do_nameindex(int s, size_t n) --{ -- size_t i, len, k; -- struct ifconf conf; -- struct if_nameindex *idx; -+struct ifnamemap { -+ unsigned int hash_next; -+ unsigned int index; -+ unsigned char namelen; -+ char name[IFNAMSIZ]; -+}; - -- idx = malloc(n * (sizeof(struct if_nameindex)+sizeof(struct ifreq))); -- if (!idx) return 0; -+struct ifnameindexctx { -+ unsigned int num, allocated, str_bytes; -+ struct ifnamemap *list; -+ unsigned int hash[IFADDRS_HASH_SIZE]; -+}; - -- conf.ifc_buf = (void *)&idx[n]; -- conf.ifc_len = len = n * sizeof(struct ifreq); -- if (ioctl(s, SIOCGIFCONF, &conf) < 0) { -- free(idx); -- return 0; -- } -- if (conf.ifc_len == len) { -- free(idx); -- return (void *)-1; -+static int __handle(void *pctx, struct nlmsghdr *h) -+{ -+ struct ifnameindexctx *ctx = pctx; -+ struct ifnamemap *map; -+ struct rtattr *rta; -+ unsigned int i; -+ int index, type, namelen, bucket; -+ -+ if (h->nlmsg_type == RTM_NEWLINK) { -+ struct ifinfomsg *ifi = NLMSG_DATA(h); -+ index = ifi->ifi_index; -+ type = IFLA_IFNAME; -+ rta = NLMSG_RTA(h, sizeof(*ifi)); -+ } else { -+ struct ifaddrmsg *ifa = NLMSG_DATA(h); -+ index = ifa->ifa_index; -+ type = IFA_LABEL; -+ rta = NLMSG_RTA(h, sizeof(*ifa)); - } -+ for (; NLMSG_RTAOK(rta, h); rta = RTA_NEXT(rta)) { -+ if (rta->rta_type != type) continue; -+ -+ namelen = RTA_DATALEN(rta) - 1; -+ if (namelen > IFNAMSIZ) return 0; - -- n = conf.ifc_len / sizeof(struct ifreq); -- for (i=k=0; i<n; i++) { -- if (ioctl(s, SIOCGIFINDEX, &conf.ifc_req[i]) < 0) { -- k++; -- continue; -+ /* suppress duplicates */ -+ bucket = index % IFADDRS_HASH_SIZE; -+ i = ctx->hash[bucket]; -+ while (i) { -+ map = &ctx->list[i-1]; -+ if (map->index == index && -+ map->namelen == namelen && -+ memcmp(map->name, RTA_DATA(rta), namelen) == 0) -+ return 0; -+ i = map->hash_next; - } -- idx[i-k].if_index = conf.ifc_req[i].ifr_ifindex; -- idx[i-k].if_name = conf.ifc_req[i].ifr_name; -- } -- idx[i-k].if_name = 0; -- idx[i-k].if_index = 0; - -- return idx; -+ if (ctx->num >= ctx->allocated) { -+ size_t a = ctx->allocated ? ctx->allocated * 2 + 1 : 8; -+ if (a > SIZE_MAX/sizeof *map) return -1; -+ map = realloc(ctx->list, a * sizeof *map); -+ if (!map) return -1; -+ ctx->list = map; -+ ctx->allocated = a; -+ } -+ map = &ctx->list[ctx->num]; -+ map->index = index; -+ map->namelen = namelen; -+ memcpy(map->name, RTA_DATA(rta), namelen); -+ ctx->str_bytes += namelen + 1; -+ ctx->num++; -+ map->hash_next = ctx->hash[bucket]; -+ ctx->hash[bucket] = ctx->num; -+ return 0; -+ } -+ return 0; - } - - struct if_nameindex *if_nameindex() - { -- size_t n; -- void *p = 0; -- int s = socket(AF_UNIX, SOCK_DGRAM|SOCK_CLOEXEC, 0); -- if (s>=0) { -- for (n=0; (p=do_nameindex(s, n)) == (void *)-1; n++); -- __syscall(SYS_close, s); -+ struct ifnameindexctx _ctx, *ctx = &_ctx; -+ struct if_nameindex *ifs = 0, *d; -+ struct ifnamemap *s; -+ char *p; -+ int i; -+ -+ memset(ctx, 0, sizeof(*ctx)); -+ if (__rtnetlink_enumerate(AF_UNSPEC, AF_INET, __handle, ctx) < 0) goto err; -+ -+ ifs = malloc(sizeof(struct if_nameindex[ctx->num+1]) + ctx->str_bytes); -+ if (!ifs) goto err; -+ -+ p = (char*)(ifs + ctx->num + 1); -+ for (i = ctx->num, d = ifs, s = ctx->list; i; i--, s++, d++) { -+ d->if_index = s->index; -+ d->if_name = p; -+ memcpy(p, s->name, s->namelen); -+ p += s->namelen; -+ *p++ = 0; - } -- errno = ENOBUFS; -- return p; -+ d->if_index = 0; -+ d->if_name = 0; -+err: -+ free(ctx->list); -+ return ifs; - } --- -2.0.2 - diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index da37aac38..4a40a3dd6 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD @@ -1,8 +1,8 @@ # Contributor: William Pitcock <nenolod@dereferenced.org> # Maintainer: Timo Teräs <timo.teras@iki.fi> pkgname=musl -pkgver=1.1.3 -pkgrel=5 +pkgver=1.1.4 +pkgrel=0 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -13,17 +13,7 @@ makedepends="$depends_dev" 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 - 0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch - 0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch - 0008-fix-the-m-specifier-in-syslog.patch - 0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch 1001-add-basic-dns-record-parsing-functions.patch - 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch 1003-remove-ulimit-fiddling-from-setxid.patch ldconfig @@ -47,9 +37,6 @@ prepare() { # use GNU compatible getopt() from BSD rm -f src/misc/getopt*.c cp "$srcdir"/getopt_long.c src/misc/ - - # remove libintl wrappers that we don't want - rm src/locale/intl.c include/libintl.h } install_sysroot_headers() { @@ -99,13 +86,18 @@ package() { cp libssp_nonshared.a "$pkgdir"/usr/lib || return 1 - # make LDSO the be the real file, and libc the symlink (will be upstream change) + # make LDSO the be the real file, and libc the symlink local LDSO=$(make -f Makefile --eval "$(echo -e 'print-ldso:\n\t@echo $$(basename $(LDSO_PATHNAME))')" print-ldso) mv -f "$pkgdir"/usr/lib/libc.so "$pkgdir"/lib/"$LDSO" || return 1 ln -sf "$LDSO" "$pkgdir"/lib/libc.musl-${CARCH}.so.1 || return 1 ln -sf ../../lib/"$LDSO" "$pkgdir"/usr/lib/libc.so || return 1 mkdir -p "$pkgdir"/usr/bin ln -sf ../../lib/"$LDSO" "$pkgdir"/usr/bin/ldd || return 1 + + # remove libintl.h, currently we don't want by default any NLS + # and use GNU gettext where needed. the plan is to migrate to + # musl gettext() later on as fully as possible. + rm "$pkgdir"/usr/include/libintl.h || return 1 } utils() { @@ -125,18 +117,8 @@ utils() { install -D -m755 "$srcdir"/ldconfig "$subpkgdir"/sbin } -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 -5e432ef2b8ef6daf76f2e2b0081da4ee 0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch -db9e6b1782ab40b08b2bd2fbc237315c 0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch -d4be3c4e254a34f94f2a18d0fd43824c 0008-fix-the-m-specifier-in-syslog.patch -f77891cda55e2f54567814eff91934c0 0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch +md5sums="f18f3bdbe088438cd64a5313c19a7312 musl-1.1.4.tar.gz 2371eb1ce057fcb709a0e6a81f0d356c 1001-add-basic-dns-record-parsing-functions.patch -50bc2caec315ec814f3ffd374008738b 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch 71b2a4dcc39c436a6b89173943424043 1003-remove-ulimit-fiddling-from-setxid.patch 013be8897f27c3909ada59c62020502f ldconfig 61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c @@ -144,18 +126,8 @@ f77891cda55e2f54567814eff91934c0 0009-fix-crash-in-regexec-for-nonzero-nmatch-a 57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c 2b941c4251cac44988a4abfc50e21267 getent.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 -0383402d2577a82408a1c5030522f1f81ace8cf374feb5edf41426ab106cb82d 0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch -2ba10f0e8efbce263db3147ecd4791d3363b968fcbfb2db4baaaeda1014d0079 0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch -a48df68855aec62da663ebf05f358bb49d054fbcb46c109db0a2b5e7a92a4259 0008-fix-the-m-specifier-in-syslog.patch -448280d267f6dcf9d3695b10a037092a0b963f026c83e4b03564d5564faec052 0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch +sha256sums="658c65ad3c3a9b281a96c5281e75720c758d91fcaae35ab987f2fdfb4f88f5cd musl-1.1.4.tar.gz 75053a31f6b84a64846d92c0ec631c76d7f747a9c0dc92a6dc1aa1bddfe2ea76 1001-add-basic-dns-record-parsing-functions.patch -9aee829aadb3e1fb3e61ca3ad56a7512dcfada2658ba31f83290ada86ace455b 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch fb542c2bd5081ff2f601c519edb3dac8f54ca5c888f44bc6cfb84e6565472025 1003-remove-ulimit-fiddling-from-setxid.patch 398dc26ec82cc6af056c738e8ac62da212ba978229d9839eb8b61f7ce536da4a ldconfig d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c @@ -163,18 +135,8 @@ d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c 68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.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 -1c3ca3317d7dd3e2959754988b1cb7b56215e18b9481205b9a254f8842cdf2d5cdcdaf0ba45dd7c9d4f4629b53a44415b94016faea0b166cc44a6e1ffd4f5ace 0006-make-dynamic-linker-accept-colon-as-a-separator-for-.patch -0878ab3babec6ac16d464fbda3151122637c80a30bc9f37b1079d31df17f62062f04bcf0c620014a45cb04255b4db7de56cf906d070dd29be17ef6db756a8060 0007-explicitly-reject-empty-names-in-dynamic-linker-load.patch -5212d345635b88497a1e050d22c387a75e849ca257b41a01391882510b469a1162259c99f101c26ac1ce4c9cce9e3c55a2f422564a949bb3b438f182cb65a414 0008-fix-the-m-specifier-in-syslog.patch -29387d468bf06cb53acae098b06268fdfc74a6c5cc612776f96012be49978090e0f74ee1a6128a8cfd452af5c698d4cd07749013dd8c722e1173c9e328677499 0009-fix-crash-in-regexec-for-nonzero-nmatch-argument-wit.patch +sha512sums="a46fb1db23f518beaa959e9bebcb3bf0574e583c197792d30dcd52b3974e3c285594984207043d317859fc5552f1d303a5686e9fbe3b8825df6346de7f917f9f musl-1.1.4.tar.gz 5b8ffa0a50419581adbf6ce2dae5797774022551c6331fa5aa2ff13635eb72b74eedd8a92cb478d45d73e1956af2f588669681ac414f3a255abd4d8ba8579448 1001-add-basic-dns-record-parsing-functions.patch -3df7500a06960490412c15002cdd68916f6d4ad13c3070477d0859874649ff5f6de128b2d9592e614b5ff4ba7616fd074c353f4d2dc2eb1549903a3975fd9e5e 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch dae010b45419fcab64410568466f659cdc874e63113025e2cbc2fbab047b470fec23851ecbef08886505924482a069caf37c16b483b6922535fbd31832f1c4a3 1003-remove-ulimit-fiddling-from-setxid.patch 33e13d2242063f3dc9ec199ae9528e469a52ccae4d3726faa3c866e0c7dcf546f69294f9c00307324cee05fd965f84350ae100b8b1138f9d9c8c916de04ab0d1 ldconfig 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c |