aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl
diff options
context:
space:
mode:
authorNatanael Copa <ncopa@alpinelinux.org>2015-08-13 12:03:46 +0200
committerNatanael Copa <ncopa@alpinelinux.org>2015-08-13 12:03:46 +0200
commit8414beebee8ee751a27f412d2318f0bcf66bf65b (patch)
treee8b2bcb59891b6e0d003e54aba07a24f424212c3 /main/musl
parentb6576c3f7621281efae1557c60104cf45b55d301 (diff)
downloadaports-8414beebee8ee751a27f412d2318f0bcf66bf65b.tar.bz2
aports-8414beebee8ee751a27f412d2318f0bcf66bf65b.tar.xz
main/musl: fix struct tm.tm_gmtoff
ref #4450
Diffstat (limited to 'main/musl')
-rw-r--r--main/musl/0001-fix-struct-tm.tm_gmtoff-to-be-posive-east-of-UTC.patch123
-rw-r--r--main/musl/APKBUILD6
2 files changed, 128 insertions, 1 deletions
diff --git a/main/musl/0001-fix-struct-tm.tm_gmtoff-to-be-posive-east-of-UTC.patch b/main/musl/0001-fix-struct-tm.tm_gmtoff-to-be-posive-east-of-UTC.patch
new file mode 100644
index 0000000000..569182bfd6
--- /dev/null
+++ b/main/musl/0001-fix-struct-tm.tm_gmtoff-to-be-posive-east-of-UTC.patch
@@ -0,0 +1,123 @@
+From f758bdca98941027145e005543c7e5bc218d98b4 Mon Sep 17 00:00:00 2001
+From: Natanael Copa <ncopa@alpinelinux.org>
+Date: Wed, 12 Aug 2015 17:06:00 +0200
+Subject: [PATCH] fix struct tm.tm_gmtoff to be posive east of UTC
+
+Posix says that tzset() should set the "extern long timezone" (defined
+in time.h) "shall be set to the difference, in seconds, between
+Coordinated Universal Time (UTC) and local standard time." This means
+that locations east of UTC will have negative value timezone value.
+
+However the value in the glibc additional struct tm field "long
+tm_gmtoff" is positive on locations east of UTC, just like the offset in
+the zoneinfo database.
+
+From http://man7.org/linux/man-pages/man3/ctime.3.html
+
+ long tm_gmtoff; /* Seconds east of UTC */
+
+This fixes coreutils' 'date -R' and 'ruby -e "puts Time.now"' to display
+correct timezone offset.
+---
+ src/time/__tz.c | 12 ++++++------
+ src/time/localtime_r.c | 2 +-
+ src/time/mktime.c | 6 +++---
+ src/time/strftime.c | 4 ++--
+ 4 files changed, 12 insertions(+), 12 deletions(-)
+
+diff --git a/src/time/__tz.c b/src/time/__tz.c
+index 102c8bc..8b84b9b 100644
+--- a/src/time/__tz.c
++++ b/src/time/__tz.c
+@@ -354,9 +354,9 @@ void __secs_to_zone(long long t, int local, int *isdst, long *offset, long *oppo
+ size_t alt, i = scan_trans(t, local, &alt);
+ if (i != -1) {
+ *isdst = types[6*i+4];
+- *offset = -(int32_t)zi_read32(types+6*i);
++ *offset = (int32_t)zi_read32(types+6*i);
+ *zonename = (const char *)abbrevs + types[6*i+5];
+- if (oppoff) *oppoff = -(int32_t)zi_read32(types+6*alt);
++ if (oppoff) *oppoff = (int32_t)zi_read32(types+6*alt);
+ UNLOCK(lock);
+ return;
+ }
+@@ -390,15 +390,15 @@ void __secs_to_zone(long long t, int local, int *isdst, long *offset, long *oppo
+ }
+ std:
+ *isdst = 0;
+- *offset = __timezone;
+- if (oppoff) *oppoff = dst_off;
++ *offset = -__timezone;
++ if (oppoff) *oppoff = -dst_off;
+ *zonename = __tzname[0];
+ UNLOCK(lock);
+ return;
+ dst:
+ *isdst = 1;
+- *offset = dst_off;
+- if (oppoff) *oppoff = __timezone;
++ *offset = -dst_off;
++ if (oppoff) *oppoff = -__timezone;
+ *zonename = __tzname[1];
+ UNLOCK(lock);
+ }
+diff --git a/src/time/localtime_r.c b/src/time/localtime_r.c
+index 1d43d9f..2e62c29 100644
+--- a/src/time/localtime_r.c
++++ b/src/time/localtime_r.c
+@@ -11,7 +11,7 @@ struct tm *__localtime_r(const time_t *restrict t, struct tm *restrict tm)
+ return 0;
+ }
+ __secs_to_zone(*t, 0, &tm->tm_isdst, &tm->__tm_gmtoff, 0, &tm->__tm_zone);
+- if (__secs_to_tm((long long)*t - tm->__tm_gmtoff, tm) < 0) {
++ if (__secs_to_tm((long long)*t + tm->__tm_gmtoff, tm) < 0) {
+ errno = EOVERFLOW;
+ return 0;
+ }
+diff --git a/src/time/mktime.c b/src/time/mktime.c
+index 0ab4780..bad3f07 100644
+--- a/src/time/mktime.c
++++ b/src/time/mktime.c
+@@ -10,14 +10,14 @@ time_t mktime(struct tm *tm)
+ __secs_to_zone(t, 1, &new.tm_isdst, &new.__tm_gmtoff, &opp, &new.__tm_zone);
+
+ if (tm->tm_isdst>=0 && new.tm_isdst!=tm->tm_isdst)
+- t += opp - new.__tm_gmtoff;
++ t -= opp - new.__tm_gmtoff;
+
+- t += new.__tm_gmtoff;
++ t -= new.__tm_gmtoff;
+ if ((time_t)t != t) goto error;
+
+ __secs_to_zone(t, 0, &new.tm_isdst, &new.__tm_gmtoff, &opp, &new.__tm_zone);
+
+- if (__secs_to_tm(t - new.__tm_gmtoff, &new) < 0) goto error;
++ if (__secs_to_tm(t + new.__tm_gmtoff, &new) < 0) goto error;
+
+ *tm = new;
+ return t;
+diff --git a/src/time/strftime.c b/src/time/strftime.c
+index 794fbe1..e945bb7 100644
+--- a/src/time/strftime.c
++++ b/src/time/strftime.c
+@@ -126,7 +126,7 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
+ fmt = "%H:%M";
+ goto recu_strftime;
+ case 's':
+- val = __tm_to_secs(tm) + tm->__tm_gmtoff;
++ val = __tm_to_secs(tm) - tm->__tm_gmtoff;
+ width = 1;
+ goto number;
+ case 'S':
+@@ -178,7 +178,7 @@ const char *__strftime_fmt_1(char (*s)[100], size_t *l, int f, const struct tm *
+ return "";
+ }
+ *l = snprintf(*s, sizeof *s, "%+.2d%.2d",
+- (-tm->__tm_gmtoff)/3600,
++ (tm->__tm_gmtoff)/3600,
+ abs(tm->__tm_gmtoff%3600)/60);
+ return *s;
+ case 'Z':
+--
+2.5.0
+
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index d1c65e085b..b49b447290 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.10
-pkgrel=3
+pkgrel=4
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -17,6 +17,7 @@ source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
0003-handle-loss-of-syslog-socket-connection.patch
0004-fix-missing-synchronization-in-atomic-store-on-i386-.patch
0005-mitigate-vsz-explotion.patch
+ 0001-fix-struct-tm.tm_gmtoff-to-be-posive-east-of-UTC.patch
ldconfig
__stack_chk_fail_local.c
@@ -139,6 +140,7 @@ b468a4063182bc08d6d100075067d7fe 0002-ns_parse.c-fix-ns_skiprr.patch
ccf33ac806e1152b14316eadbb667fb3 0003-handle-loss-of-syslog-socket-connection.patch
14dd2ac16696f3bd894ffd8ce2e5ea15 0004-fix-missing-synchronization-in-atomic-store-on-i386-.patch
4b5d01740934c549173ef89575b70f97 0005-mitigate-vsz-explotion.patch
+e60b587a8482e331d1eeb9a5534e7a03 0001-fix-struct-tm.tm_gmtoff-to-be-posive-east-of-UTC.patch
830d01f7821b978df770b06db3790921 ldconfig
0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c
57ef2c63b9ec6a2041694ace97d4ffa2 getconf.c
@@ -150,6 +152,7 @@ af5821fd50ad1587a9ef8117dc1e121cdda573f623286c6af4793e999afe840f 0001-fix-uselo
624aeae194332de57c525306f00cc513a7708eff065fce75fe176645aa1c4062 0003-handle-loss-of-syslog-socket-connection.patch
aca83a914e90d9d1dbf8584fd00363301d453e324477e705dc3086ba00db2fb5 0004-fix-missing-synchronization-in-atomic-store-on-i386-.patch
b33c02f11b8ec1aad49bc054b1a52486077156dd7d91d3b68108f7e1cb6c53ac 0005-mitigate-vsz-explotion.patch
+e46ae519bb8155e59f453c44ce65a4b001b6bb4dce601150c28b38679ab199ac 0001-fix-struct-tm.tm_gmtoff-to-be-posive-east-of-UTC.patch
b4a2c06db38742e8c42c3c9838b285a7d8cdac6c091ff3df5ff9a15f1e41b9c7 ldconfig
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c
d87d0cbb3690ae2c5d8cc218349fd8278b93855dd625deaf7ae50e320aad247c getconf.c
@@ -161,6 +164,7 @@ a77981c637a091e19435ee8b3ef3ee21dbc7171f8fa88b59cfd42934a270bb92c9c3777c176fa64c
68ea86c8a388c1b122ef2e07fff847c9fbecc0ca818b2710c52976fbd91c11e0ed07c612ce8771ab6e2520e813701ea764e84744d7e08fa54616230c6499da01 0003-handle-loss-of-syslog-socket-connection.patch
9a696b0eeebffee21ae84d4fc415b36b93e412ddd4a7272ed3cfe93e06c9815c4070ea998d63de348b2ee82180162a586326f1741f1d98088c27989354c5ecb3 0004-fix-missing-synchronization-in-atomic-store-on-i386-.patch
2141c557a5f71a38510703d8266ed3fd21adfe137892b0fe81adcb28841b20a495f419beb273f381e6d9cb7f61cb8b182a249da61bf5a7b9df42b84235a01bc4 0005-mitigate-vsz-explotion.patch
+b2e545fef287a204e1e82243a394ffdf85e67c1b91c27c220228867a3f198d66848b4f0ff148843194008c3c5d6dd405b40933267fc13b79e55cdd74c56868a2 0001-fix-struct-tm.tm_gmtoff-to-be-posive-east-of-UTC.patch
8d3a2d5315fc56fee7da9abb8b89bb38c6046c33d154c10d168fb35bfde6b0cf9f13042a3bceee34daf091bc409d699223735dcf19f382eeee1f6be34154f26f ldconfig
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c
0d80f37b34a35e3d14b012257c50862dfeb9d2c81139ea2dfa101d981d093b009b9fa450ba27a708ac59377a48626971dfc58e20a3799084a65777a0c32cbc7d getconf.c