From 5caa8cac3bc0ffa8b5360f3e5d5c84e710eb394b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Fri, 1 Feb 2019 14:51:56 +0100 Subject: Step over empty sections in TagFiles with comments Implementing a parser with recursion isn't the best idea, but in practice we should get away with it for the time being to avoid needless codechurn. Closes: #920317 #921037 --- apt-pkg/tagfile.cc | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'apt-pkg/tagfile.cc') diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 98001afd1..1e7f2867c 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -250,8 +250,12 @@ bool pkgTagFile::Step(pkgTagSection &Tag) d->chunks.erase(d->chunks.begin(), first); } - Tag.Trim(); - return true; + if ((d->Flags & pkgTagFile::SUPPORT_COMMENTS) == 0 || Tag.Count() != 0) + { + Tag.Trim(); + return true; + } + return Step(Tag); } /*}}}*/ // TagFile::Fill - Top up the buffer /*{{{*/ -- cgit v1.2.3-70-g09d2