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 | |
| 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.
| -rw-r--r-- | debian/changelog | 3 | ||||
| -rw-r--r-- | python/tag.cc | 16 |
2 files changed, 19 insertions, 0 deletions
diff --git a/debian/changelog b/debian/changelog index 7986b91c..77e1dde1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,9 @@ python-apt (0.7.93.4) unstable; urgency=low - Add AcquireItem.partialsize member. * python/generic.cc: - Map UntranslatedDepType to dep_type_untranslated. + * python/tag.cc: + - Hack the TagFile iterator to not use shared storage (Closes: #572596): + Scan once, duplicate the section data, and scan again. * apt/package.py: - Create a string class BaseDependency.__dstr which makes '>' equal to '>>' and '<' equal to '<<' (compatibility). 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); } |
