diff options
author | Natanael Copa <ncopa@alpinelinux.org> | 2011-03-07 13:33:07 +0000 |
---|---|---|
committer | Natanael Copa <ncopa@alpinelinux.org> | 2011-03-07 13:33:07 +0000 |
commit | a30ea77040d83e7e78d28320fdd9efb83d38e0e9 (patch) | |
tree | 58f26b3fa595395e33276d0eece61e1fc5269bfb | |
parent | d84804f0e266076836b9597718740b1914de0d38 (diff) | |
download | alpine_aports-a30ea77040d83e7e78d28320fdd9efb83d38e0e9.tar.bz2 alpine_aports-a30ea77040d83e7e78d28320fdd9efb83d38e0e9.tar.xz alpine_aports-a30ea77040d83e7e78d28320fdd9efb83d38e0e9.zip |
main/apk-tools: backport 2.0.9
-rw-r--r-- | main/apk-tools/0001-gunzip-fix-ordering-of-boundary-callbacks.patch | 81 | ||||
-rw-r--r-- | main/apk-tools/APKBUILD | 8 |
2 files changed, 3 insertions, 86 deletions
diff --git a/main/apk-tools/0001-gunzip-fix-ordering-of-boundary-callbacks.patch b/main/apk-tools/0001-gunzip-fix-ordering-of-boundary-callbacks.patch deleted file mode 100644 index 0cbebfcd2f..0000000000 --- a/main/apk-tools/0001-gunzip-fix-ordering-of-boundary-callbacks.patch +++ /dev/null | |||
@@ -1,81 +0,0 @@ | |||
1 | From f126316c791371bd3dfd7c348b10e93e49f5e2d4 Mon Sep 17 00:00:00 2001 | ||
2 | From: =?UTF-8?q?Timo=20Ter=C3=A4s?= <timo.teras@iki.fi> | ||
3 | Date: Fri, 17 Dec 2010 09:36:19 +0200 | ||
4 | Subject: [PATCH] gunzip: fix ordering of boundary callbacks | ||
5 | |||
6 | The boundary callback should not happen until all the uncompressed | ||
7 | data has been consumed. This previously seems to have worked | ||
8 | because normally gzip library returns "no error" instead of the | ||
9 | "stream end" if we extract exactly the amount of bytes remaining | ||
10 | in the archive. (Perhaps this was changed in new zlib.) In any | ||
11 | case, verification was broken with some apks due to this callback | ||
12 | ordering issue. | ||
13 | --- | ||
14 | src/gunzip.c | 32 ++++++++++++++++++++++++-------- | ||
15 | 1 files changed, 24 insertions(+), 8 deletions(-) | ||
16 | |||
17 | diff --git a/src/gunzip.c b/src/gunzip.c | ||
18 | index aebaf76..df2bbbb 100644 | ||
19 | --- a/src/gunzip.c | ||
20 | +++ b/src/gunzip.c | ||
21 | @@ -27,6 +27,7 @@ struct apk_gzip_istream { | ||
22 | apk_multipart_cb cb; | ||
23 | void *cbctx; | ||
24 | void *cbprev; | ||
25 | + apk_blob_t cbarg; | ||
26 | }; | ||
27 | |||
28 | static ssize_t gzi_read(void *stream, void *ptr, size_t size) | ||
29 | @@ -48,6 +49,18 @@ static ssize_t gzi_read(void *stream, void *ptr, size_t size) | ||
30 | gis->zs.next_out = ptr; | ||
31 | |||
32 | while (gis->zs.avail_out != 0 && gis->err == 0) { | ||
33 | + if (!APK_BLOB_IS_NULL(gis->cbarg)) { | ||
34 | + r = gis->cb(gis->cbctx, | ||
35 | + gis->err ? APK_MPART_END : APK_MPART_BOUNDARY, | ||
36 | + gis->cbarg); | ||
37 | + if (r > 0) | ||
38 | + r = -ECANCELED; | ||
39 | + if (r != 0) { | ||
40 | + gis->err = r; | ||
41 | + goto ret; | ||
42 | + } | ||
43 | + gis->cbarg = APK_BLOB_NULL; | ||
44 | + } | ||
45 | if (gis->zs.avail_in == 0) { | ||
46 | apk_blob_t blob; | ||
47 | |||
48 | @@ -86,19 +99,22 @@ static ssize_t gzi_read(void *stream, void *ptr, size_t size) | ||
49 | gis->zs.avail_in == 0) | ||
50 | gis->err = 1; | ||
51 | if (gis->cb != NULL) { | ||
52 | + gis->cbarg = APK_BLOB_PTR_LEN(gis->cbprev, (void *) gis->zs.next_in - gis->cbprev); | ||
53 | + gis->cbprev = gis->zs.next_in; | ||
54 | + } | ||
55 | + /* If we hit end of the bitstream (not end | ||
56 | + * of just this gzip), we need to do the | ||
57 | + * callback here, as we won't be called again. | ||
58 | + * For boundaries it should be postponed to not | ||
59 | + * be called until next gzip read is started. */ | ||
60 | + if (gis->err) { | ||
61 | r = gis->cb(gis->cbctx, | ||
62 | gis->err ? APK_MPART_END : APK_MPART_BOUNDARY, | ||
63 | - APK_BLOB_PTR_LEN(gis->cbprev, (void *) gis->zs.next_in - gis->cbprev)); | ||
64 | + gis->cbarg); | ||
65 | if (r > 0) | ||
66 | r = -ECANCELED; | ||
67 | - if (r != 0) { | ||
68 | - gis->err = r; | ||
69 | - goto ret; | ||
70 | - } | ||
71 | - gis->cbprev = gis->zs.next_in; | ||
72 | - } | ||
73 | - if (gis->err) | ||
74 | goto ret; | ||
75 | + } | ||
76 | inflateEnd(&gis->zs); | ||
77 | if (inflateInit2(&gis->zs, 15+32) != Z_OK) | ||
78 | return -ENOMEM; | ||
79 | -- | ||
80 | 1.7.3.3 | ||
81 | |||
diff --git a/main/apk-tools/APKBUILD b/main/apk-tools/APKBUILD index 46f7c8952b..ac13df71f5 100644 --- a/main/apk-tools/APKBUILD +++ b/main/apk-tools/APKBUILD | |||
@@ -1,13 +1,12 @@ | |||
1 | # Maintainer: Natanael Copa <ncopa@alpinelinux.org> | 1 | # Maintainer: Natanael Copa <ncopa@alpinelinux.org> |
2 | pkgname=apk-tools | 2 | pkgname=apk-tools |
3 | pkgver=2.0.7 | 3 | pkgver=2.0.9 |
4 | pkgrel=2 | 4 | pkgrel=0 |
5 | pkgdesc="Alpine Package Keeper - package manager for alpine" | 5 | pkgdesc="Alpine Package Keeper - package manager for alpine" |
6 | subpackages="$pkgname-static" | 6 | subpackages="$pkgname-static" |
7 | depends= | 7 | depends= |
8 | makedepends="zlib-dev openssl-dev pkgconfig" | 8 | makedepends="zlib-dev openssl-dev pkgconfig" |
9 | source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 | 9 | source="http://git.alpinelinux.org/cgit/$pkgname/snapshot/$pkgname-$pkgver.tar.bz2 |
10 | 0001-gunzip-fix-ordering-of-boundary-callbacks.patch | ||
11 | " | 10 | " |
12 | 11 | ||
13 | url="http://git.alpinelinux.org/cgit/apk-tools/" | 12 | url="http://git.alpinelinux.org/cgit/apk-tools/" |
@@ -48,5 +47,4 @@ static() { | |||
48 | "$subpkgdir"/sbin/apk.static | 47 | "$subpkgdir"/sbin/apk.static |
49 | } | 48 | } |
50 | 49 | ||
51 | md5sums="3c4591c594f9b2261ab588446a50d183 apk-tools-2.0.7.tar.bz2 | 50 | md5sums="3c9c114ffc01bf5752d28b3213484563 apk-tools-2.0.9.tar.bz2" |
52 | 1ef0ab58cf611c1172e6053a96c46d19 0001-gunzip-fix-ordering-of-boundary-callbacks.patch" | ||