]> git.saurik.com Git - apt.git/commitdiff
fix regression that APT::Keep-Fds is not honored (closes: #730490)
authorMichael Vogt <mvo@debian.org>
Thu, 28 Nov 2013 16:08:53 +0000 (17:08 +0100)
committerMichael Vogt <mvo@debian.org>
Thu, 28 Nov 2013 16:08:53 +0000 (17:08 +0100)
apt-pkg/contrib/fileutl.cc
apt-pkg/contrib/fileutl.h
apt-pkg/deb/dpkgpm.cc
debian/changelog

index d2be276c71a6eeaa9969b038e024fab573349fd7..3a6bdfe2ec431b6872ef3a45cb2c5e41c130e2b1 100644 (file)
@@ -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);
 }
 
index 63a999c30abd798e25ca19b091c2ad826954be20..e9a9aab28018b35c792f87e7af0061db4c581d25 100644 (file)
@@ -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
index 26d79dbb11b281ca64aed4c33d87e55b397da781..01c6242dcdfd0afdb900fb6944f25f0252570c92 100644 (file)
@@ -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)
       {
index 7447628db2041933e9fbf30652da9f911aff4530..92b9635dd1fe4e3300037eb4bd484fb209b0ed85 100644 (file)
@@ -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