From 07dd557b6fd80ce2df235f1697189b6a8f190ff4 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Mon, 24 Nov 2008 10:44:46 +0100 Subject: * apt-pkg/deb/dpkgpm.cc: - fix potential hang when in a backgroud process group --- apt-pkg/deb/dpkgpm.cc | 16 ++++++++++++---- configure.in | 2 +- debian/changelog | 7 ++++--- 3 files changed, 17 insertions(+), 8 deletions(-) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 2e9dedefa..a88e23081 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -563,6 +563,11 @@ static int racy_pselect(int nfds, fd_set *readfds, fd_set *writefds, */ bool pkgDPkgPM::Go(int OutStatusFd) { + fd_set rfds; + struct timespec tv; + sigset_t sigmask; + sigset_t original_sigmask; + unsigned int MaxArgs = _config->FindI("Dpkg::MaxArgs",8*1024); unsigned int MaxArgBytes = _config->FindI("Dpkg::MaxArgBytes",32*1024); bool NoTriggers = _config->FindB("DPkg::NoTriggers",false); @@ -777,7 +782,14 @@ bool pkgDPkgPM::Go(int OutStatusFd) rtt = tt; cfmakeraw(&rtt); rtt.c_lflag &= ~ECHO; + // block SIGTTOU during tcsetattr to prevent a hang if + // the process is a member of the background process group + // http://www.opengroup.org/onlinepubs/000095399/functions/tcsetattr.html + sigemptyset(&sigmask); + sigaddset(&sigmask, SIGTTOU); + sigprocmask(SIG_BLOCK,&sigmask, &original_sigmask); tcsetattr(0, TCSAFLUSH, &rtt); + sigprocmask(SIG_SETMASK, &original_sigmask, 0); } // Fork dpkg @@ -844,10 +856,6 @@ bool pkgDPkgPM::Go(int OutStatusFd) close(slave); // setups fds - fd_set rfds; - struct timespec tv; - sigset_t sigmask; - sigset_t original_sigmask; sigemptyset(&sigmask); sigprocmask(SIG_BLOCK,&sigmask,&original_sigmask); diff --git a/configure.in b/configure.in index 679e601a3..aaaa44f43 100644 --- a/configure.in +++ b/configure.in @@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib) AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in) dnl -- SET THIS TO THE RELEASE VERSION -- -AC_DEFINE_UNQUOTED(VERSION,"0.7.14ubuntu6") +AC_DEFINE_UNQUOTED(VERSION,"0.7.14ubuntu7") PACKAGE="apt" AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE") AC_SUBST(PACKAGE) diff --git a/debian/changelog b/debian/changelog index 0c7e07c9b..042603ae6 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,11 +1,12 @@ -apt (0.7.14ubuntu7) intrepid; urgency=low +apt (0.7.14ubuntu7) jaunty; urgency=low * cmdline/apt-cache.cc: - remove the gettext from a string that consists entirely of variables (LP: #56792) - * + * apt-pkg/deb/dpkgpm.cc: + - fix potential hang when in a backgroud process group - -- + -- Michael Vogt Tue, 28 Oct 2008 21:09:12 +0100 apt (0.7.14ubuntu6) intrepid; urgency=low -- cgit v1.2.3