Show More
@@ -4,7 +4,6 b'' | |||||
4 | > [extensions] |
|
4 | > [extensions] | |
5 | > lfs= |
|
5 | > lfs= | |
6 | > [lfs] |
|
6 | > [lfs] | |
7 | > url=http://localhost:$HGPORT/.git/info/lfs |
|
|||
8 | > track=all() |
|
7 | > track=all() | |
9 | > [web] |
|
8 | > [web] | |
10 | > push_ssl = False |
|
9 | > push_ssl = False | |
@@ -149,3 +148,187 b' Blob URIs are correct when --prefix is u' | |||||
149 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) |
|
148 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |
150 | $LOCALIP - - [$LOGDATE$] "POST /subdir/mount/point/.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) |
|
149 | $LOCALIP - - [$LOGDATE$] "POST /subdir/mount/point/.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |
151 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e HTTP/1.1" 200 - (glob) |
|
150 | $LOCALIP - - [$LOGDATE$] "GET /subdir/mount/point/.hg/lfs/objects/f03217a32529a28a42d03b1244fe09b6e0f9fd06d7b966d4d50567be2abe6c0e HTTP/1.1" 200 - (glob) | |
|
151 | ||||
|
152 | $ cat >> $TESTTMP/lfsstoreerror.py <<EOF | |||
|
153 | > import errno | |||
|
154 | > from hgext.lfs import blobstore | |||
|
155 | > | |||
|
156 | > _numverifies = 0 | |||
|
157 | > _readerr = True | |||
|
158 | > | |||
|
159 | > def reposetup(ui, repo): | |||
|
160 | > # Nothing to do with a remote repo | |||
|
161 | > if not repo.local(): | |||
|
162 | > return | |||
|
163 | > | |||
|
164 | > store = repo.svfs.lfslocalblobstore | |||
|
165 | > class badstore(store.__class__): | |||
|
166 | > def download(self, oid, src): | |||
|
167 | > '''Called in the server to handle reading from the client in a | |||
|
168 | > PUT request.''' | |||
|
169 | > origread = src.read | |||
|
170 | > def _badread(nbytes): | |||
|
171 | > # Simulate bad data/checksum failure from the client | |||
|
172 | > return b'0' * len(origread(nbytes)) | |||
|
173 | > src.read = _badread | |||
|
174 | > super(badstore, self).download(oid, src) | |||
|
175 | > | |||
|
176 | > def _read(self, vfs, oid, verify): | |||
|
177 | > '''Called in the server to read data for a GET request, and then | |||
|
178 | > calls self._verify() on it before returning.''' | |||
|
179 | > global _readerr | |||
|
180 | > # One time simulation of a read error | |||
|
181 | > if _readerr: | |||
|
182 | > _readerr = False | |||
|
183 | > raise IOError(errno.EIO, '%s: I/O error' % oid) | |||
|
184 | > # Simulate corrupt content on client download | |||
|
185 | > blobstore._verify(oid, 'dummy content') | |||
|
186 | > | |||
|
187 | > def verify(self, oid): | |||
|
188 | > '''Called in the server to populate the Batch API response, | |||
|
189 | > letting the client re-upload if the file is corrupt.''' | |||
|
190 | > # Fail verify in Batch API for one clone command and one push | |||
|
191 | > # command with an IOError. Then let it through to access other | |||
|
192 | > # functions. Checksum failure is tested elsewhere. | |||
|
193 | > global _numverifies | |||
|
194 | > _numverifies += 1 | |||
|
195 | > if _numverifies <= 2: | |||
|
196 | > raise IOError(errno.EIO, '%s: I/O error' % oid) | |||
|
197 | > return super(badstore, self).verify(oid) | |||
|
198 | > | |||
|
199 | > store.__class__ = badstore | |||
|
200 | > EOF | |||
|
201 | ||||
|
202 | $ rm -rf `hg config lfs.usercache` | |||
|
203 | $ rm -f $TESTTMP/access.log $TESTTMP/errors.log | |||
|
204 | $ hg --config "lfs.usercache=$TESTTMP/servercache" \ | |||
|
205 | > --config extensions.lfsstoreerror=$TESTTMP/lfsstoreerror.py \ | |||
|
206 | > -R server serve -d \ | |||
|
207 | > -p $HGPORT1 --pid-file=hg.pid -A $TESTTMP/access.log -E $TESTTMP/errors.log | |||
|
208 | $ cat hg.pid >> $DAEMON_PIDS | |||
|
209 | ||||
|
210 | Test an I/O error in localstore.verify() (Batch API) with GET | |||
|
211 | ||||
|
212 | $ hg clone http://localhost:$HGPORT1 httpclone2 | |||
|
213 | requesting all changes | |||
|
214 | adding changesets | |||
|
215 | adding manifests | |||
|
216 | adding file changes | |||
|
217 | added 1 changesets with 1 changes to 1 files | |||
|
218 | new changesets 525251863cad | |||
|
219 | updating to branch default | |||
|
220 | abort: LFS server error for "lfs.bin": Internal server error! | |||
|
221 | [255] | |||
|
222 | ||||
|
223 | Test an I/O error in localstore.verify() (Batch API) with PUT | |||
|
224 | ||||
|
225 | $ echo foo > client/lfs.bin | |||
|
226 | $ hg -R client ci -m 'mod lfs' | |||
|
227 | $ hg -R client push http://localhost:$HGPORT1 | |||
|
228 | pushing to http://localhost:$HGPORT1/ | |||
|
229 | searching for changes | |||
|
230 | abort: LFS server error for "unknown": Internal server error! | |||
|
231 | [255] | |||
|
232 | TODO: figure out how to associate the file name in the error above | |||
|
233 | ||||
|
234 | Test a bad checksum sent by the client in the transfer API | |||
|
235 | ||||
|
236 | $ hg -R client push http://localhost:$HGPORT1 | |||
|
237 | pushing to http://localhost:$HGPORT1/ | |||
|
238 | searching for changes | |||
|
239 | abort: HTTP error: HTTP Error 500: Internal Server Error (oid=b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c, action=upload)! | |||
|
240 | [255] | |||
|
241 | ||||
|
242 | $ echo 'test lfs file' > server/lfs3.bin | |||
|
243 | $ hg --config experimental.lfs.disableusercache=True \ | |||
|
244 | > -R server ci -Aqm 'another lfs file' | |||
|
245 | $ hg -R client pull -q http://localhost:$HGPORT1 | |||
|
246 | ||||
|
247 | Test an I/O error during the processing of the GET request | |||
|
248 | ||||
|
249 | $ hg --config lfs.url=http://localhost:$HGPORT1/.git/info/lfs \ | |||
|
250 | > -R client update -r tip | |||
|
251 | abort: HTTP error: HTTP Error 500: Internal Server Error (oid=276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d, action=download)! | |||
|
252 | [255] | |||
|
253 | ||||
|
254 | Test a checksum failure during the processing of the GET request | |||
|
255 | ||||
|
256 | $ hg --config lfs.url=http://localhost:$HGPORT1/.git/info/lfs \ | |||
|
257 | > -R client update -r tip | |||
|
258 | abort: HTTP error: HTTP Error 500: Internal Server Error (oid=276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d, action=download)! | |||
|
259 | [255] | |||
|
260 | ||||
|
261 | $ $PYTHON $RUNTESTDIR/killdaemons.py $DAEMON_PIDS | |||
|
262 | ||||
|
263 | $ cat $TESTTMP/access.log | |||
|
264 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
265 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
266 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=0000000000000000000000000000000000000000&heads=525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
267 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |||
|
268 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
269 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D392c05922088bacf8e68a6939b480017afbf245d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
270 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
271 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
272 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
273 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
274 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |||
|
275 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
276 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D392c05922088bacf8e68a6939b480017afbf245d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
277 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=phases x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
278 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
279 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=branchmap HTTP/1.1" 200 - x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
280 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=listkeys HTTP/1.1" 200 - x-hgarg-1:namespace=bookmarks x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
281 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |||
|
282 | $LOCALIP - - [$LOGDATE$] "PUT /.hg/lfs/objects/b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c HTTP/1.1" 500 - (glob) | |||
|
283 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) | |||
|
284 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=batch HTTP/1.1" 200 - x-hgarg-1:cmds=heads+%3Bknown+nodes%3D392c05922088bacf8e68a6939b480017afbf245d x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
285 | $LOCALIP - - [$LOGDATE$] "GET /?cmd=getbundle HTTP/1.1" 200 - x-hgarg-1:bookmarks=1&bundlecaps=HG20%2Cbundle2%3DHG20%250Abookmarks%250Achangegroup%253D01%252C02%252C03%250Adigests%253Dmd5%252Csha1%252Csha512%250Aerror%253Dabort%252Cunsupportedcontent%252Cpushraced%252Cpushkey%250Ahgtagsfnodes%250Alistkeys%250Aphases%253Dheads%250Apushkey%250Aremote-changegroup%253Dhttp%252Chttps%250Arev-branch-cache%250Astream%253Dv2&cg=1&common=525251863cad618e55d483555f3d00a2ca99597e&heads=506bf3d83f78c54b89e81c6411adee19fdf02156+525251863cad618e55d483555f3d00a2ca99597e&listkeys=bookmarks&phases=1 x-hgproto-1:0.1 0.2 comp=$USUAL_COMPRESSIONS$ partial-pull (glob) | |||
|
286 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |||
|
287 | $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d HTTP/1.1" 500 - (glob) | |||
|
288 | $LOCALIP - - [$LOGDATE$] "POST /.git/info/lfs/objects/batch HTTP/1.1" 200 - (glob) | |||
|
289 | $LOCALIP - - [$LOGDATE$] "GET /.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d HTTP/1.1" 500 - (glob) | |||
|
290 | ||||
|
291 | $ grep -v ' File "' $TESTTMP/errors.log | |||
|
292 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/.hg/lfs/objects/b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c': (glob) | |||
|
293 | Traceback (most recent call last): | |||
|
294 | self.do_write() | |||
|
295 | self.do_hgweb() | |||
|
296 | for chunk in self.server.application(env, self._start_response): | |||
|
297 | for r in self._runwsgi(req, res, repo): | |||
|
298 | rctx, req, res, self.check_perm) | |||
|
299 | return func(*(args + a), **kw) | |||
|
300 | lambda perm: | |||
|
301 | localstore.download(oid, req.bodyfh) | |||
|
302 | super(badstore, self).download(oid, src) | |||
|
303 | raise error.Abort(_('corrupt remote lfs object: %s') % oid) | |||
|
304 | Abort: corrupt remote lfs object: b5bb9d8014a0f9b1d61e21e796d78dccdf1352f23cd32812f4850b878ae4944c | |||
|
305 | ||||
|
306 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d': (glob) | |||
|
307 | Traceback (most recent call last): | |||
|
308 | self.do_write() | |||
|
309 | self.do_hgweb() | |||
|
310 | for chunk in self.server.application(env, self._start_response): | |||
|
311 | for r in self._runwsgi(req, res, repo): | |||
|
312 | rctx, req, res, self.check_perm) | |||
|
313 | return func(*(args + a), **kw) | |||
|
314 | lambda perm: | |||
|
315 | res.setbodybytes(localstore.read(oid)) | |||
|
316 | blob = self._read(self.vfs, oid, verify) | |||
|
317 | raise IOError(errno.EIO, '%s: I/O error' % oid) | |||
|
318 | IOError: [Errno 5] 276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d: I/O error | |||
|
319 | ||||
|
320 | $LOCALIP - - [$ERRDATE$] Exception happened during processing request '/.hg/lfs/objects/276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d': (glob) | |||
|
321 | Traceback (most recent call last): | |||
|
322 | self.do_write() | |||
|
323 | self.do_hgweb() | |||
|
324 | for chunk in self.server.application(env, self._start_response): | |||
|
325 | for r in self._runwsgi(req, res, repo): | |||
|
326 | rctx, req, res, self.check_perm) | |||
|
327 | return func(*(args + a), **kw) | |||
|
328 | lambda perm: | |||
|
329 | res.setbodybytes(localstore.read(oid)) | |||
|
330 | blob = self._read(self.vfs, oid, verify) | |||
|
331 | blobstore._verify(oid, 'dummy content') | |||
|
332 | hint=_('run hg verify')) | |||
|
333 | Abort: detected corrupt lfs object: 276f73cfd75f9fb519810df5f5d96d6594ca2521abd86cbcd92122f7d51a1f3d | |||
|
334 |
General Comments 0
You need to be logged in to leave comments.
Login now