From 4e5500361a964f49656a39b001ba246f113f8cdd Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 24 Sep 2009 09:30:17 +0200 Subject: * apt-pkg/deb/dpkgpm.cc: - when tcgetattr() returns non-zero skip all pty magic (thanks to Simon Richter, closes: #509866) --- apt-pkg/deb/dpkgpm.cc | 51 +++++++++++++++++++++++++++------------------------ debian/changelog | 8 ++++++++ 2 files changed, 35 insertions(+), 24 deletions(-) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index f787f365e..ab71d4e96 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -809,32 +809,35 @@ bool pkgDPkgPM::Go(int OutStatusFd) struct termios tt; struct winsize win; - int master; - int slave; + int master = -1; + int slave = -1; - // FIXME: setup sensible signal handling (*ick*) - tcgetattr(0, &tt); - ioctl(0, TIOCGWINSZ, (char *)&win); - if (openpty(&master, &slave, NULL, &tt, &win) < 0) + // if tcgetattr does not return zero there was a error + // and we do not do any pty magic + if (tcgetattr(0, &tt) == 0) { - const char *s = _("Can not write log, openpty() " - "failed (/dev/pts not mounted?)\n"); - fprintf(stderr, "%s",s); - fprintf(term_out, "%s",s); - master = slave = -1; - } else { - struct termios rtt; - 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); + ioctl(0, TIOCGWINSZ, (char *)&win); + if (openpty(&master, &slave, NULL, &tt, &win) < 0) + { + const char *s = _("Can not write log, openpty() " + "failed (/dev/pts not mounted?)\n"); + fprintf(stderr, "%s",s); + fprintf(term_out, "%s",s); + master = slave = -1; + } else { + struct termios rtt; + 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 diff --git a/debian/changelog b/debian/changelog index 6692191d1..a27f958b9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,11 @@ +apt (0.7.22.4) unstable; urgency=low + + * apt-pkg/deb/dpkgpm.cc: + - when tcgetattr() returns non-zero skip all pty magic + (thanks to Simon Richter, closes: #509866) + + -- Michael Vogt Mon, 31 Aug 2009 11:08:03 +0200 + apt (0.7.22.3) UNRELEASED; urgency=low [ Eugene V. Lyubimkin ] -- cgit v1.2.3 From 07b2db9b4b2e543b599db97d75ac2315a1676ad8 Mon Sep 17 00:00:00 2001 From: Michael Vogt Date: Thu, 24 Sep 2009 09:32:20 +0200 Subject: * apt-inst/contrib/arfile.cc: - show propper error message for Invalid archive members --- apt-inst/contrib/arfile.cc | 2 +- debian/changelog | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/apt-inst/contrib/arfile.cc b/apt-inst/contrib/arfile.cc index 7c85f2e86..8f30355ed 100644 --- a/apt-inst/contrib/arfile.cc +++ b/apt-inst/contrib/arfile.cc @@ -87,7 +87,7 @@ bool ARArchive::LoadHeaders() StrToNum(Head.Size,Memb->Size,sizeof(Head.Size)) == false) { delete Memb; - return _error->Error(_("Invalid archive member header")); + return _error->Error(_("Invalid archive member header %s"), Head.Name); } // Check for an extra long name string diff --git a/debian/changelog b/debian/changelog index a27f958b9..cad223833 100644 --- a/debian/changelog +++ b/debian/changelog @@ -3,6 +3,8 @@ apt (0.7.22.4) unstable; urgency=low * apt-pkg/deb/dpkgpm.cc: - when tcgetattr() returns non-zero skip all pty magic (thanks to Simon Richter, closes: #509866) + * apt-inst/contrib/arfile.cc: + - show propper error message for Invalid archive members -- Michael Vogt Mon, 31 Aug 2009 11:08:03 +0200 -- cgit v1.2.3