aboutsummaryrefslogtreecommitdiffstats
path: root/main/musl
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-12-19 19:36:29 +0000
committerTimo Teräs <timo.teras@iki.fi>2013-12-19 19:37:29 +0000
commit79c9d238ef385c5610fa6235b20b3d65690c10b8 (patch)
tree4ea92f6fb28e21325b661fae4fe0f64c43914f16 /main/musl
parentd4c94d84fa09bdd58fc0413a958966caa13c5f84 (diff)
downloadaports-79c9d238ef385c5610fa6235b20b3d65690c10b8.tar.bz2
aports-79c9d238ef385c5610fa6235b20b3d65690c10b8.tar.xz
main/musl: fix fstat et al to return EBADF properly
this fixes the one failing test case of perl-io-async.
Diffstat (limited to 'main/musl')
-rw-r--r--main/musl/0002-fix-hangs-in-localtime-for-near-overflowing-time_t.patch (renamed from main/musl/1006-fix-hangs-in-localtime-for-near-overflowing-time_t.patch)0
-rw-r--r--main/musl/0003-fix-failure-of-fchmod-fstat-fchdir-and-fchown-to-pro.patch116
-rw-r--r--main/musl/APKBUILD14
3 files changed, 125 insertions, 5 deletions
diff --git a/main/musl/1006-fix-hangs-in-localtime-for-near-overflowing-time_t.patch b/main/musl/0002-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
index a9f2e8e991..a9f2e8e991 100644
--- a/main/musl/1006-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
+++ b/main/musl/0002-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
diff --git a/main/musl/0003-fix-failure-of-fchmod-fstat-fchdir-and-fchown-to-pro.patch b/main/musl/0003-fix-failure-of-fchmod-fstat-fchdir-and-fchown-to-pro.patch
new file mode 100644
index 0000000000..f62d5ac6c4
--- /dev/null
+++ b/main/musl/0003-fix-failure-of-fchmod-fstat-fchdir-and-fchown-to-pro.patch
@@ -0,0 +1,116 @@
+From 65ea604c74f3fecbc61a266a22fdf527764995b6 Mon Sep 17 00:00:00 2001
+From: Rich Felker <dalias@aerifal.cx>
+Date: Thu, 19 Dec 2013 14:24:55 -0500
+Subject: [PATCH 1/1] fix failure of fchmod, fstat, fchdir, and fchown to
+ produce EBADF
+
+the workaround/fallback code for supporting O_PATH file descriptors
+when the kernel lacks support for performing these operations on them
+caused EBADF to get replaced by ENOENT (due to missing entry in
+/proc/self/fd). this is unlikely to affect real-world code (calls that
+might yield EBADF are generally unsafe, especially in library code)
+but it was breaking some test cases.
+
+the fix I've applied is something of a tradeoff: it adds one syscall
+to these operations on kernels where the workaround is needed. the
+alternative would be to catch ENOENT from the /proc lookup and
+translate it to EBADF, but I want to avoid doing that in the interest
+of not touching/depending on /proc at all in these functions as long
+as the kernel correctly supports the operations. this is following the
+general principle of isolating hacks to code paths that are taken on
+broken systems, and keeping the code for correct systems completely
+hack-free.
+---
+ src/stat/fchmod.c | 4 +++-
+ src/stat/fstat.c | 4 +++-
+ src/unistd/fchdir.c | 4 +++-
+ src/unistd/fchown.c | 4 +++-
+ 4 files changed, 12 insertions(+), 4 deletions(-)
+
+diff --git a/src/stat/fchmod.c b/src/stat/fchmod.c
+index 1b943d4..6d28141 100644
+--- a/src/stat/fchmod.c
++++ b/src/stat/fchmod.c
+@@ -1,5 +1,6 @@
+ #include <sys/stat.h>
+ #include <errno.h>
++#include <fcntl.h>
+ #include "syscall.h"
+
+ void __procfdname(char *, unsigned);
+@@ -7,7 +8,8 @@ void __procfdname(char *, unsigned);
+ int fchmod(int fd, mode_t mode)
+ {
+ int ret = __syscall(SYS_fchmod, fd, mode);
+- if (ret != -EBADF || fd < 0) return __syscall_ret(ret);
++ if (ret != -EBADF || __syscall(SYS_fcntl, fd, F_GETFD) < 0)
++ return __syscall_ret(ret);
+
+ char buf[15+3*sizeof(int)];
+ __procfdname(buf, fd);
+diff --git a/src/stat/fstat.c b/src/stat/fstat.c
+index 29b4243..b561176 100644
+--- a/src/stat/fstat.c
++++ b/src/stat/fstat.c
+@@ -1,5 +1,6 @@
+ #include <sys/stat.h>
+ #include <errno.h>
++#include <fcntl.h>
+ #include "syscall.h"
+ #include "libc.h"
+
+@@ -8,7 +9,8 @@ void __procfdname(char *, unsigned);
+ int fstat(int fd, struct stat *st)
+ {
+ int ret = __syscall(SYS_fstat, fd, st);
+- if (ret != -EBADF || fd < 0) return __syscall_ret(ret);
++ if (ret != -EBADF || __syscall(SYS_fcntl, fd, F_GETFD) < 0)
++ return __syscall_ret(ret);
+
+ char buf[15+3*sizeof(int)];
+ __procfdname(buf, fd);
+diff --git a/src/unistd/fchdir.c b/src/unistd/fchdir.c
+index 9fbc815..72c3915 100644
+--- a/src/unistd/fchdir.c
++++ b/src/unistd/fchdir.c
+@@ -1,5 +1,6 @@
+ #include <unistd.h>
+ #include <errno.h>
++#include <fcntl.h>
+ #include "syscall.h"
+
+ void __procfdname(char *, unsigned);
+@@ -7,7 +8,8 @@ void __procfdname(char *, unsigned);
+ int fchdir(int fd)
+ {
+ int ret = __syscall(SYS_fchdir, fd);
+- if (ret != -EBADF || fd < 0) return __syscall_ret(ret);
++ if (ret != -EBADF || __syscall(SYS_fcntl, fd, F_GETFD) < 0)
++ return __syscall_ret(ret);
+
+ char buf[15+3*sizeof(int)];
+ __procfdname(buf, fd);
+diff --git a/src/unistd/fchown.c b/src/unistd/fchown.c
+index e1c3198..36633b0 100644
+--- a/src/unistd/fchown.c
++++ b/src/unistd/fchown.c
+@@ -1,5 +1,6 @@
+ #include <unistd.h>
+ #include <errno.h>
++#include <fcntl.h>
+ #include "syscall.h"
+
+ void __procfdname(char *, unsigned);
+@@ -7,7 +8,8 @@ void __procfdname(char *, unsigned);
+ int fchown(int fd, uid_t uid, gid_t gid)
+ {
+ int ret = __syscall(SYS_fchown, fd, uid, gid);
+- if (ret != -EBADF || fd < 0) return __syscall_ret(ret);
++ if (ret != -EBADF || __syscall(SYS_fcntl, fd, F_GETFD) < 0)
++ return __syscall_ret(ret);
+
+ char buf[15+3*sizeof(int)];
+ __procfdname(buf, fd);
+--
+1.8.5.1
+
diff --git a/main/musl/APKBUILD b/main/musl/APKBUILD
index dff57807b1..a9065b9c01 100644
--- a/main/musl/APKBUILD
+++ b/main/musl/APKBUILD
@@ -2,7 +2,7 @@
# Maintainer: Timo Teräs <timo.teras@iki.fi>
pkgname=musl
pkgver=0.9.14
-pkgrel=10
+pkgrel=11
pkgdesc="the musl c library (libc) implementation"
url="http://www.musl-libc.org/"
arch="all"
@@ -15,13 +15,14 @@ subpackages="$pkgname-dev $pkgname-utils"
[ "${CTARGET#*musl}" = "$CTARGET" ] && subpackages="$subpackages musl-gcc:crosstool"
source="http://www.musl-libc.org/releases/musl-$pkgver.tar.gz
0001-updates-from-git.patch
+ 0002-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
+ 0003-fix-failure-of-fchmod-fstat-fchdir-and-fchown-to-pro.patch
1001-add-basic-dns-record-parsing-functions.patch
1002-add-sys-quota.h-and-quotactl-syscall-wrapper.patch
1003-add-netinet-igmp.h-and-multicast-groups-to-netinet-i.patch
1004-define-and-implement-herror.patch
1005-add-TCP_INFO-and-TCP_MD5SIG-socket-option-related-st.patch
- 1006-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
2001-workaround-gcc-pr58245.patch
@@ -116,12 +117,13 @@ crosstool() {
md5sums="bfb685695aa942e64c63170589e575b2 musl-0.9.14.tar.gz
de075c4b6ff2bf406f437d100f06c6bd 0001-updates-from-git.patch
+6cb4691d52d1567346e648567df283de 0002-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
+1190ec4f2310129c5363dd4eae29a72c 0003-fix-failure-of-fchmod-fstat-fchdir-and-fchown-to-pro.patch
a3810683ef61ac27e2f6ec9801280c81 1001-add-basic-dns-record-parsing-functions.patch
06a67be89404258c321c08348cb547ce 1002-add-sys-quota.h-and-quotactl-syscall-wrapper.patch
bb7b6eb67c1749943f378c88acc48e5c 1003-add-netinet-igmp.h-and-multicast-groups-to-netinet-i.patch
fcf15ee683ea241ad26330c28934fa27 1004-define-and-implement-herror.patch
e46d5241827593673a3d8f1a6b8bacdc 1005-add-TCP_INFO-and-TCP_MD5SIG-socket-option-related-st.patch
-6cb4691d52d1567346e648567df283de 1006-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
7a09c5cd7b3e9532e6902f54a5e928bb 2001-workaround-gcc-pr58245.patch
61c6c1e84ed1df82abbe6d75e90cf21c getopt_long.c
0df687757221bbb0fc1aa67f1bd646f9 __stack_chk_fail_local.c
@@ -129,12 +131,13 @@ ef81489a6258501cf45db58dfc6d5211 getent
33e4fd94e2560e008e2c3b431d0e3419 ldconfig"
sha256sums="982e9de1287cf95f9aa526adba008660d8885bfccc41faf5c613ea47f1922872 musl-0.9.14.tar.gz
d8e303e61f2cc220ce2b7ffd992d37406b87dd2a4062f61f5de3e0df144227b0 0001-updates-from-git.patch
+3efe2d67f6e1601dd1c946f79e142dc1c4aeb8f1d3256bf48dec2057a506d5fe 0002-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
+027720d36cbca364690f5eaae5dcf7efef74b8eae784e8a048fd46a4f2732329 0003-fix-failure-of-fchmod-fstat-fchdir-and-fchown-to-pro.patch
758390768b1bc4159d56908ca332b9640cd0552ed3b4b2b8d4a6d499c54c11a1 1001-add-basic-dns-record-parsing-functions.patch
4ef5ae263b55c0c691c5fb212bcdaa2050091e6acfa2a6dffc597db9743b8c53 1002-add-sys-quota.h-and-quotactl-syscall-wrapper.patch
f57dee5a9309055b298056e4d4107c67e3b0d5f164ab277ffcb353fb1688a2d2 1003-add-netinet-igmp.h-and-multicast-groups-to-netinet-i.patch
995d3e6a7013f220cf3fdeae7ebfd84a1dc2517ebf53e712ab10c8b379e8ac9e 1004-define-and-implement-herror.patch
2fb0f1b6f7f0092f5f8f144cede321ad375379e93805440af538d2be846d0c24 1005-add-TCP_INFO-and-TCP_MD5SIG-socket-option-related-st.patch
-3efe2d67f6e1601dd1c946f79e142dc1c4aeb8f1d3256bf48dec2057a506d5fe 1006-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
45d6efda7450809e4e68f6e951431dcadf6cb7f0260930d50a9f1a8667aca49f 2001-workaround-gcc-pr58245.patch
d9b644ec20bc33e81a7c52b9fcf7973d835923a69faf50f03db45534b811bd96 getopt_long.c
299a7d75a09de3e2e11e7fb4acc3182e4a14e868093d2f30938fce9bfcff13da __stack_chk_fail_local.c
@@ -142,12 +145,13 @@ d6996273f5aaaed429058257e4646b243d9e3a4d8609522f802762453f5be4cb getent
306c6ca7407560340797866e077e053627ad409277d1b9da58106fce4cf717cb ldconfig"
sha512sums="e5c3f7b1549dc2f9cbd3359cc413f761d5967607c23705f651c33d0ae93f00582193a41fe1f87158467d58d8eba2d7c09e0fe2f2b2c02c1dda78eee1a4cecff6 musl-0.9.14.tar.gz
1f93d537e707c60f53823419477fd9165e0aa8b6b28c6b95b80222c943b572029dcdaec2c1bb34e20e5c8c73c6869b89f5bea5b99f401db64d0a4c00abc4b092 0001-updates-from-git.patch
+0ffe19fad7a8c572cd9f8a5bb7dec02fe9ac9555a09f74008fa7d7741e76a969e087670f132038c2a238b523b8c636bbc82e1f29db6b77b195d7b3b8efd90137 0002-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
+7c50c54c2fea33ff2a217eaf145bfc38524afcc7ca43d50463c89741b4d966bb77c6ca53ccc1752b08b6d92b2a53996b730a222d355d68bcd8df8b66b5ed8e32 0003-fix-failure-of-fchmod-fstat-fchdir-and-fchown-to-pro.patch
dad965258daf69371b844f76bfe5a914b0eca0ca76f3fc340b8fd7acf598b5f87bbe6d68b1f43ed0293ee0ed3bfd85d5173ccc169aa6265646248d5b8a906708 1001-add-basic-dns-record-parsing-functions.patch
c64a8c5fa7f0ad095e9281cf23eeed70f476adadb044eb8ac8e038153fd19accf601d82cf89dc289c933b7cbfce3e59ba6c03fa5f7a3a63038905453b5b152a1 1002-add-sys-quota.h-and-quotactl-syscall-wrapper.patch
a8bb390658552b766c1d92cf261bc77bd2369cd185d9803f2ba0265713de16f812dfe916a4d1b428bf5073848741800d856571009042e7514098344d31751f45 1003-add-netinet-igmp.h-and-multicast-groups-to-netinet-i.patch
c510abb133aedc25a421837ee9e8e02d22d512fab2534d7ac612c2df1df28484d4a7e9ccef0ceec85ba2fb27ecea916d242dfbfff13159d22c4da4757a06e4f5 1004-define-and-implement-herror.patch
a6bd33dcd80a525b9aacb5947ed294fd67148b83c02b139dcb8af39aaff0a27964aa6a640b07331d0f433df22ca3f177d7422b61917d42307cefddf7352002e5 1005-add-TCP_INFO-and-TCP_MD5SIG-socket-option-related-st.patch
-0ffe19fad7a8c572cd9f8a5bb7dec02fe9ac9555a09f74008fa7d7741e76a969e087670f132038c2a238b523b8c636bbc82e1f29db6b77b195d7b3b8efd90137 1006-fix-hangs-in-localtime-for-near-overflowing-time_t.patch
69ad3fc851b44f33dd7c98b83fd0adbd149b37263d17b989f4d7338ee0703dfe8994f4299744e2509492300227d652de6f21b6cdba9b633fcefd3d9f7ca0cf20 2001-workaround-gcc-pr58245.patch
140f3f20d30bd95ebce8c41b8cc7f616c6cbedf4ea06c729c21014e74f6043796825cc40ebc5180620ea38173afdba23f09ebf6d8b11fa05440b14d23764fca9 getopt_long.c
062bb49fa54839010acd4af113e20f7263dde1c8a2ca359b5fb2661ef9ed9d84a0f7c3bc10c25dcfa10bb3c5a4874588dff636ac43d5dbb3d748d75400756d0b __stack_chk_fail_local.c