summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Kalnischkies <david@kalnischkies.de>2015-11-27 22:22:21 +0100
committerDavid Kalnischkies <david@kalnischkies.de>2015-11-27 22:22:21 +0100
commit0300f0077af832e87beb290f26b13404cab81fd3 (patch)
tree254766321928e4a91e6755e27a48e7bb441d3b59
parente006a7a1ae9fc9aeee4f83ccd05de653f6f06b60 (diff)
outsmart gcc -O3 over-optimization in pkgCdrom::FindPackages
Seems like a simpler workaround than forcing a lower optimization level just for this for all of apt. See also: https://bugs.launchpad.net/ubuntu/+source/gcc-5/+bug/1473674
-rw-r--r--apt-pkg/cdrom.cc6
-rw-r--r--test/libapt/cdromfindpackages_test.cc2
2 files changed, 5 insertions, 3 deletions
diff --git a/apt-pkg/cdrom.cc b/apt-pkg/cdrom.cc
index 29eeca066..5613459e7 100644
--- a/apt-pkg/cdrom.cc
+++ b/apt-pkg/cdrom.cc
@@ -61,10 +61,10 @@ bool pkgCdrom::FindPackages(string CD,
return _error->Errno("chdir","Unable to change to %s",CD.c_str());
// Look for a .disk subdirectory
- if (DirectoryExists(".disk") == true)
+ if (InfoDir.empty() == true)
{
- if (InfoDir.empty() == true)
- InfoDir = CD + ".disk/";
+ if (DirectoryExists(".disk") == true)
+ InfoDir = InfoDir + CD + ".disk/";
}
// Don't look into directories that have been marked to ingore.
diff --git a/test/libapt/cdromfindpackages_test.cc b/test/libapt/cdromfindpackages_test.cc
index 6121d32b6..0d8eb1f90 100644
--- a/test/libapt/cdromfindpackages_test.cc
+++ b/test/libapt/cdromfindpackages_test.cc
@@ -24,7 +24,9 @@ class Cdrom : public pkgCdrom {
std::string &InfoDir) {
std::string const startdir = SafeGetCWD();
EXPECT_FALSE(startdir.empty());
+ EXPECT_TRUE(InfoDir.empty());
bool const result = pkgCdrom::FindPackages(CD, List, SList, SigList, TransList, InfoDir, NULL, 0);
+ EXPECT_FALSE(InfoDir.empty());
std::sort(List.begin(), List.end());
std::sort(SList.begin(), SList.end());
std::sort(SigList.begin(), SigList.end());