Gitorious import: ObjectFormatException raised when badly formatted tag object exists in the repository
On some disk repository, errors occur on badly formatted object.
Steps to reproduce on a local storage with latest swh-loader-git
Use /srv/storage/space/mirrors/gitorious.org/mnt/repositories/hylafax/hylafax.git:
repo = 'hylafax.git'
origin_url = 'http://foo/bar/git'
import logging
logging.basicConfig(level=logging.DEBUG)
from swh.loader.git.tasks import LoadDiskGitRepository
t = LoadDiskGitRepository()
t.run(origin_url=origin_url, directory=repo, date='2016-05-03T15:16:32+00:00')
output:
DEBUG:swh.scheduler.task.LoadDiskGitRepository:Creating git origin for http://hylafax.git
DEBUG:swh.scheduler.task.LoadDiskGitRepository:Done creating git origin for http://hylafax.git
Traceback (most recent call last):
File "./load-git-disk.py", line 26, in <module>
main()
File "/usr/lib/python3/dist-packages/click/core.py", line 716, in __call__
return self.main(*args, **kwargs)
File "/usr/lib/python3/dist-packages/click/core.py", line 696, in main
rv = self.invoke(ctx)
File "/usr/lib/python3/dist-packages/click/core.py", line 889, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/lib/python3/dist-packages/click/core.py", line 534, in invoke
return callback(*args, **kwargs)
File "./load-git-disk.py", line 22, in main
date='2016-05-03T15:16:32+00:00')
File "/home/tony/work/inria/repo/swh/swh-environment/swh-scheduler/swh/scheduler/task.py", line 35, in run
raise e from None
File "/home/tony/work/inria/repo/swh/swh-environment/swh-scheduler/swh/scheduler/task.py", line 32, in run
result = self.run_task(*args, **kwargs)
File "/home/tony/work/inria/repo/swh/swh-environment/swh-loader-git/swh/loader/git/tasks.py", line 39, in run_task
return loader.load(origin_url, directory, dateutil.parser.parse(date))
File "/home/tony/work/inria/repo/swh/swh-environment/swh-loader-git/swh/loader/git/base.py", line 422, in load
self.fetch_data()
File "/home/tony/work/inria/repo/swh/swh-environment/swh-loader-git/swh/loader/git/loader.py", line 48, in fetch_data
type_name = self.repo[oid].type_name
File "/usr/lib/python3/dist-packages/dulwich/repo.py", line 470, in __getitem__
return self.object_store[name]
File "/usr/lib/python3/dist-packages/dulwich/object_store.py", line 119, in __getitem__
return ShaFile.from_raw_string(type_num, uncomp, sha=sha)
File "/usr/lib/python3/dist-packages/dulwich/objects.py", line 391, in from_raw_string
obj.set_raw_string(string, sha)
File "/usr/lib/python3/dist-packages/dulwich/objects.py", line 303, in set_raw_string
self.set_raw_chunks([text], sha)
File "/usr/lib/python3/dist-packages/dulwich/objects.py", line 308, in set_raw_chunks
self._deserialize(chunks)
File "/usr/lib/python3/dist-packages/dulwich/objects.py", line 747, in _deserialize
raise ObjectFormatException("Unknown field %s" % field)
dulwich.errors.ObjectFormatException: Unknown field b'Thu'
Note: load-git-disk.py is a wrapper around the scenario described (cf. swh/meta$183)
Migrated from T819 (view on Phabricator)
Edited by Phabricator Migration user