diff options
3 files changed, 137 insertions, 33 deletions
diff --git a/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch b/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch index 851fe57569..a575d0ebce 100644 --- a/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch +++ b/meta/recipes-extended/libsolv/libsolv/0001-Add-fallback-fopencookie-implementation.patch | |||
| @@ -1,25 +1,24 @@ | |||
| 1 | From 0a8e50f7322832efdaf33da87839fbba05a755de Mon Sep 17 00:00:00 2001 | 1 | From 4d9b6ec30b78d00ead0a22eb5d047dcdba37e99c Mon Sep 17 00:00:00 2001 |
| 2 | From: "Maxin B. John" <maxin.john@intel.com> | 2 | From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?= |
| 3 | Date: Mon, 21 Nov 2016 11:46:00 +0200 | 3 | =?UTF-8?q?=E3=82=B3=E3=82=99=E3=83=B3=E3=83=8F=E3=82=9A=29?= |
| 4 | Subject: [PATCH] Add fallback fopencookie() implementation | 4 | <ngompa13@gmail.com> |
| 5 | MIME-Version: 1.0 | 5 | Date: Wed, 11 Nov 2015 20:32:17 -0500 |
| 6 | Content-Type: text/plain; charset=UTF-8 | 6 | Subject: [PATCH 1/2] Add fallback fopencookie() implementation |
| 7 | Content-Transfer-Encoding: 8bit | ||
| 8 | 7 | ||
| 9 | In environments where neither fopencookie() nor funopen() | 8 | In environments where neither fopencookie() nor funopen() |
| 10 | are implemented, we need to provide a suitable implementation | 9 | are implemented, we need to provide a suitable implementation |
| 11 | of fopencookie() that we can use. | 10 | of fopencookie() that we can use. |
| 12 | 11 | ||
| 13 | Upstream-Status: Denied [ https://github.com/openSUSE/libsolv/pull/112 ] | 12 | Alex Kanavin: rebased CMakeLists.txt change to apply to latest upstream code. |
| 14 | 13 | ||
| 15 | Signed-off-by: Neal Gompa (ニール・ゴンパ) <ngompa13@gmail.com> | 14 | Upstream-Status: Denied [https://github.com/openSUSE/libsolv/pull/112] |
| 16 | Signed-off-by: Maxin B. John <maxin.john@intel.com> | 15 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> |
| 17 | --- | 16 | --- |
| 18 | ext/CMakeLists.txt | 7 ++ | 17 | ext/CMakeLists.txt | 7 ++ |
| 19 | ext/solv_xfopen.c | 10 +-- | 18 | ext/solv_xfopen.c | 10 +-- |
| 20 | ext/solv_xfopen_fallback_fopencookie.c | 124 +++++++++++++++++++++++++++++++++ | 19 | ext/solv_xfopen_fallback_fopencookie.c | 123 +++++++++++++++++++++++++++++++++ |
| 21 | ext/solv_xfopen_fallback_fopencookie.h | 28 ++++++++ | 20 | ext/solv_xfopen_fallback_fopencookie.h | 28 ++++++++ |
| 22 | 4 files changed, 165 insertions(+), 4 deletions(-) | 21 | 4 files changed, 164 insertions(+), 4 deletions(-) |
| 23 | create mode 100644 ext/solv_xfopen_fallback_fopencookie.c | 22 | create mode 100644 ext/solv_xfopen_fallback_fopencookie.c |
| 24 | create mode 100644 ext/solv_xfopen_fallback_fopencookie.h | 23 | create mode 100644 ext/solv_xfopen_fallback_fopencookie.h |
| 25 | 24 | ||
| @@ -85,17 +84,17 @@ index b0421bf..31345dd 100644 | |||
| 85 | 84 | ||
| 86 | diff --git a/ext/solv_xfopen_fallback_fopencookie.c b/ext/solv_xfopen_fallback_fopencookie.c | 85 | diff --git a/ext/solv_xfopen_fallback_fopencookie.c b/ext/solv_xfopen_fallback_fopencookie.c |
| 87 | new file mode 100644 | 86 | new file mode 100644 |
| 88 | index 0000000..89426a9 | 87 | index 0000000..0ce2571 |
| 89 | --- /dev/null | 88 | --- /dev/null |
| 90 | +++ b/ext/solv_xfopen_fallback_fopencookie.c | 89 | +++ b/ext/solv_xfopen_fallback_fopencookie.c |
| 91 | @@ -0,0 +1,124 @@ | 90 | @@ -0,0 +1,123 @@ |
| 92 | +/* | 91 | +/* |
| 93 | + * Provides a very limited fopencookie() for environments with a libc | 92 | + * Provides a very limited fopencookie() for environments with a libc |
| 94 | + * that lacks it. | 93 | + * that lacks it. |
| 95 | + * | 94 | + * |
| 96 | + * Authors: zhasha & nsz | 95 | + * Author: zhasha |
| 97 | + * Modified for libsolv by Neal Gompa | 96 | + * Modified for libsolv by Neal Gompa |
| 98 | + * | 97 | + * |
| 99 | + * This program is licensed under the BSD license, read LICENSE.BSD | 98 | + * This program is licensed under the BSD license, read LICENSE.BSD |
| 100 | + * for further information. | 99 | + * for further information. |
| 101 | + * | 100 | + * |
| @@ -124,7 +123,7 @@ index 0000000..89426a9 | |||
| 124 | +{ | 123 | +{ |
| 125 | + struct ctx *ctx = arg; | 124 | + struct ctx *ctx = arg; |
| 126 | + ssize_t r; | 125 | + ssize_t r; |
| 127 | + size_t n, k; | 126 | + size_t n; |
| 128 | + | 127 | + |
| 129 | + pthread_detach(pthread_self()); | 128 | + pthread_detach(pthread_self()); |
| 130 | + | 129 | + |
| @@ -138,18 +137,17 @@ index 0000000..89426a9 | |||
| 138 | + } | 137 | + } |
| 139 | + if (r == 0) { break; } | 138 | + if (r == 0) { break; } |
| 140 | + | 139 | + |
| 141 | + n = r, k = 0; | ||
| 142 | + while (n > 0) { | 140 | + while (n > 0) { |
| 143 | + r = ctx->io.write ? | 141 | + r = ctx->io.write ? |
| 144 | + (ctx->io.write)(ctx->cookie, ctx->buf + k, n) : | 142 | + (ctx->io.write)(ctx->cookie, ctx->buf + ((size_t)r - n), n) : |
| 145 | + write(ctx->fd, ctx->buf + k, n); | 143 | + write(ctx->fd, ctx->buf + ((size_t)r - n), n); |
| 146 | + if (r < 0) { | 144 | + if (r < 0) { |
| 147 | + if (errno != EINTR) { break; } | 145 | + if (errno != EINTR) { break; } |
| 148 | + continue; | 146 | + continue; |
| 149 | + } | 147 | + } |
| 150 | + if (r == 0) { break; } | 148 | + if (r == 0) { break; } |
| 151 | + | 149 | + |
| 152 | + n -= r, k += r; | 150 | + n -= (size_t)r; |
| 153 | + } | 151 | + } |
| 154 | + if (n > 0) { break; } | 152 | + if (n > 0) { break; } |
| 155 | + } | 153 | + } |
| @@ -169,8 +167,8 @@ index 0000000..89426a9 | |||
| 169 | + | 167 | + |
| 170 | + switch (mode[0]) { | 168 | + switch (mode[0]) { |
| 171 | + case 'a': | 169 | + case 'a': |
| 172 | + case 'w': wr = 1; break; | ||
| 173 | + case 'r': rd = 1; break; | 170 | + case 'r': rd = 1; break; |
| 171 | + case 'w': wr = 1; break; | ||
| 174 | + default: | 172 | + default: |
| 175 | + errno = EINVAL; | 173 | + errno = EINVAL; |
| 176 | + return NULL; | 174 | + return NULL; |
| @@ -215,20 +213,20 @@ index 0000000..89426a9 | |||
| 215 | +} | 213 | +} |
| 216 | diff --git a/ext/solv_xfopen_fallback_fopencookie.h b/ext/solv_xfopen_fallback_fopencookie.h | 214 | diff --git a/ext/solv_xfopen_fallback_fopencookie.h b/ext/solv_xfopen_fallback_fopencookie.h |
| 217 | new file mode 100644 | 215 | new file mode 100644 |
| 218 | index 0000000..7223e3f | 216 | index 0000000..6a7bfee |
| 219 | --- /dev/null | 217 | --- /dev/null |
| 220 | +++ b/ext/solv_xfopen_fallback_fopencookie.h | 218 | +++ b/ext/solv_xfopen_fallback_fopencookie.h |
| 221 | @@ -0,0 +1,28 @@ | 219 | @@ -0,0 +1,28 @@ |
| 222 | +/* | 220 | +/* |
| 223 | + * Provides a very limited fopencookie() for environments with a libc | 221 | + * Provides a very limited fopencookie() for environments with a libc |
| 224 | + * that lacks it. | 222 | + * that lacks it. |
| 225 | + * | 223 | + * |
| 226 | + * Authors: zhasha & nsz | 224 | + * Author: zhasha |
| 227 | + * Modified for libsolv by Neal Gompa | 225 | + * Modified for libsolv by Neal Gompa |
| 228 | + * | 226 | + * |
| 229 | + * This program is licensed under the BSD license, read LICENSE.BSD | 227 | + * This program is licensed under the BSD license, read LICENSE.BSD |
| 230 | + * for further information. | 228 | + * for further information. |
| 231 | + * | 229 | + * |
| 232 | + */ | 230 | + */ |
| 233 | + | 231 | + |
| 234 | +#ifndef SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H | 232 | +#ifndef SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H |
| @@ -248,5 +246,5 @@ index 0000000..7223e3f | |||
| 248 | + | 246 | + |
| 249 | +#endif | 247 | +#endif |
| 250 | -- | 248 | -- |
| 251 | 2.4.0 | 249 | 2.11.0 |
| 252 | 250 | ||
diff --git a/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch b/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch new file mode 100644 index 0000000000..efb4e3ad7e --- /dev/null +++ b/meta/recipes-extended/libsolv/libsolv/0002-Fixes-to-internal-fopencookie-implementation.patch | |||
| @@ -0,0 +1,104 @@ | |||
| 1 | From 99b10cdf6a0f8a24e1670c1813b1d9563ae3f5b5 Mon Sep 17 00:00:00 2001 | ||
| 2 | From: =?UTF-8?q?Neal=20Gompa=20=28=E3=83=8B=E3=83=BC=E3=83=AB=E3=83=BB?= | ||
| 3 | =?UTF-8?q?=E3=82=B3=E3=82=99=E3=83=B3=E3=83=8F=E3=82=9A=29?= | ||
| 4 | <ngompa13@gmail.com> | ||
| 5 | Date: Mon, 23 Nov 2015 18:19:41 -0500 | ||
| 6 | Subject: [PATCH 2/2] Fixes to internal fopencookie() implementation | ||
| 7 | |||
| 8 | Credits to the fixes go to nsz on #musl on Freenode, | ||
| 9 | who gloriously fixed the implementation such that | ||
| 10 | the tests all pass. | ||
| 11 | |||
| 12 | Upstream-Status: Denied [https://github.com/openSUSE/libsolv/pull/112] | ||
| 13 | Signed-off-by: Alexander Kanavin <alex.kanavin@gmail.com> | ||
| 14 | --- | ||
| 15 | ext/solv_xfopen_fallback_fopencookie.c | 19 ++++++++++--------- | ||
| 16 | ext/solv_xfopen_fallback_fopencookie.h | 10 +++++----- | ||
| 17 | 2 files changed, 15 insertions(+), 14 deletions(-) | ||
| 18 | |||
| 19 | diff --git a/ext/solv_xfopen_fallback_fopencookie.c b/ext/solv_xfopen_fallback_fopencookie.c | ||
| 20 | index 0ce2571..89426a9 100644 | ||
| 21 | --- a/ext/solv_xfopen_fallback_fopencookie.c | ||
| 22 | +++ b/ext/solv_xfopen_fallback_fopencookie.c | ||
| 23 | @@ -1,10 +1,10 @@ | ||
| 24 | -/* | ||
| 25 | +/* | ||
| 26 | * Provides a very limited fopencookie() for environments with a libc | ||
| 27 | * that lacks it. | ||
| 28 | - * | ||
| 29 | - * Author: zhasha | ||
| 30 | + * | ||
| 31 | + * Authors: zhasha & nsz | ||
| 32 | * Modified for libsolv by Neal Gompa | ||
| 33 | - * | ||
| 34 | + * | ||
| 35 | * This program is licensed under the BSD license, read LICENSE.BSD | ||
| 36 | * for further information. | ||
| 37 | * | ||
| 38 | @@ -33,7 +33,7 @@ static void *proxy(void *arg) | ||
| 39 | { | ||
| 40 | struct ctx *ctx = arg; | ||
| 41 | ssize_t r; | ||
| 42 | - size_t n; | ||
| 43 | + size_t n, k; | ||
| 44 | |||
| 45 | pthread_detach(pthread_self()); | ||
| 46 | |||
| 47 | @@ -47,17 +47,18 @@ static void *proxy(void *arg) | ||
| 48 | } | ||
| 49 | if (r == 0) { break; } | ||
| 50 | |||
| 51 | + n = r, k = 0; | ||
| 52 | while (n > 0) { | ||
| 53 | r = ctx->io.write ? | ||
| 54 | - (ctx->io.write)(ctx->cookie, ctx->buf + ((size_t)r - n), n) : | ||
| 55 | - write(ctx->fd, ctx->buf + ((size_t)r - n), n); | ||
| 56 | + (ctx->io.write)(ctx->cookie, ctx->buf + k, n) : | ||
| 57 | + write(ctx->fd, ctx->buf + k, n); | ||
| 58 | if (r < 0) { | ||
| 59 | if (errno != EINTR) { break; } | ||
| 60 | continue; | ||
| 61 | } | ||
| 62 | if (r == 0) { break; } | ||
| 63 | |||
| 64 | - n -= (size_t)r; | ||
| 65 | + n -= r, k += r; | ||
| 66 | } | ||
| 67 | if (n > 0) { break; } | ||
| 68 | } | ||
| 69 | @@ -77,8 +78,8 @@ FILE *fopencookie(void *cookie, const char *mode, struct cookie_io_functions_t i | ||
| 70 | |||
| 71 | switch (mode[0]) { | ||
| 72 | case 'a': | ||
| 73 | - case 'r': rd = 1; break; | ||
| 74 | case 'w': wr = 1; break; | ||
| 75 | + case 'r': rd = 1; break; | ||
| 76 | default: | ||
| 77 | errno = EINVAL; | ||
| 78 | return NULL; | ||
| 79 | diff --git a/ext/solv_xfopen_fallback_fopencookie.h b/ext/solv_xfopen_fallback_fopencookie.h | ||
| 80 | index 6a7bfee..7223e3f 100644 | ||
| 81 | --- a/ext/solv_xfopen_fallback_fopencookie.h | ||
| 82 | +++ b/ext/solv_xfopen_fallback_fopencookie.h | ||
| 83 | @@ -1,13 +1,13 @@ | ||
| 84 | -/* | ||
| 85 | +/* | ||
| 86 | * Provides a very limited fopencookie() for environments with a libc | ||
| 87 | * that lacks it. | ||
| 88 | - * | ||
| 89 | - * Author: zhasha | ||
| 90 | + * | ||
| 91 | + * Authors: zhasha & nsz | ||
| 92 | * Modified for libsolv by Neal Gompa | ||
| 93 | - * | ||
| 94 | + * | ||
| 95 | * This program is licensed under the BSD license, read LICENSE.BSD | ||
| 96 | * for further information. | ||
| 97 | - * | ||
| 98 | + * | ||
| 99 | */ | ||
| 100 | |||
| 101 | #ifndef SOLV_XFOPEN_FALLBACK_FOPENCOOKIE_H | ||
| 102 | -- | ||
| 103 | 2.11.0 | ||
| 104 | |||
diff --git a/meta/recipes-extended/libsolv/libsolv_0.6.26.bb b/meta/recipes-extended/libsolv/libsolv_0.6.26.bb index c90f5834f5..42d63aeb13 100644 --- a/meta/recipes-extended/libsolv/libsolv_0.6.26.bb +++ b/meta/recipes-extended/libsolv/libsolv_0.6.26.bb | |||
| @@ -8,8 +8,10 @@ LIC_FILES_CHKSUM = "file://LICENSE.BSD;md5=62272bd11c97396d4aaf1c41bc11f7d8" | |||
| 8 | DEPENDS = "expat zlib rpm" | 8 | DEPENDS = "expat zlib rpm" |
| 9 | 9 | ||
| 10 | SRC_URI = "git://github.com/openSUSE/libsolv.git \ | 10 | SRC_URI = "git://github.com/openSUSE/libsolv.git \ |
| 11 | " | 11 | " |
| 12 | SRC_URI_append_libc-musl = " file://0001-Add-fallback-fopencookie-implementation.patch" | 12 | SRC_URI_append_libc-musl = " file://0001-Add-fallback-fopencookie-implementation.patch \ |
| 13 | file://0002-Fixes-to-internal-fopencookie-implementation.patch \ | ||
| 14 | " | ||
| 13 | 15 | ||
| 14 | SRCREV = "ba32f8286d3deec6faaabc79762a4760e9af0a07" | 16 | SRCREV = "ba32f8286d3deec6faaabc79762a4760e9af0a07" |
| 15 | UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)" | 17 | UPSTREAM_CHECK_GITTAGREGEX = "(?P<pver>\d+(\.\d+)+)" |
