From 55585d0f93de1a0e60858e594b1b3b46f4a0831f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Wed, 22 Aug 2018 09:54:07 +0200 Subject: Don't use invalid iterator in Fallback-Of handling MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit cppcheck reports: (error) Iterator 't' used after element has been erased. The loop is actually fashioned to deal with this (not in the most efficient way, but in simplest and speed isn't really a concern here) IF this codepath had a "break" at the end… so I added one. Note that the tests aren't failing before (and hopefully after) the change as the undefined behavior we encounter is too stable. Thanks: David Binderman for reporting --- test/integration/test-apt-acquire-additional-files | 21 +++++++++++++++++++-- .../test-sourceslist-target-plusminus-options | 4 ++++ 2 files changed, 23 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/integration/test-apt-acquire-additional-files b/test/integration/test-apt-acquire-additional-files index ff04b6346..928c703e1 100755 --- a/test/integration/test-apt-acquire-additional-files +++ b/test/integration/test-apt-acquire-additional-files @@ -214,9 +214,12 @@ testequal "$(readfile Contents-all)" aptget indextargets --format '$(FILENAME)' testsuccess cmp "rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all" 'aptarchive/dists/unstable/main/Contents-all' rm ./rootdir/var/lib/apt/lists/localhost:${APTHTTPPORT}_dists_unstable_main_Contents-all -rm -f rootdir/etc/apt/apt.conf.d/content-target.conf msgmsg "No Contents file" - +cat > rootdir/etc/apt/apt.conf.d/content-target-notdefault.conf < rootdir/etc/apt/sources.list testtargets 'duplications are okay' 'Packages' 'Translations' 'Contents' 'Contents2' + +# we can't check if it really reorders here +echo 'deb [target+=Contents2,Contents] http://example.org/debian stable rocks' > rootdir/etc/apt/sources.list +testtargets 'reordered fallback order' 'Packages' 'Translations' 'Contents' 'Contents2' -- cgit v1.2.3