]>
Commit | Line | Data |
---|---|---|
1262d358 DK |
1 | #!/bin/sh |
2 | set -e | |
3 | ||
3abb6a6a DK |
4 | TESTDIR="$(readlink -f "$(dirname "$0")")" |
5 | . "$TESTDIR/framework" | |
1262d358 DK |
6 | |
7 | setupenvironment | |
8 | configarchitecture 'native' | |
9 | ||
10 | cat > aptarchive/Sources <<EOF | |
11 | Package: pkg-md5-ok | |
12 | Binary: pkg-md5-ok | |
13 | Version: 1.0 | |
14 | Maintainer: Joe Sixpack <joe@example.org> | |
15 | Architecture: all | |
16 | Files: | |
895417ef DK |
17 | 9604ba9427a280db542279d9ed78400b 3 pkg-md5-ok_1.0.dsc |
18 | db5570bf61464b46e2bde31ed61a7dc6 3 pkg-md5-ok_1.0.tar.gz | |
1262d358 | 19 | |
51c04562 JAK |
20 | Package: pkg-sha1-ok |
21 | Binary: pkg-sha1-ok | |
22 | Version: 1.0 | |
23 | Maintainer: Joe Sixpack <joe@example.org> | |
24 | Architecture: all | |
25 | Files: | |
26 | 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-sha1-ok_1.0.dsc | |
27 | 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-sha1-ok_1.0.tar.gz | |
28 | ||
1262d358 DK |
29 | Package: pkg-sha256-ok |
30 | Binary: pkg-sha256-ok | |
31 | Version: 1.0 | |
32 | Maintainer: Joe Sixpack <joe@example.org> | |
33 | Architecture: all | |
34 | Files: | |
895417ef DK |
35 | 9604ba9427a280db542279d9ed78400b 3 pkg-sha256-ok_1.0.dsc |
36 | db5570bf61464b46e2bde31ed61a7dc6 3 pkg-sha256-ok_1.0.tar.gz | |
1262d358 | 37 | Checksums-Sha1: |
895417ef DK |
38 | 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-sha256-ok_1.0.dsc |
39 | 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-sha256-ok_1.0.tar.gz | |
1262d358 | 40 | Checksums-Sha256: |
895417ef DK |
41 | 943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a 3 pkg-sha256-ok_1.0.dsc |
42 | 90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb 3 pkg-sha256-ok_1.0.tar.gz | |
1262d358 | 43 | |
d4c45145 DK |
44 | Package: pkg-size-bad |
45 | Binary: pkg-size-bad | |
46 | Version: 1.0 | |
47 | Maintainer: Joe Sixpack <joe@example.org> | |
48 | Architecture: all | |
49 | Checksums-Sha256: | |
50 | 943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a 2 pkg-size-bad_1.0.dsc | |
51 | 90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb 4 pkg-size-bad_1.0.tar.gz | |
52 | ||
1262d358 DK |
53 | Package: pkg-sha256-bad |
54 | Binary: pkg-sha256-bad | |
55 | Version: 1.0 | |
56 | Maintainer: Joe Sixpack <joe@example.org> | |
57 | Architecture: all | |
58 | Files: | |
895417ef DK |
59 | 9604ba9427a280db542279d9ed78400b 3 pkg-sha256-bad_1.0.dsc |
60 | db5570bf61464b46e2bde31ed61a7dc6 3 pkg-sha256-bad_1.0.tar.gz | |
1262d358 | 61 | Checksums-Sha1: |
895417ef DK |
62 | 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-sha256-bad_1.0.dsc |
63 | 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-sha256-bad_1.0.tar.gz | |
1262d358 | 64 | Checksums-Sha256: |
895417ef DK |
65 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3 pkg-sha256-bad_1.0.dsc |
66 | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3 pkg-sha256-bad_1.0.tar.gz | |
1262d358 | 67 | |
63d60998 DK |
68 | Package: pkg-md5-bad |
69 | Binary: pkg-md5-bad | |
70 | Version: 1.0 | |
71 | Maintainer: Joe Sixpack <joe@example.org> | |
72 | Architecture: all | |
73 | Files: | |
74 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3 pkg-md5-bad_1.0.dsc | |
75 | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3 pkg-md5-bad_1.0.tar.gz | |
76 | ||
1262d358 DK |
77 | Package: pkg-no-md5 |
78 | Binary: pkg-no-md5 | |
79 | Version: 1.0 | |
80 | Maintainer: Joe Sixpack <joe@example.org> | |
81 | Architecture: all | |
82 | Checksums-Sha1: | |
895417ef DK |
83 | 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-no-md5_1.0.dsc |
84 | 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-no-md5_1.0.tar.gz | |
1262d358 | 85 | Checksums-Sha256: |
895417ef DK |
86 | 943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a 3 pkg-no-md5_1.0.dsc |
87 | 90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb 3 pkg-no-md5_1.0.tar.gz | |
1262d358 DK |
88 | |
89 | Package: pkg-mixed-ok | |
90 | Binary: pkg-mixed-ok | |
91 | Version: 1.0 | |
92 | Maintainer: Joe Sixpack <joe@example.org> | |
93 | Architecture: all | |
94 | Checksums-Sha1: | |
895417ef | 95 | 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-mixed-ok_1.0.tar.gz |
1262d358 | 96 | Checksums-Sha256: |
895417ef | 97 | 943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a 3 pkg-mixed-ok_1.0.dsc |
1262d358 DK |
98 | |
99 | Package: pkg-mixed-sha1-bad | |
100 | Binary: pkg-mixed-sha1-bad | |
101 | Version: 1.0 | |
102 | Maintainer: Joe Sixpack <joe@example.org> | |
103 | Architecture: all | |
104 | Checksums-Sha1: | |
895417ef | 105 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3 pkg-mixed-sha1-bad_1.0.dsc |
1262d358 | 106 | Checksums-Sha256: |
895417ef | 107 | 90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb 3 pkg-mixed-sha1-bad_1.0.tar.gz |
1262d358 DK |
108 | |
109 | Package: pkg-mixed-sha2-bad | |
110 | Binary: pkg-mixed-sha2-bad | |
111 | Version: 1.0 | |
112 | Maintainer: Joe Sixpack <joe@example.org> | |
113 | Architecture: all | |
114 | Checksums-Sha1: | |
895417ef | 115 | 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-mixed-sha2-bad_1.0.dsc |
1262d358 | 116 | Checksums-Sha256: |
895417ef | 117 | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3 pkg-mixed-sha2-bad_1.0.tar.gz |
1262d358 DK |
118 | |
119 | Package: pkg-md5-disagree | |
120 | Binary: pkg-md5-disagree | |
121 | Version: 1.0 | |
122 | Maintainer: Joe Sixpack <joe@example.org> | |
123 | Architecture: all | |
124 | Files: | |
895417ef DK |
125 | 9604ba9427a280db542279d9ed78400b 3 pkg-md5-disagree_1.0.dsc |
126 | db5570bf61464b46e2bde31ed61a7dc6 3 pkg-md5-disagree_1.0.tar.gz | |
127 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3 pkg-md5-disagree_1.0.dsc | |
128 | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3 pkg-md5-disagree_1.0.tar.gz | |
1262d358 DK |
129 | |
130 | Package: pkg-md5-agree | |
131 | Binary: pkg-md5-agree | |
132 | Version: 1.0 | |
133 | Maintainer: Joe Sixpack <joe@example.org> | |
134 | Architecture: all | |
135 | Files: | |
895417ef DK |
136 | 9604ba9427a280db542279d9ed78400b 3 pkg-md5-agree_1.0.dsc |
137 | db5570bf61464b46e2bde31ed61a7dc6 3 pkg-md5-agree_1.0.tar.gz | |
138 | db5570bf61464b46e2bde31ed61a7dc6 3 pkg-md5-agree_1.0.tar.gz | |
139 | 9604ba9427a280db542279d9ed78400b 3 pkg-md5-agree_1.0.dsc | |
1262d358 DK |
140 | |
141 | Package: pkg-sha256-disagree | |
142 | Binary: pkg-sha256-disagree | |
143 | Version: 1.0 | |
144 | Maintainer: Joe Sixpack <joe@example.org> | |
145 | Architecture: all | |
146 | Files: | |
895417ef DK |
147 | 9604ba9427a280db542279d9ed78400b 3 pkg-sha256-disagree_1.0.dsc |
148 | db5570bf61464b46e2bde31ed61a7dc6 3 pkg-sha256-disagree_1.0.tar.gz | |
1262d358 | 149 | Checksums-Sha1: |
895417ef DK |
150 | 324f464e6151a92cf57b26ef95dcfcf2059a8c44 3 pkg-sha256-disagree_1.0.dsc |
151 | 680254bad1d7ca0d65ec46aaa315d363abf6a50a 3 pkg-sha256-disagree_1.0.tar.gz | |
1262d358 | 152 | Checksums-Sha256: |
895417ef DK |
153 | 943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a 3 pkg-sha256-disagree_1.0.dsc |
154 | 90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb 3 pkg-sha256-disagree_1.0.tar.gz | |
155 | aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa 3 pkg-sha256-disagree_1.0.dsc | |
156 | bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb 3 pkg-sha256-disagree_1.0.tar.gz | |
1262d358 DK |
157 | EOF |
158 | ||
159 | # create fetchable files | |
51c04562 | 160 | for x in 'pkg-md5-ok' 'pkg-sha1-ok' 'pkg-sha256-ok' 'pkg-sha256-bad' 'pkg-no-md5' \ |
1262d358 | 161 | 'pkg-mixed-ok' 'pkg-mixed-sha1-bad' 'pkg-mixed-sha2-bad' \ |
63d60998 | 162 | 'pkg-md5-agree' 'pkg-md5-disagree' 'pkg-sha256-disagree' \ |
d4c45145 | 163 | 'pkg-md5-bad' 'pkg-size-bad'; do |
895417ef DK |
164 | echo -n 'dsc' > aptarchive/${x}_1.0.dsc |
165 | echo -n 'tar' > aptarchive/${x}_1.0.tar.gz | |
1262d358 DK |
166 | done |
167 | ||
63d60998 | 168 | setupaptarchive --no-update |
1262d358 DK |
169 | changetowebserver |
170 | testsuccess aptget update | |
171 | ||
03aa0847 DK |
172 | cd downloaded |
173 | ||
1262d358 DK |
174 | testok() { |
175 | rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz | |
25b86db1 | 176 | testsuccessequal "Reading package lists... |
895417ef | 177 | Need to get 6 B of source archives. |
6c0765c0 DK |
178 | Get:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) [3 B] |
179 | Get:2 http://localhost:${APTHTTPPORT} $1 1.0 (tar) [3 B] | |
1262d358 DK |
180 | Download complete and in download only mode" aptget source -d "$@" |
181 | msgtest 'Files were successfully downloaded for' "$1" | |
182 | testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz | |
183 | rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz | |
184 | } | |
185 | ||
186 | testkeep() { | |
895417ef DK |
187 | echo -n 'dsc' > ${1}_1.0.dsc |
188 | echo -n 'tar' > ${1}_1.0.tar.gz | |
25b86db1 | 189 | testsuccessequal "Reading package lists... |
1262d358 DK |
190 | Skipping already downloaded file '${1}_1.0.dsc' |
191 | Skipping already downloaded file '${1}_1.0.tar.gz' | |
192 | Need to get 0 B of source archives. | |
193 | Download complete and in download only mode" aptget source -d "$@" | |
194 | msgtest 'Files already downloaded are kept for' "$1" | |
195 | testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz | |
196 | rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz | |
197 | } | |
198 | ||
63d60998 DK |
199 | testnohash() { |
200 | #FIXME: Maybe we should fail in this case instead of skipping | |
201 | rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz | |
202 | testsuccessequal "Reading package lists... | |
63d60998 DK |
203 | Skipping download of file '${1}_1.0.dsc' as requested hashsum is not available for authentication |
204 | Skipping download of file '${1}_1.0.tar.gz' as requested hashsum is not available for authentication | |
205 | Need to get 0 B of source archives. | |
206 | Download complete and in download only mode" aptget source -d "$@" | |
207 | msgtest 'Files are not downloaded for' "$1" | |
208 | testfailure --nomsg test -e ${1}_1.0.dsc -o -e ${1}_1.0.tar.gz | |
209 | } | |
210 | ||
1262d358 DK |
211 | testmismatch() { |
212 | rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz | |
d4c45145 DK |
213 | local FAILURE |
214 | if [ "$1" = 'pkg-size-bad' ]; then | |
215 | FAILURE="Reading package lists... | |
216 | Need to get 6 B of source archives. | |
217 | Get:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) [2 B] | |
218 | Err:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) | |
219 | Writing more data than expected (3 > 2) | |
30979dd7 DK |
220 | Hashes of expected file: |
221 | - SHA256:943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a | |
28ee7f19 | 222 | - Filesize:2 [weak] |
d4c45145 DK |
223 | Get:2 http://localhost:${APTHTTPPORT} $1 1.0 (tar) [4 B] |
224 | Err:2 http://localhost:${APTHTTPPORT} $1 1.0 (tar) | |
225 | Hash Sum mismatch | |
0340069c DK |
226 | Hashes of expected file: |
227 | - SHA256:90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb | |
28ee7f19 | 228 | - Filesize:4 [weak] |
0340069c DK |
229 | Hashes of received file: |
230 | - SHA256:90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb | |
28ee7f19 | 231 | - Filesize:3 [weak] |
0340069c | 232 | Last modification reported: $(lastmodification "aptarchive/${1}_1.0.dsc") |
d4c45145 | 233 | E: Failed to fetch http://localhost:${APTHTTPPORT}/${1}_1.0.dsc Writing more data than expected (3 > 2) |
30979dd7 DK |
234 | Hashes of expected file: |
235 | - SHA256:943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a | |
28ee7f19 | 236 | - Filesize:2 [weak] |
d4c45145 | 237 | E: Failed to fetch http://localhost:${APTHTTPPORT}/${1}_1.0.tar.gz Hash Sum mismatch |
0340069c DK |
238 | Hashes of expected file: |
239 | - SHA256:90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb | |
28ee7f19 | 240 | - Filesize:4 [weak] |
0340069c DK |
241 | Hashes of received file: |
242 | - SHA256:90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb | |
28ee7f19 | 243 | - Filesize:3 [weak] |
0340069c DK |
244 | Last modification reported: $(lastmodification "aptarchive/${1}_1.0.dsc") |
245 | E: Failed to fetch some archives." | |
246 | elif [ "$1" = 'pkg-md5-bad' ]; then | |
247 | FAILURE="Reading package lists... | |
248 | Need to get 6 B of source archives. | |
249 | Get:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) [3 B] | |
250 | Err:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) | |
251 | Hash Sum mismatch | |
252 | Hashes of expected file: | |
d3003692 | 253 | - MD5Sum:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [weak] |
28ee7f19 | 254 | - Filesize:3 [weak] |
0340069c DK |
255 | Hashes of received file: |
256 | - SHA512:e52b7bb395ea3f46974f1f65b7c5975839aad32d4e2ec0f458f735d5aa24d2bf36d7816ed1e01dc3c493e11879e9a8f66dfca42821608cfe993996929a6be18a | |
257 | - SHA256:943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a | |
d3003692 DK |
258 | - SHA1:324f464e6151a92cf57b26ef95dcfcf2059a8c44 [weak] |
259 | - MD5Sum:9604ba9427a280db542279d9ed78400b [weak] | |
28ee7f19 | 260 | - Filesize:3 [weak] |
0340069c DK |
261 | Last modification reported: $(lastmodification "aptarchive/${1}_1.0.dsc") |
262 | Get:2 http://localhost:${APTHTTPPORT} $1 1.0 (tar) [3 B] | |
263 | Err:2 http://localhost:${APTHTTPPORT} $1 1.0 (tar) | |
264 | Hash Sum mismatch | |
265 | Hashes of expected file: | |
d3003692 | 266 | - MD5Sum:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb [weak] |
28ee7f19 | 267 | - Filesize:3 [weak] |
0340069c DK |
268 | Hashes of received file: |
269 | - SHA512:5aa4cad81553320574eb72ee92bd45a1f0575528e257749dff298b2a33df9e7fc7f5c1c87fc1c8fde230f1234cca3a99bf8625a0ff7bb3238eb7e5473f9b43c0 | |
270 | - SHA256:90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb | |
d3003692 DK |
271 | - SHA1:680254bad1d7ca0d65ec46aaa315d363abf6a50a [weak] |
272 | - MD5Sum:db5570bf61464b46e2bde31ed61a7dc6 [weak] | |
28ee7f19 | 273 | - Filesize:3 [weak] |
0340069c DK |
274 | Last modification reported: $(lastmodification "aptarchive/${1}_1.0.tar.gz") |
275 | E: Failed to fetch http://localhost:${APTHTTPPORT}/${1}_1.0.dsc Hash Sum mismatch | |
276 | Hashes of expected file: | |
d3003692 | 277 | - MD5Sum:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa [weak] |
28ee7f19 | 278 | - Filesize:3 [weak] |
0340069c DK |
279 | Hashes of received file: |
280 | - SHA512:e52b7bb395ea3f46974f1f65b7c5975839aad32d4e2ec0f458f735d5aa24d2bf36d7816ed1e01dc3c493e11879e9a8f66dfca42821608cfe993996929a6be18a | |
281 | - SHA256:943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a | |
d3003692 DK |
282 | - SHA1:324f464e6151a92cf57b26ef95dcfcf2059a8c44 [weak] |
283 | - MD5Sum:9604ba9427a280db542279d9ed78400b [weak] | |
28ee7f19 | 284 | - Filesize:3 [weak] |
0340069c DK |
285 | Last modification reported: $(lastmodification "aptarchive/${1}_1.0.dsc") |
286 | E: Failed to fetch http://localhost:${APTHTTPPORT}/${1}_1.0.tar.gz Hash Sum mismatch | |
287 | Hashes of expected file: | |
d3003692 | 288 | - MD5Sum:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb [weak] |
28ee7f19 | 289 | - Filesize:3 [weak] |
0340069c DK |
290 | Hashes of received file: |
291 | - SHA512:5aa4cad81553320574eb72ee92bd45a1f0575528e257749dff298b2a33df9e7fc7f5c1c87fc1c8fde230f1234cca3a99bf8625a0ff7bb3238eb7e5473f9b43c0 | |
292 | - SHA256:90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb | |
d3003692 DK |
293 | - SHA1:680254bad1d7ca0d65ec46aaa315d363abf6a50a [weak] |
294 | - MD5Sum:db5570bf61464b46e2bde31ed61a7dc6 [weak] | |
28ee7f19 | 295 | - Filesize:3 [weak] |
0340069c | 296 | Last modification reported: $(lastmodification "aptarchive/${1}_1.0.tar.gz") |
d4c45145 DK |
297 | E: Failed to fetch some archives." |
298 | else | |
299 | FAILURE="Reading package lists... | |
895417ef | 300 | Need to get 6 B of source archives. |
6c0765c0 DK |
301 | Get:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) [3 B] |
302 | Err:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) | |
448c38bd | 303 | Hash Sum mismatch |
0340069c DK |
304 | Hashes of expected file: |
305 | - SHA256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | |
28ee7f19 | 306 | - Filesize:3 [weak] |
d3003692 DK |
307 | - SHA1:324f464e6151a92cf57b26ef95dcfcf2059a8c44 [weak] |
308 | - MD5Sum:9604ba9427a280db542279d9ed78400b [weak] | |
0340069c DK |
309 | Hashes of received file: |
310 | - SHA256:943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a | |
d3003692 DK |
311 | - SHA1:324f464e6151a92cf57b26ef95dcfcf2059a8c44 [weak] |
312 | - MD5Sum:9604ba9427a280db542279d9ed78400b [weak] | |
28ee7f19 | 313 | - Filesize:3 [weak] |
0340069c | 314 | Last modification reported: $(lastmodification "aptarchive/${1}_1.0.dsc") |
6c0765c0 DK |
315 | Get:2 http://localhost:${APTHTTPPORT} $1 1.0 (tar) [3 B] |
316 | Err:2 http://localhost:${APTHTTPPORT} $1 1.0 (tar) | |
448c38bd | 317 | Hash Sum mismatch |
0340069c DK |
318 | Hashes of expected file: |
319 | - SHA256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | |
28ee7f19 | 320 | - Filesize:3 [weak] |
d3003692 DK |
321 | - SHA1:680254bad1d7ca0d65ec46aaa315d363abf6a50a [weak] |
322 | - MD5Sum:db5570bf61464b46e2bde31ed61a7dc6 [weak] | |
0340069c DK |
323 | Hashes of received file: |
324 | - SHA256:90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb | |
d3003692 DK |
325 | - SHA1:680254bad1d7ca0d65ec46aaa315d363abf6a50a [weak] |
326 | - MD5Sum:db5570bf61464b46e2bde31ed61a7dc6 [weak] | |
28ee7f19 | 327 | - Filesize:3 [weak] |
0340069c | 328 | Last modification reported: $(lastmodification "aptarchive/${1}_1.0.tar.gz") |
6c0765c0 | 329 | E: Failed to fetch http://localhost:${APTHTTPPORT}/${1}_1.0.dsc Hash Sum mismatch |
0340069c DK |
330 | Hashes of expected file: |
331 | - SHA256:aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa | |
28ee7f19 | 332 | - Filesize:3 [weak] |
d3003692 DK |
333 | - SHA1:324f464e6151a92cf57b26ef95dcfcf2059a8c44 [weak] |
334 | - MD5Sum:9604ba9427a280db542279d9ed78400b [weak] | |
0340069c DK |
335 | Hashes of received file: |
336 | - SHA256:943d3bf22ac661fb0f59bc4ff68cc12b04ff17a838dfcc2537008eb9c7f3770a | |
d3003692 DK |
337 | - SHA1:324f464e6151a92cf57b26ef95dcfcf2059a8c44 [weak] |
338 | - MD5Sum:9604ba9427a280db542279d9ed78400b [weak] | |
28ee7f19 | 339 | - Filesize:3 [weak] |
0340069c | 340 | Last modification reported: $(lastmodification "aptarchive/${1}_1.0.dsc") |
6c0765c0 | 341 | E: Failed to fetch http://localhost:${APTHTTPPORT}/${1}_1.0.tar.gz Hash Sum mismatch |
0340069c DK |
342 | Hashes of expected file: |
343 | - SHA256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | |
28ee7f19 | 344 | - Filesize:3 [weak] |
d3003692 DK |
345 | - SHA1:680254bad1d7ca0d65ec46aaa315d363abf6a50a [weak] |
346 | - MD5Sum:db5570bf61464b46e2bde31ed61a7dc6 [weak] | |
0340069c DK |
347 | Hashes of received file: |
348 | - SHA256:90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb | |
d3003692 DK |
349 | - SHA1:680254bad1d7ca0d65ec46aaa315d363abf6a50a [weak] |
350 | - MD5Sum:db5570bf61464b46e2bde31ed61a7dc6 [weak] | |
28ee7f19 | 351 | - Filesize:3 [weak] |
0340069c | 352 | Last modification reported: $(lastmodification "aptarchive/${1}_1.0.tar.gz") |
d4c45145 DK |
353 | E: Failed to fetch some archives." |
354 | fi | |
355 | testfailureequal "$FAILURE" aptget source -d "$@" | |
1262d358 DK |
356 | msgtest 'Files were not download as they have hashsum mismatches for' "$1" |
357 | testfailure --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz | |
358 | ||
63d60998 DK |
359 | if [ "$2" != '--allow-unauthenticated' ]; then |
360 | rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz | |
361 | testsuccessequal "Reading package lists... | |
63d60998 DK |
362 | Skipping download of file '${1}_1.0.dsc' as requested hashsum is not available for authentication |
363 | Skipping download of file '${1}_1.0.tar.gz' as requested hashsum is not available for authentication | |
1262d358 DK |
364 | Need to get 0 B of source archives. |
365 | Download complete and in download only mode" aptget source -d "$@" -o Acquire::ForceHash=ROT26 | |
63d60998 DK |
366 | msgtest 'Files were not download as hash is unavailable for' "$1" |
367 | testfailure --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz | |
368 | fi | |
1262d358 | 369 | |
d4c45145 DK |
370 | if [ "$1" != 'pkg-size-bad' ]; then |
371 | rm -f ${1}_1.0.dsc ${1}_1.0.tar.gz | |
372 | testsuccessequal "Reading package lists... | |
895417ef | 373 | Need to get 6 B of source archives. |
6c0765c0 DK |
374 | Get:1 http://localhost:${APTHTTPPORT} $1 1.0 (dsc) [3 B] |
375 | Get:2 http://localhost:${APTHTTPPORT} $1 1.0 (tar) [3 B] | |
1262d358 | 376 | Download complete and in download only mode" aptget source --allow-unauthenticated -d "$@" -o Acquire::ForceHash=ROT26 |
d4c45145 DK |
377 | msgtest 'Files were downloaded unauthenticated as user allowed it' "$1" |
378 | testsuccess --nomsg test -e ${1}_1.0.dsc -a -e ${1}_1.0.tar.gz | |
379 | fi | |
1262d358 DK |
380 | } |
381 | ||
63d60998 | 382 | testnohash pkg-md5-ok |
51c04562 | 383 | testnohash pkg-sha1-ok |
1262d358 DK |
384 | testok pkg-sha256-ok |
385 | testkeep pkg-sha256-ok | |
386 | ||
387 | # pkg-sha256-bad has a bad SHA sum, but good MD5 sum. If apt is | |
388 | # checking the best available hash (as it should), this will trigger | |
389 | # a hash mismatch. | |
390 | testmismatch pkg-sha256-bad | |
1262d358 DK |
391 | testok pkg-sha256-bad -o Acquire::ForceHash=MD5Sum |
392 | ||
63d60998 DK |
393 | testnohash pkg-md5-bad |
394 | testmismatch pkg-md5-bad --allow-unauthenticated | |
395 | ||
d4c45145 DK |
396 | testmismatch pkg-size-bad |
397 | ||
1262d358 | 398 | # not having MD5 sum doesn't mean the file doesn't exist at all … |
63d60998 | 399 | testok pkg-no-md5 |
1262d358 | 400 | testok pkg-no-md5 -o Acquire::ForceHash=SHA256 |
25b86db1 | 401 | testsuccessequal "Reading package lists... |
1262d358 DK |
402 | Skipping download of file 'pkg-no-md5_1.0.dsc' as requested hashsum is not available for authentication |
403 | Skipping download of file 'pkg-no-md5_1.0.tar.gz' as requested hashsum is not available for authentication | |
404 | Need to get 0 B of source archives. | |
405 | Download complete and in download only mode" aptget source -d pkg-no-md5 -o Acquire::ForceHash=MD5Sum | |
406 | msgtest 'Files were not download as MD5 is not available for this package' 'pkg-no-md5' | |
407 | testfailure --nomsg test -e pkg-no-md5_1.0.dsc -a -e pkg-no-md5_1.0.tar.gz | |
408 | ||
409 | # deal with cases in which we haven't for all files the same checksum type | |
410 | # mostly pathologic as this shouldn't happen, but just to be sure | |
51c04562 JAK |
411 | testsuccessequal "Reading package lists... |
412 | Skipping download of file 'pkg-mixed-ok_1.0.tar.gz' as requested hashsum is not available for authentication | |
413 | Need to get 3 B of source archives. | |
414 | Get:1 http://localhost:${APTHTTPPORT} pkg-mixed-ok 1.0 (dsc) [3 B] | |
415 | Download complete and in download only mode" aptget source -d pkg-mixed-ok | |
416 | ||
417 | testsuccessequal "Reading package lists... | |
418 | Skipping download of file 'pkg-mixed-sha1-bad_1.0.dsc' as requested hashsum is not available for authentication | |
419 | Need to get 3 B of source archives. | |
6c0765c0 | 420 | Get:1 http://localhost:${APTHTTPPORT} pkg-mixed-sha1-bad 1.0 (tar) [3 B] |
51c04562 | 421 | Download complete and in download only mode" aptget source -d pkg-mixed-sha1-bad |
1262d358 DK |
422 | msgtest 'Only tar file is downloaded as the dsc has hashsum mismatch' 'pkg-mixed-sha1-bad' |
423 | testsuccess --nomsg test ! -e pkg-mixed-sha1-bad_1.0.dsc -a -e pkg-mixed-sha1-bad_1.0.tar.gz | |
6c0765c0 | 424 | testfailureequal "Reading package lists... |
51c04562 JAK |
425 | Skipping download of file 'pkg-mixed-sha2-bad_1.0.dsc' as requested hashsum is not available for authentication |
426 | Need to get 3 B of source archives. | |
6c0765c0 DK |
427 | Get:1 http://localhost:${APTHTTPPORT} pkg-mixed-sha2-bad 1.0 (tar) [3 B] |
428 | Err:1 http://localhost:${APTHTTPPORT} pkg-mixed-sha2-bad 1.0 (tar) | |
448c38bd | 429 | Hash Sum mismatch |
0340069c DK |
430 | Hashes of expected file: |
431 | - SHA256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | |
28ee7f19 | 432 | - Filesize:3 [weak] |
0340069c DK |
433 | Hashes of received file: |
434 | - SHA256:90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb | |
28ee7f19 | 435 | - Filesize:3 [weak] |
0340069c | 436 | Last modification reported: $(lastmodification 'aptarchive/pkg-mixed-sha2-bad_1.0.tar.gz') |
6c0765c0 | 437 | E: Failed to fetch http://localhost:${APTHTTPPORT}/pkg-mixed-sha2-bad_1.0.tar.gz Hash Sum mismatch |
0340069c DK |
438 | Hashes of expected file: |
439 | - SHA256:bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb | |
28ee7f19 | 440 | - Filesize:3 [weak] |
0340069c DK |
441 | Hashes of received file: |
442 | - SHA256:90aebae315675cbf04612de4f7d5874850f48e0b8dd82becbeaa47ca93f5ebfb | |
28ee7f19 | 443 | - Filesize:3 [weak] |
0340069c | 444 | Last modification reported: $(lastmodification 'aptarchive/pkg-mixed-sha2-bad_1.0.tar.gz') |
6c0765c0 | 445 | E: Failed to fetch some archives." aptget source -d pkg-mixed-sha2-bad |
1262d358 DK |
446 | |
447 | # it gets even more pathologic: multiple entries for one file, some even disagreeing! | |
63d60998 | 448 | testnohash pkg-md5-agree |
25b86db1 | 449 | testfailureequal 'Reading package lists... |
1262d358 | 450 | E: Error parsing checksum in Files of source package pkg-md5-disagree' aptget source -d pkg-md5-disagree |
25b86db1 | 451 | testfailureequal 'Reading package lists... |
1262d358 | 452 | E: Error parsing checksum in Checksums-SHA256 of source package pkg-sha256-disagree' aptget source -d pkg-sha256-disagree |