summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2018-12-10 17:35:33 +0000
committerJulian Andres Klode <jak@debian.org>2018-12-10 17:35:33 +0000
commitd57834a36e6adebbad28819360a984819995b376 (patch)
tree36a39bad37db8082f26427659817d882a6b0b8d8 /apt-pkg
parent294b5e77a25d2600e7f3ce12a996d1694b5be817 (diff)
parent806e94dcd8dbdf7bf1909657fd4331cfe17b4ab0 (diff)
Merge branch 'pu/dpkg-path' into 'master'
Set PATH=/usr/sbin:/usr/bin:/sbin:/bin when running dpkg See merge request apt-team/apt!38
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/deb/debsystem.cc4
-rw-r--r--apt-pkg/deb/dpkgpm.cc3
-rw-r--r--apt-pkg/init.cc3
3 files changed, 10 insertions, 0 deletions
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc
index 0a9e98d6d..5df6c58a1 100644
--- a/apt-pkg/deb/debsystem.cc
+++ b/apt-pkg/deb/debsystem.cc
@@ -398,6 +398,10 @@ pid_t debSystem::ExecDpkg(std::vector<std::string> const &sArgs, int * const inp
{
setenv("DPKG_FRONTEND_LOCKED", "true", 1);
}
+
+ if (_config->Find("DPkg::Path", "").empty() == false)
+ setenv("PATH", _config->Find("DPkg::Path", "").c_str(), 1);
+
execvp(Args[0], (char**) &Args[0]);
_error->WarningE("dpkg", "Can't execute dpkg!");
_exit(100);
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 074e52b3f..3c707e220 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -2017,6 +2017,9 @@ bool pkgDPkgPM::Go(APT::Progress::PackageManager *progress)
&& dynamic_cast<debSystem*>(_system)->IsLocked() == true) {
setenv("DPKG_FRONTEND_LOCKED", "true", 1);
}
+ if (_config->Find("DPkg::Path", "").empty() == false)
+ setenv("PATH", _config->Find("DPkg::Path", "").c_str(), 1);
+
execvp(Args[0], (char**) &Args[0]);
cerr << "Could not exec dpkg!" << endl;
_exit(100);
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index d98affe06..a619368ec 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -209,6 +209,9 @@ bool pkgInitConfig(Configuration &Cnf)
Cnf.CndSet("Acquire::Changelogs::URI::Origin::Ubuntu", "https://changelogs.ubuntu.com/changelogs/pool/@CHANGEPATH@/changelog");
Cnf.CndSet("Acquire::Changelogs::AlwaysOnline::Origin::Ubuntu", true);
+
+ Cnf.CndSet("DPkg::Path", "/usr/sbin:/usr/bin:/sbin:/bin");
+
// Read an alternate config file
_error->PushToStack();
const char *Cfg = getenv("APT_CONFIG");