diff options
| author | Julian Andres Klode <jak@debian.org> | 2010-03-05 18:14:43 +0100 |
|---|---|---|
| committer | Julian Andres Klode <jak@debian.org> | 2010-03-05 18:14:43 +0100 |
| commit | 4b434cde19d25e2acc238699834f1a2a72540ca2 (patch) | |
| tree | 7ccb96cf17b99563bb8a75e5e8a7d3a7f91c8f36 /python/tag.cc | |
| parent | 60fa1ae39d5911d7051cfbeb1016db9d47ca331a (diff) | |
| download | python-apt-4b434cde19d25e2acc238699834f1a2a72540ca2.tar.gz | |
* python/tag.cc:
- Hack the TagFile iterator to not use shared storage (Closes: #572596):
Scan once, duplicate the section data, and scan again.
Diffstat (limited to 'python/tag.cc')
| -rw-r--r-- | python/tag.cc | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/python/tag.cc b/python/tag.cc index 6d327d27..c7edcb31 100644 --- a/python/tag.cc +++ b/python/tag.cc @@ -271,6 +271,22 @@ static PyObject *TagFileNext(PyObject *Self) Obj.Section->Data = 0; if (Obj.Object.Step(Obj.Section->Object) == false) return HandleErrors(NULL); + + // Bug-Debian: http://bugs.debian.org/572596 + // Duplicate the data here and scan the duplicated section data; in order + // to not use any shared storage. + // TODO: Provide an API in apt-pkg to do this; this is really ugly. + + // Fetch old section data + const char *Start; + const char *Stop; + Obj.Section->Object.GetSection(Start,Stop); + // Duplicate the data + Obj.Section->Data = new char[Stop-Start]; + strncpy(Obj.Section->Data, Start, Stop-Start); + // Rescan it + Obj.Section->Object.Scan(Obj.Section->Data, Stop-Start); + Py_INCREF(Obj.Section); return HandleErrors(Obj.Section); } |
