From 0fb16c3e678044d6d06ba8a6199b1e96487ee0d8 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 23 Aug 2016 20:19:11 +0200 Subject: Use C locale instead of C.UTF-8 for protocol strings The C.UTF-8 locale is not portable, so we need to use C, otherwise we crash on other systems. We can use std::locale::classic() for that, which might also be a bit cheaper than using locale("C"). --- apt-pkg/acquire-item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/acquire-item.cc') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 7abb7b206..d72e62725 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -2047,7 +2047,7 @@ bool pkgAcqDiffIndex::ParseDiffIndex(string const &IndexDiffFile) /*{{{*/ HashStringList ServerHashes; unsigned long long ServerSize = 0; - auto const &posix = std::locale("C.UTF-8"); + auto const &posix = std::locale::classic(); for (char const * const * type = HashString::SupportedHashes(); *type != NULL; ++type) { std::string tagname = *type; -- cgit v1.2.3 From 8757a0fdeee00ea6a7cc717188a0e129ad8a553c Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Tue, 23 Aug 2016 19:41:58 +0200 Subject: Make directory paths configurable This allows other vendors to use different paths, or to build your own APT in /opt for testing. Note that this uses + 1 in some places, as the paths we receive are absolute, but we need to strip of the initial /. --- apt-pkg/acquire-item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/acquire-item.cc') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index d72e62725..7238d692e 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -145,7 +145,7 @@ static void ReportMirrorFailureToCentral(pkgAcquire::Item const &I, std::string << FailCode << std::endl; #endif string const report = _config->Find("Methods::Mirror::ProblemReporting", - "/usr/lib/apt/apt-report-mirror-failure"); + LIBEXEC_DIR "/apt-report-mirror-failure"); if(!FileExists(report)) return; -- cgit v1.2.3 From 2ed62ba6abcad809d1898a40950f86217af73812 Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 25 Aug 2016 14:24:49 +0200 Subject: changelog: Respect Dir setting for local changelog getting This fixes issues with chroots, but the goal here was to get the test suite working on systems without dpkg. --- apt-pkg/acquire-item.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'apt-pkg/acquire-item.cc') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index 7238d692e..f715e060e 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -3488,7 +3488,8 @@ std::string pkgAcqChangelog::URI(pkgCache::VerIterator const &Ver) /*{{{*/ pkgCache::PkgIterator const Pkg = Ver.ParentPkg(); if (Pkg->CurrentVer != 0 && Pkg.CurrentVer() == Ver) { - std::string const basename = std::string("/usr/share/doc/") + Pkg.Name() + "/changelog"; + std::string const root = _config->FindDir("Dir"); + std::string const basename = root + std::string("usr/share/doc/") + Pkg.Name() + "/changelog"; std::string const debianname = basename + ".Debian"; if (FileExists(debianname)) return "copy://" + debianname; -- cgit v1.2.3 From 6f1f3c9afdb6ade6a7be110b90c8fc9e603254cf Mon Sep 17 00:00:00 2001 From: Julian Andres Klode Date: Thu, 25 Aug 2016 16:25:00 +0200 Subject: Make root group configurable via ROOT_GROUP This is needed on BSD where root's default group is wheel, not root. --- apt-pkg/acquire-item.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'apt-pkg/acquire-item.cc') diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc index f715e060e..88b5a58b5 100644 --- a/apt-pkg/acquire-item.cc +++ b/apt-pkg/acquire-item.cc @@ -3440,7 +3440,7 @@ void pkgAcqChangelog::Init(std::string const &DestDir, std::string const &DestFi TemporaryDirectory = tmpname; ChangeOwnerAndPermissionOfFile("Item::QueueURI", TemporaryDirectory.c_str(), - SandboxUser.c_str(), "root", 0700); + SandboxUser.c_str(), ROOT_GROUP, 0700); DestFile = flCombine(TemporaryDirectory, DestFileName); if (DestDir.empty() == false) -- cgit v1.2.3