From b1e8c97877c096085d89e57da7859b28bb995022 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timo=20Ter=C3=A4s?= Date: Wed, 11 Jun 2014 14:19:09 +0300 Subject: main/musl: upgrade to snapshot of 2014-06-11 * migrate to /etc/localtime (instead of /etc/zoneinfo/localtime) this is the upstream way now * add replaces to uclibc-utils for smoother upgrades from uclibc --- main/musl/0001-v1.1.2-to-66fcde4a.patch | 376 +++++++++++++++++++++ ...-to-localtime-timezone-if-TZ-is-undefined.patch | 27 -- main/musl/APKBUILD | 14 +- 3 files changed, 383 insertions(+), 34 deletions(-) create mode 100644 main/musl/0001-v1.1.2-to-66fcde4a.patch delete mode 100644 main/musl/2001-default-to-localtime-timezone-if-TZ-is-undefined.patch diff --git a/main/musl/0001-v1.1.2-to-66fcde4a.patch b/main/musl/0001-v1.1.2-to-66fcde4a.patch new file mode 100644 index 000000000..0c53a38f4 --- /dev/null +++ b/main/musl/0001-v1.1.2-to-66fcde4a.patch @@ -0,0 +1,376 @@ +diff --git a/configure b/configure +index 03c193d..0cff13d 100755 +--- a/configure ++++ b/configure +@@ -123,7 +123,7 @@ target= + optimize=auto + debug=no + warnings=no +-shared=yes ++shared=auto + static=yes + wrapper=auto + +@@ -412,12 +412,15 @@ fi + tryflag CFLAGS_AUTO -fno-stack-protector + tryldflag LDFLAGS_AUTO -Wl,--hash-style=both + ++test "$shared" = "no" || { + # Disable dynamic linking if ld is broken and can't do -Bsymbolic-functions + LDFLAGS_DUMMY= + tryldflag LDFLAGS_DUMMY -Wl,-Bsymbolic-functions || { ++test "$shared" = "yes" && fail "$0: error: linker cannot build shared library" + printf "warning: disabling dynamic linking support\n" + shared=no + } ++} + + # Find compiler runtime library + test -z "$LIBCC" && tryldflag LIBCC -lgcc && tryldflag LIBCC -lgcc_eh +diff --git a/src/env/__init_tls.c b/src/env/__init_tls.c +index 89d081e..f7eab8d 100644 +--- a/src/env/__init_tls.c ++++ b/src/env/__init_tls.c +@@ -11,17 +11,11 @@ int __init_tp(void *p) + { + pthread_t td = p; + td->self = td; +- if (__set_thread_area(TP_ADJ(p)) < 0) +- return -1; +- td->tid = td->pid = __syscall(SYS_set_tid_address, &td->tid); +- td->errno_ptr = &td->errno_val; +- /* Currently, both of these predicates depend in the same thing: +- * successful initialization of the thread pointer. However, in +- * the future, we may support setups where setting the thread +- * pointer is possible but threads other than the main thread +- * cannot work, so it's best to keep the predicates separate. */ ++ int r = __set_thread_area(TP_ADJ(p)); ++ if (r < 0) return -1; ++ if (!r) libc.can_do_threads = 1; + libc.has_thread_pointer = 1; +- libc.can_do_threads = 1; ++ td->tid = td->pid = __syscall(SYS_set_tid_address, &td->tid); + return 0; + } + +diff --git a/src/errno/__errno_location.c b/src/errno/__errno_location.c +index 8419107..49654ef 100644 +--- a/src/errno/__errno_location.c ++++ b/src/errno/__errno_location.c +@@ -3,6 +3,6 @@ + int *__errno_location(void) + { + static int e; +- if (libc.has_thread_pointer) return __pthread_self()->errno_ptr; ++ if (libc.has_thread_pointer) return &__pthread_self()->errno_val; + return &e; + } +diff --git a/src/internal/pthread_impl.h b/src/internal/pthread_impl.h +index 2e910b3..650e811 100644 +--- a/src/internal/pthread_impl.h ++++ b/src/internal/pthread_impl.h +@@ -18,7 +18,7 @@ struct pthread { + uintptr_t sysinfo; + uintptr_t canary; + pid_t tid, pid; +- int tsd_used, errno_val, *errno_ptr; ++ int tsd_used, errno_val; + volatile int cancel, canceldisable, cancelasync; + int detached; + unsigned char *map_base; +diff --git a/src/locale/uselocale.c b/src/locale/uselocale.c +index 224ef38..4fc5c64 100644 +--- a/src/locale/uselocale.c ++++ b/src/locale/uselocale.c +@@ -4,7 +4,7 @@ + + locale_t uselocale(locale_t l) + { +- pthread_t self = pthread_self(); ++ pthread_t self = __pthread_self(); + locale_t old = self->locale; + if (l) self->locale = l; + return old; +diff --git a/src/misc/getopt.c b/src/misc/getopt.c +index f1a1639..8a2e4d5 100644 +--- a/src/misc/getopt.c ++++ b/src/misc/getopt.c +@@ -65,8 +65,11 @@ int getopt(int argc, char * const argv[], const char *optstring) + } + return '?'; + } +- optarg = argv[optind++] + optpos; +- optpos = 0; ++ if (optstring[i+2] == ':') optarg = 0; ++ if (optstring[i+2] != ':' || optpos) { ++ optarg = argv[optind++] + optpos; ++ optpos = 0; ++ } + } + return c; + } +diff --git a/src/network/res_msend.c b/src/network/res_msend.c +index 5192b4d..35f106d 100644 +--- a/src/network/res_msend.c ++++ b/src/network/res_msend.c +@@ -34,7 +34,7 @@ int __res_msend(int nqueries, const unsigned char *const *queries, + FILE *f, _f; + unsigned char _buf[256]; + char line[64], *s, *z; +- int timeout = 5000, attempts = 2, retry_interval; ++ int timeout = 5000, attempts = 2, retry_interval, servfail_retry; + union { + struct sockaddr_in sin; + struct sockaddr_in6 sin6; +@@ -152,6 +152,7 @@ int __res_msend(int nqueries, const unsigned char *const *queries, + qlens[i], MSG_NOSIGNAL, + (void *)&ns[j], sl); + t1 = t2; ++ servfail_retry = 2 * nqueries; + } + + /* Wait for a response, or until time to retry */ +@@ -160,12 +161,12 @@ int __res_msend(int nqueries, const unsigned char *const *queries, + while ((rlen = recvfrom(fd, answers[next], asize, 0, + (void *)&sa, (socklen_t[1]){sl})) >= 0) { + +- /* Ignore non-identifiable packets (no query id) */ +- if (rlen < 2) continue; ++ /* Ignore non-identifiable packets */ ++ if (rlen < 4) continue; + + /* Ignore replies from addresses we didn't send to */ +- for (i=0; itid; ++ int tid = __pthread_self()->tid; + if (f->lock == tid) { + if (f->lockcount == LONG_MAX) + return -1; +diff --git a/src/thread/cancel_impl.c b/src/thread/cancel_impl.c +index 525d290..41cf2b8 100644 +--- a/src/thread/cancel_impl.c ++++ b/src/thread/cancel_impl.c +@@ -58,7 +58,7 @@ static void cancel_handler(int sig, siginfo_t *si, void *ctx) + void __testcancel() + { + if (!libc.has_thread_pointer) return; +- pthread_t self = pthread_self(); ++ pthread_t self = __pthread_self(); + if (self->cancel && !self->canceldisable) + __cancel(); + } +diff --git a/src/thread/i386/__set_thread_area.s b/src/thread/i386/__set_thread_area.s +index cccf1cd..ad53815 100644 +--- a/src/thread/i386/__set_thread_area.s ++++ b/src/thread/i386/__set_thread_area.s +@@ -12,11 +12,25 @@ __set_thread_area: + mov $243,%al + int $128 + testl %eax,%eax +- jnz 1f +- movl (%esp),%ecx +- leal 3(,%ecx,8),%ecx +- movw %cx,%gs ++ jnz 2f ++ movl (%esp),%edx ++ leal 3(,%edx,8),%edx ++3: movw %dx,%gs + 1: + addl $16,%esp + popl %ebx + ret ++2: ++ mov %ebx,%ecx ++ xor %ebx,%ebx ++ xor %edx,%edx ++ mov %ebx,(%esp) ++ mov $1,%bl ++ mov $16,%dl ++ mov $123,%al ++ int $128 ++ testl %eax,%eax ++ jnz 1b ++ mov $7,%dl ++ inc %al ++ jmp 3b +diff --git a/src/thread/pthread_cond_broadcast.c b/src/thread/pthread_cond_broadcast.c +index 848e288..0901daf 100644 +--- a/src/thread/pthread_cond_broadcast.c ++++ b/src/thread/pthread_cond_broadcast.c +@@ -28,7 +28,7 @@ int pthread_cond_broadcast(pthread_cond_t *c) + /* Perform the futex requeue, waking one waiter unless we know + * that the calling thread holds the mutex. */ + __syscall(SYS_futex, &c->_c_seq, FUTEX_REQUEUE, +- !m->_m_type || (m->_m_lock&INT_MAX)!=pthread_self()->tid, ++ !m->_m_type || (m->_m_lock&INT_MAX)!=__pthread_self()->tid, + INT_MAX, &m->_m_lock); + + out: +diff --git a/src/thread/pthread_cond_timedwait.c b/src/thread/pthread_cond_timedwait.c +index 1f25c8e..99d62cc 100644 +--- a/src/thread/pthread_cond_timedwait.c ++++ b/src/thread/pthread_cond_timedwait.c +@@ -41,7 +41,7 @@ int pthread_cond_timedwait(pthread_cond_t *restrict c, pthread_mutex_t *restrict + struct cm cm = { .c=c, .m=m }; + int r, e=0, seq; + +- if (m->_m_type && (m->_m_lock&INT_MAX) != pthread_self()->tid) ++ if (m->_m_type && (m->_m_lock&INT_MAX) != __pthread_self()->tid) + return EPERM; + + if (ts && ts->tv_nsec >= 1000000000UL) +diff --git a/src/thread/pthread_create.c b/src/thread/pthread_create.c +index e0b5ef1..e9c8160 100644 +--- a/src/thread/pthread_create.c ++++ b/src/thread/pthread_create.c +@@ -13,7 +13,7 @@ weak_alias(dummy_0, __pthread_tsd_run_dtors); + + _Noreturn void pthread_exit(void *result) + { +- pthread_t self = pthread_self(); ++ pthread_t self = __pthread_self(); + sigset_t set; + + self->result = result; +@@ -78,7 +78,7 @@ _Noreturn void pthread_exit(void *result) + void __do_cleanup_push(struct __ptcb *cb) + { + if (!libc.has_thread_pointer) return; +- struct pthread *self = pthread_self(); ++ struct pthread *self = __pthread_self(); + cb->__next = self->cancelbuf; + self->cancelbuf = cb; + } +@@ -201,7 +201,6 @@ int pthread_create(pthread_t *restrict res, const pthread_attr_t *restrict attrp + new->stack = stack; + new->stack_size = stack - stack_limit; + new->pid = self->pid; +- new->errno_ptr = &new->errno_val; + new->start = entry; + new->start_arg = arg; + new->self = new; +diff --git a/src/thread/pthread_mutex_consistent.c b/src/thread/pthread_mutex_consistent.c +index 7dfb904..65da29f 100644 +--- a/src/thread/pthread_mutex_consistent.c ++++ b/src/thread/pthread_mutex_consistent.c +@@ -3,7 +3,7 @@ + int pthread_mutex_consistent(pthread_mutex_t *m) + { + if (m->_m_type < 8) return EINVAL; +- if ((m->_m_lock & 0x3fffffff) != pthread_self()->tid) ++ if ((m->_m_lock & 0x3fffffff) != __pthread_self()->tid) + return EPERM; + m->_m_type -= 8; + return 0; +diff --git a/src/thread/pthread_mutex_timedlock.c b/src/thread/pthread_mutex_timedlock.c +index c24270d..7b1afc0 100644 +--- a/src/thread/pthread_mutex_timedlock.c ++++ b/src/thread/pthread_mutex_timedlock.c +@@ -10,7 +10,7 @@ int pthread_mutex_timedlock(pthread_mutex_t *restrict m, const struct timespec * + while ((r=pthread_mutex_trylock(m)) == EBUSY) { + if (!(r=m->_m_lock) || (r&0x40000000)) continue; + if ((m->_m_type&3) == PTHREAD_MUTEX_ERRORCHECK +- && (r&0x1fffffff) == pthread_self()->tid) ++ && (r&0x1fffffff) == __pthread_self()->tid) + return EDEADLK; + + a_inc(&m->_m_waiters); +diff --git a/src/thread/pthread_mutex_trylock.c b/src/thread/pthread_mutex_trylock.c +index db784a7..00ad65d 100644 +--- a/src/thread/pthread_mutex_trylock.c ++++ b/src/thread/pthread_mutex_trylock.c +@@ -8,7 +8,7 @@ int pthread_mutex_trylock(pthread_mutex_t *m) + if (m->_m_type == PTHREAD_MUTEX_NORMAL) + return a_cas(&m->_m_lock, 0, EBUSY) & EBUSY; + +- self = pthread_self(); ++ self = __pthread_self(); + tid = self->tid; + + if (m->_m_type >= 4) { +diff --git a/src/thread/pthread_mutex_unlock.c b/src/thread/pthread_mutex_unlock.c +index 5fc0f4e..b4bd74b 100644 +--- a/src/thread/pthread_mutex_unlock.c ++++ b/src/thread/pthread_mutex_unlock.c +@@ -13,7 +13,7 @@ int pthread_mutex_unlock(pthread_mutex_t *m) + if (m->_m_type != PTHREAD_MUTEX_NORMAL) { + if (!m->_m_lock) + return EPERM; +- self = pthread_self(); ++ self = __pthread_self(); + if ((m->_m_lock&0x1fffffff) != self->tid) + return EPERM; + if ((m->_m_type&3) == PTHREAD_MUTEX_RECURSIVE && m->_m_count) +diff --git a/src/thread/pthread_setcanceltype.c b/src/thread/pthread_setcanceltype.c +index ce2fff0..bf0a3f3 100644 +--- a/src/thread/pthread_setcanceltype.c ++++ b/src/thread/pthread_setcanceltype.c +@@ -2,7 +2,7 @@ + + int pthread_setcanceltype(int new, int *old) + { +- struct pthread *self = pthread_self(); ++ struct pthread *self = __pthread_self(); + if (new > 1U) return EINVAL; + if (old) *old = self->cancelasync; + self->cancelasync = new; +diff --git a/src/time/__tz.c b/src/time/__tz.c +index 6d7173c..92c43a5 100644 +--- a/src/time/__tz.c ++++ b/src/time/__tz.c +@@ -128,7 +128,7 @@ static void do_tzset() + "/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0"; + + s = getenv("TZ"); +- if (!s || !*s) s = __gmt; ++ if (!s || !*s) s = "/etc/localtime"; + + if (old_tz && !strcmp(s, old_tz)) return; + +@@ -153,7 +153,8 @@ static void do_tzset() + if (*s == ':' || ((p=strchr(s, '/')) && !memchr(s, ',', p-s))) { + if (*s == ':') s++; + if (*s == '/' || *s == '.') { +- if (!libc.secure) map = __map_file(s, &map_size); ++ if (!libc.secure || !strcmp(s, "/etc/localtime")) ++ map = __map_file(s, &map_size); + } else { + size_t l = strlen(s); + if (l <= NAME_MAX && !strchr(s, '.')) { diff --git a/main/musl/2001-default-to-localtime-timezone-if-TZ-is-undefined.patch b/main/musl/2001-default-to-localtime-timezone-if-TZ-is-undefined.patch deleted file mode 100644 index 10e87bf47..000000000 --- a/main/musl/2001-default-to-localtime-timezone-if-TZ-is-undefined.patch +++ /dev/null @@ -1,27 +0,0 @@ -From 4776cf82a9367ff51883af243a219d45da35d3b5 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Timo=20Ter=C3=A4s?= -Date: Wed, 23 Apr 2014 09:11:46 +0300 -Subject: [PATCH] default to localtime timezone if TZ is undefined - -the rest of the logic fallsback to GMT if it does not exist -(since musl commit 0f2315b4af1c58cbfb7c7f9da69b495cd146cc18) ---- - src/time/__tz.c | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/time/__tz.c b/src/time/__tz.c -index 6d7173c..4184b60 100644 ---- a/src/time/__tz.c -+++ b/src/time/__tz.c -@@ -128,7 +128,7 @@ static void do_tzset() - "/usr/share/zoneinfo/\0/share/zoneinfo/\0/etc/zoneinfo/\0"; - - s = getenv("TZ"); -- if (!s || !*s) s = __gmt; -+ if (!s || !*s) s = ":localtime"; - - if (old_tz && !strcmp(s, old_tz)) return; - --- -1.9.2 - diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD index 80968cabb..73492167a 100644 --- a/main/musl/APKBUILD +++ b/main/musl/APKBUILD @@ -2,7 +2,7 @@ # Maintainer: Timo Teräs pkgname=musl pkgver=1.1.2 -pkgrel=0 +pkgrel=1 pkgdesc="the musl c library (libc) implementation" url="http://www.musl-libc.org/" arch="all" @@ -10,12 +10,12 @@ license="MIT" depends="" depends_dev="!uclibc-dev" makedepends="$depends_dev" -install="" +install="$pkgname.post-install $pkgname.post-upgrade" subpackages="$pkgname-dev $pkgname-utils" source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz + 0001-v1.1.2-to-66fcde4a.patch 1001-add-basic-dns-record-parsing-functions.patch 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch - 2001-default-to-localtime-timezone-if-TZ-is-undefined.patch ldconfig getopt_long.c @@ -101,7 +101,7 @@ package() { utils() { depends="!uclibc-utils scanelf" - replaces="libiconv" + replaces="libiconv uclibc-utils" license="MIT BSD GPL2+" mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/sbin @@ -117,9 +117,9 @@ utils() { } md5sums="a81309e54efdf9c68baf679790fc5678 musl-1.1.2.tar.gz +a6a1f5c4f34f80cb1fd4c6e1b7936013 0001-v1.1.2-to-66fcde4a.patch a3810683ef61ac27e2f6ec9801280c81 1001-add-basic-dns-record-parsing-functions.patch 83c3bd2a50b1de5ef948704d3f4e0583 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch -e936297ceb484b2160a4cd8a3a4eb291 2001-default-to-localtime-timezone-if-TZ-is-undefined.patch 013be8897f27c3909ada59c62020502f ldconfig 61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c 0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c @@ -127,9 +127,9 @@ cb82d21fed17a116b44b830adba71c5a getconf.c 2b941c4251cac44988a4abfc50e21267 getent.c 45f92f8d59cf84d765de698a9578dbf4 iconv.c" sha256sums="dac94112b9a22d2657cd3f36ca0d62ee1eb10707a22bfc97d5746147ef92852b musl-1.1.2.tar.gz +2cd863b8a7d4af3d592607b20479163c1a011cf5a458cf7f0dc2dc9c08f5b57c 0001-v1.1.2-to-66fcde4a.patch 758390768b1bc4159d56908ca332b9640cd0552ed3b4b2b8d4a6d499c54c11a1 1001-add-basic-dns-record-parsing-functions.patch 1c25880095e869b827f02997e864fdf4bf157a4e923e52d97dbd05e657aedb70 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch -60d7aa78040ee664681e507475129f76e445291863137e568c9a3d11ae8436ce 2001-default-to-localtime-timezone-if-TZ-is-undefined.patch 398dc26ec82cc6af056c738e8ac62da212ba978229d9839eb8b61f7ce536da4a ldconfig d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c 299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c @@ -137,9 +137,9 @@ d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c 68373a55e89ce85c562d941ccf588337d6cc6c9c17689d695f65cd7607134bbe getent.c f79a2930a2e5bb0624321589edf8b889d1e9b603e01e6b7ae214616605b3fdd7 iconv.c" sha512sums="54d279efea6e122567c936e47401df5c0f1493c42eb3199b0ba3053b1882a864fc1a71d19ad945bc4f328407231c54a7897413e37f4bc33337a243c044a26b4a musl-1.1.2.tar.gz +631b93b875d0b4451e8ab4587d4cd495617fe4b8627387bb7d19af5e9b354ae726e91b24abea87acc63f9b30ea55e1f65d87cf8ecfba2c69e0cdcdab15d84fa9 0001-v1.1.2-to-66fcde4a.patch dad965258daf69371b844f76bfe5a914b0eca0ca76f3fc340b8fd7acf598b5f87bbe6d68b1f43ed0293ee0ed3bfd85d5173ccc169aa6265646248d5b8a906708 1001-add-basic-dns-record-parsing-functions.patch 72cf33738d2cf31f6ec02312bc494d754c17470b519172bb8bd7e2e29ac3b119023088a2b3fbc0dbc2fddd0078ccbae62096106cae361f8c31d6a9950043af25 1002-reimplement-if_nameindex-and-getifaddrs-using-netlin.patch -8d4cae760895a18e83b5fcbdc925705a6dd98acd2270562ee6c905363096a4111cf3aa324b52a16066e30bddc9ab104883e2b25b5c68396ea27f1c50cb939f0a 2001-default-to-localtime-timezone-if-TZ-is-undefined.patch 33e13d2242063f3dc9ec199ae9528e469a52ccae4d3726faa3c866e0c7dcf546f69294f9c00307324cee05fd965f84350ae100b8b1138f9d9c8c916de04ab0d1 ldconfig 140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c 062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c -- cgit v1.2.3