Browse Source

Fix conffile prompt regression (LP: #1260297)

This fixes a regression in the conffile prompt for the progress-fd
and adds a testcase to ensure this does not regress again.
tags/debian/0.9.14.2
Michael Vogt 7 years ago
parent
commit
c23e6cd582
3 changed files with 51 additions and 4 deletions
  1. +7
    -3
      apt-pkg/deb/dpkgpm.cc
  2. +1
    -1
      apt-pkg/install-progress.cc
  3. +43
    -0
      test/integration/test-apt-progress-fd-conffile

+ 7
- 3
apt-pkg/deb/dpkgpm.cc View File

@@ -44,6 +44,7 @@
#include <unistd.h>
#include <sys/ioctl.h>
#include <pty.h>
#include <stdio.h>

#include <apti18n.h>
/*}}}*/
@@ -596,7 +597,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line)
errors look like this:
'status: /var/cache/apt/archives/krecipes_0.8.1-0ubuntu1_i386.deb : error : trying to overwrite `/usr/share/doc/kde/HTML/en/krecipes/krectip.png', which is also in package krecipes-data
and conffile-prompt like this
'status: conffile-prompt: conffile : 'current-conffile' 'new-conffile' useredited distedited
'status:/etc/compiz.conf/compiz.conf : conffile-prompt: 'current-conffile' 'new-conffile' useredited distedited
*/
if (prefix == "status")
{
@@ -608,7 +609,7 @@ void pkgDPkgPM::ProcessDpkgStatusLine(char *line)
WriteApportReport(list[1].c_str(), list[3].c_str());
return;
}
else if(action == "conffile")
else if(action == "conffile-prompt")
{
d->progress->ConffilePrompt(list[1], PackagesDone, PackagesTotal,
list[3]);
@@ -1036,7 +1037,10 @@ void pkgDPkgPM::StartPtyMagic()
if (tcgetattr(STDOUT_FILENO, &d->tt) == 0)
{
ioctl(1, TIOCGWINSZ, (char *)&win);
if (openpty(&d->master, &d->slave, NULL, &d->tt, &win) < 0)
if (_config->FindB("Dpkg::Use-Pty", true) == false)
{
d->master = d->slave = -1;
} else if (openpty(&d->master, &d->slave, NULL, &d->tt, &win) < 0)
{
_error->Errno("openpty", _("Can not write log (%s)"), _("Is /dev/pts mounted?"));
d->master = d->slave = -1;


+ 1
- 1
apt-pkg/install-progress.cc View File

@@ -9,7 +9,7 @@
#include <sys/ioctl.h>
#include <sstream>
#include <fcntl.h>
#include <stdio.h>

namespace APT {
namespace Progress {


+ 43
- 0
test/integration/test-apt-progress-fd-conffile View File

@@ -0,0 +1,43 @@
#!/bin/sh
set -e

TESTDIR=$(readlink -f $(dirname $0))
. $TESTDIR/framework

setupenvironment
configarchitecture 'native'

# old conffile
setupsimplenativepackage 'compiz-core' 'native' '1.0' 'unstable'
BUILDDIR='incoming/compiz-core-1.0'
mkdir -p ${BUILDDIR}/debian/compiz-core/etc
echo 'foo=bar;' > ${BUILDDIR}/compiz.conf
echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
rm -rf "$BUILDDIR"

# new conffile
setupsimplenativepackage 'compiz-core' 'native' '2.0' 'unstable'
BUILDDIR='incoming/compiz-core-2.0'
mkdir -p ${BUILDDIR}/debian/compiz-core/etc
echo 'foo2=bar2;' > ${BUILDDIR}/compiz.conf
echo 'compiz.conf /etc/compiz.conf' >> ${BUILDDIR}/debian/install
buildpackage "$BUILDDIR" 'unstable' 'main' 'native'
rm -rf "$BUILDDIR"

setupaptarchive

testsuccess aptget install compiz-core=1.0

# fake conffile change
echo "meep" >> rootdir/etc/compiz.conf/compiz.conf

# install
exec 3> apt-progress.log
echo n | aptget install compiz-core=2.0 -o APT::Status-Fd=3 -o Dpkg::Use-Pty=false

# and ensure there is a conffile message in the file
msgtest "Conffile prompt in apt-progress.log"
grep -q "pmconffile:/etc/compiz.conf/compiz.conf" apt-progress.log && msgpass || (cat apt-progress.log && msgfail)

cat apt-progress.log

Loading…
Cancel
Save