summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Vogt <mvo@debian.org>2013-11-28 17:08:53 +0100
committerMichael Vogt <mvo@debian.org>2013-11-28 17:08:53 +0100
commit96ae6de5d3d5ae31100079c78fffc5ebc4a0b81c (patch)
tree3489aeb303d72f28b6cd96872dc1653ed74b68be
parente4e5d47b0e66ae7bedafbdbb685114c404381204 (diff)
fix regression that APT::Keep-Fds is not honored (closes: #730490)
-rw-r--r--apt-pkg/contrib/fileutl.cc26
-rw-r--r--apt-pkg/contrib/fileutl.h1
-rw-r--r--apt-pkg/deb/dpkgpm.cc2
-rw-r--r--debian/changelog3
4 files changed, 23 insertions, 9 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index d2be276c7..3a6bdfe2e 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -760,16 +760,13 @@ bool WaitFd(int Fd,bool write,unsigned long timeout)
return true;
}
/*}}}*/
-// ExecFork - Magical fork that sanitizes the context before execing /*{{{*/
+// MergeKeepFdsFromConfiguration - Merge APT::Keep-Fds configuration /*{{{*/
// ---------------------------------------------------------------------
-/* This is used if you want to cleanse the environment for the forked
- child, it fixes up the important signals and nukes all of the fds,
- otherwise acts like normal fork. */
-pid_t ExecFork()
+/* This is used to merge the APT::Keep-Fds with the provided KeepFDs
+ * set.
+ */
+void MergeKeepFdsFromConfiguration(std::set<int> &KeepFDs)
{
- set<int> KeepFDs;
-
- // FIXME: remove looking at APT::Keep-Fds eventually, its a hack
Configuration::Item const *Opts = _config->Tree("APT::Keep-Fds");
if (Opts != 0 && Opts->Child != 0)
{
@@ -782,6 +779,19 @@ pid_t ExecFork()
KeepFDs.insert(fd);
}
}
+}
+ /*}}}*/
+// ExecFork - Magical fork that sanitizes the context before execing /*{{{*/
+// ---------------------------------------------------------------------
+/* This is used if you want to cleanse the environment for the forked
+ child, it fixes up the important signals and nukes all of the fds,
+ otherwise acts like normal fork. */
+pid_t ExecFork()
+{
+ set<int> KeepFDs;
+ // we need to merge the Keep-Fds as external tools like
+ // debconf-apt-progress use it
+ MergeKeepFdsFromConfiguration(KeepFDs);
return ExecFork(KeepFDs);
}
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 63a999c30..e9a9aab28 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -184,6 +184,7 @@ void SetNonBlock(int Fd,bool Block);
bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0);
pid_t ExecFork();
pid_t ExecFork(std::set<int> keep_fds);
+void MergeKeepFdsFromConfiguration(std::set<int> &keep_fds);
bool ExecWait(pid_t Pid,const char *Name,bool Reap = false);
// File string manipulators
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 26d79dbb1..01c6242dc 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -417,6 +417,7 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
// Create the pipes
std::set<int> KeepFDs;
+ MergeKeepFdsFromConfiguration(KeepFDs);
int Pipes[2];
if (pipe(Pipes) != 0)
return _error->Errno("pipe","Failed to create IPC pipe to subprocess");
@@ -1380,6 +1381,7 @@ bool pkgDPkgPM::GoNoABIBreak(APT::Progress::PackageManager *progress)
d->progress->StartDpkg();
std::set<int> KeepFDs;
KeepFDs.insert(fd[1]);
+ MergeKeepFdsFromConfiguration(KeepFDs);
pid_t Child = ExecFork(KeepFDs);
if (Child == 0)
{
diff --git a/debian/changelog b/debian/changelog
index 7447628db..92b9635dd 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,8 +2,9 @@ apt (0.9.13.1) unstable; urgency=low
[ Colin Watson ]
* fix "apt-get --purge build-dep" (closes: #720597)
+ * fix regression that APT::Keep-Fds is not honored (closes: #730490)
- -- Michael Vogt <michael.vogt@ubuntu.com> Thu, 28 Nov 2013 16:49:31 +0100
+ -- Michael Vogt <mvo@debian.org> Thu, 28 Nov 2013 16:49:31 +0100
apt (0.9.13) unstable; urgency=low