summaryrefslogtreecommitdiff
path: root/apt-pkg/deb/debsystem.cc
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@debian.org>2025-01-14 08:30:48 +0000
committerJulian Andres Klode <jak@debian.org>2025-01-14 08:30:48 +0000
commitbd71382494a73ba3e6b417eb8b6f0a5e808e41fb (patch)
treee0a4ca0f366082571e770078a888fae37caceb4f /apt-pkg/deb/debsystem.cc
parent7287fac33370d0e2cf311486b949f1a3cce36cd1 (diff)
parent8e6a86aa3bc6d5a9013bb42fccea9bbce3fd97e2 (diff)
Merge branch 'check-missing-dpkg-bin' into 'main'
apt-pkg/deb/debsystem.cc: Fall back to "dpkg" when Dir::Bin::dpkg is not found See merge request apt-team/apt!419
Diffstat (limited to 'apt-pkg/deb/debsystem.cc')
-rw-r--r--apt-pkg/deb/debsystem.cc11
1 files changed, 10 insertions, 1 deletions
diff --git a/apt-pkg/deb/debsystem.cc b/apt-pkg/deb/debsystem.cc
index 8533b1157..749969759 100644
--- a/apt-pkg/deb/debsystem.cc
+++ b/apt-pkg/deb/debsystem.cc
@@ -392,7 +392,16 @@ std::string debSystem::StripDpkgChrootDirectory(std::string const &File)/*{{{*/
/*}}}*/
std::string debSystem::GetDpkgExecutable() /*{{{*/
{
- return StripDpkgChrootDirectory(_config->Find("Dir::Bin::dpkg","dpkg"));
+ std::string dpkg_executable = _config->Find("Dir::Bin::dpkg","dpkg");
+ if (APT::String::Startswith(dpkg_executable, "/")) {
+ struct stat buf;
+ if (stat(dpkg_executable.c_str(), &buf) != 0) {
+ _error->Warning(_("The dpkg executable set in Dir::Bin::dpkg is "
+ "missing, falling back to using default dpkg."));
+ dpkg_executable = "dpkg";
+ }
+ }
+ return StripDpkgChrootDirectory(dpkg_executable);
}
/*}}}*/
std::vector<std::string> debSystem::GetDpkgBaseCommand() /*{{{*/