From 233d79a51cc6b922b3f0be0f5c3b460f8ea50d36 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 13 Aug 2013 21:46:32 +0200 Subject: init the pkgTagFile with the size of the Release file Release files are basically one big Section, so we might safe some Resize circles by starting with the filesize. Git-Dch: Ignore --- apt-pkg/deb/deblistparser.cc | 2 +- apt-pkg/indexrecords.cc | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc index c2707d0a5..87aab6ee2 100644 --- a/apt-pkg/deb/deblistparser.cc +++ b/apt-pkg/deb/deblistparser.cc @@ -805,7 +805,7 @@ bool debListParser::LoadReleaseInfo(pkgCache::PkgFileIterator &FileI, map_ptrloc const storage = WriteUniqString(component); FileI->Component = storage; - pkgTagFile TagFile(&File); + pkgTagFile TagFile(&File, File.Size()); pkgTagSection Section; if (_error->PendingError() == true || TagFile.Step(Section) == false) return false; diff --git a/apt-pkg/indexrecords.cc b/apt-pkg/indexrecords.cc index 6d89949a0..8a72ca151 100644 --- a/apt-pkg/indexrecords.cc +++ b/apt-pkg/indexrecords.cc @@ -62,7 +62,7 @@ bool indexRecords::Load(const string Filename) /*{{{*/ if (OpenMaybeClearSignedFile(Filename, Fd) == false) return false; - pkgTagFile TagFile(&Fd); + pkgTagFile TagFile(&Fd, Fd.Size()); if (_error->PendingError() == true) { strprintf(ErrorText, _("Unable to parse Release file %s"),Filename.c_str()); -- cgit v1.2.3 From 1b32290b2e63fa96a3f27c75af04d14d713c4884 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 15 Aug 2013 16:36:32 +0200 Subject: do not call make from libapt/run-tests if its called by make If we are called by make everything is build already and so this is just a noise nop we can just skip. (Noisy as it complains about being unable to communicate with the other makes to coordinate with the jobserver) Git-Dch: Ignore --- test/libapt/run-tests | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/libapt/run-tests b/test/libapt/run-tests index f18be6d2b..4f34b03e8 100755 --- a/test/libapt/run-tests +++ b/test/libapt/run-tests @@ -2,9 +2,11 @@ set -e DIR=$(readlink -f $(dirname $0)) -echo "Compiling the tests …" -(cd $DIR && make) -echo "Running all testcases …" +if [ -z "$MAKELEVEL" ]; then + echo 'Compiling the tests …' + (cd $DIR && make) + echo 'Running all testcases …' +fi LDPATH="$DIR/../../build/bin" EXT="_libapt_test" EXIT_CODE=0 -- cgit v1.2.3 From ca6ab6e37c101f21066d1522c6e9c202856842ca Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 15 Aug 2013 16:41:16 +0200 Subject: rework the parameter creation for the Hashsum test Avoids having to different places from which test binaries are called Git-Dch: Ignore --- test/libapt/run-tests | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/libapt/run-tests b/test/libapt/run-tests index 4f34b03e8..764663020 100755 --- a/test/libapt/run-tests +++ b/test/libapt/run-tests @@ -72,9 +72,11 @@ do "${tmppath}/ftp.de.debian.org_debian_dists_sid_main_i18n_Translation-tlh%5fDE" elif [ $name = "HashSums${EXT}" ]; then TMP="$(readlink -f "./${0}")" - echo -n "Testing with ${NAME} " - LD_LIBRARY_PATH=${LDPATH} ${testapp} $TMP $(md5sum $TMP | cut -d' ' -f 1) $(sha1sum $TMP | cut -d' ' -f 1) $(sha256sum $TMP | cut -d' ' -f 1) $(sha512sum $TMP | cut -d' ' -f 1) && echo "$TESTOKAY" || echo "$TESTFAIL" - continue + tmppath="$TMP" + tmppath="${tmppath} $(md5sum $TMP | cut -d' ' -f 1)" + tmppath="${tmppath} $(sha1sum $TMP | cut -d' ' -f 1)" + tmppath="${tmppath} $(sha256sum $TMP | cut -d' ' -f 1)" + tmppath="${tmppath} $(sha512sum $TMP | cut -d' ' -f 1)" elif [ $name = "CompareVersion${EXT}" ]; then tmppath="${DIR}/versions.lst" elif [ $name = "CdromFindPackages${EXT}" ]; then -- cgit v1.2.3 From 037374fe7260c104771d1b6d31c36a98385c2365 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 15 Aug 2013 16:45:09 +0200 Subject: set MALLOC_CHECK_ and MALLOC_PERTURB_ for testcases In bugreport deb:719629 Paul Wise mentions both to enable some malloc checks and as more testing can't hurt we enable both for all testcases. Git-Dch: Ignore --- test/integration/framework | 8 ++++---- test/libapt/run-tests | 4 ++-- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/test/integration/framework b/test/integration/framework index 72c899e32..54d35fef8 100644 --- a/test/integration/framework +++ b/test/integration/framework @@ -88,11 +88,11 @@ msgdone() { runapt() { msgdebug "Executing: ${CCMD}$*${CDEBUG} " if [ -f ./aptconfig.conf ]; then - APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* - elif [ -f ../aptconfig.conf ]; then - APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* + elif [ -f ../aptconfig.conf ]; then + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 APT_CONFIG=../aptconfig.conf LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* else - LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* + MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${BUILDDIRECTORY} ${BUILDDIRECTORY}/$* fi } aptconfig() { runapt apt-config $*; } diff --git a/test/libapt/run-tests b/test/libapt/run-tests index 764663020..a056f31f9 100755 --- a/test/libapt/run-tests +++ b/test/libapt/run-tests @@ -111,8 +111,8 @@ do fi echo -n "Testing with ${NAME} " - if LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} ; then - echo "$TESTOKAY" + if MALLOC_PERTURB_=21 MALLOC_CHECK_=2 LD_LIBRARY_PATH=${LDPATH} ${testapp} ${tmppath} ; then + echo "$TESTOKAY" else echo "$TESTFAIL" EXIT_CODE=1 -- cgit v1.2.3 From 0aae6d14390193e25ab6d0fd49295bd7b131954f Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 15 Aug 2013 16:49:51 +0200 Subject: ensure that pkgTagFile isn't writing past Buffer length In 91c4cc14d3654636edf997d23852f05ad3de4853 I removed the +256 from the pkgTagFile call parsing Release files as I couldn't find a mentioning of a reason for why and it was marked as XXX which suggested that at least someone else was suspicious. It turns out that it is indeed "documented", it just didn't found it at first but the changelog of apt 0.6.6 (29. Dec 2003) mentions: * Restore the ugly hack I removed from indexRecords::Load which set the pkgTagFile buffer size to (file size)+256. This is concealing a bug, but I can't fix it right now. This should fix the segfaults that folks are seeing with 0.6.[45]. The bug it is "hiding" is that if pkgTagFile works with a file which doesn't end in a double newline it will be adding it without checking if the Buffer is big enough to store them. Its also not a good idea to let the End pointer be past the end of our space, even if we don't access the data. Closes: 719629 --- apt-pkg/tagfile.cc | 33 ++++++++++++++++++++++++--------- apt-pkg/tagfile.h | 1 + 2 files changed, 25 insertions(+), 9 deletions(-) diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index 1c79ee74f..aa0f1eee8 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -50,6 +50,11 @@ public: /* */ pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long long Size) { + /* The size is increased by 4 because if we start with the Size of the + filename we need to try to read 1 char more to see an EOF faster, 1 + char the end-pointer can be on and maybe 2 newlines need to be added + to the end of the file -> 4 extra chars */ + Size += 4; d = new pkgTagFilePrivate(pFd, Size); if (d->Fd.IsOpen() == false) @@ -89,17 +94,21 @@ unsigned long pkgTagFile::Offset() */ bool pkgTagFile::Resize() { - char *tmp; - unsigned long long EndSize = d->End - d->Start; - // fail is the buffer grows too big if(d->Size > 1024*1024+1) return false; + return Resize(d->Size * 2); +} +bool pkgTagFile::Resize(unsigned long long const newSize) +{ + unsigned long long const EndSize = d->End - d->Start; + char *tmp; + // get new buffer and use it - tmp = new char[2*d->Size]; + tmp = new char[newSize]; memcpy(tmp, d->Buffer, d->Size); - d->Size = d->Size*2; + d->Size = newSize; delete [] d->Buffer; d->Buffer = tmp; @@ -152,9 +161,10 @@ bool pkgTagFile::Fill() if (d->Done == false) { // See if only a bit of the file is left - if (d->Fd.Read(d->End, d->Size - (d->End - d->Buffer),&Actual) == false) + unsigned long long const dataSize = d->Size - ((d->End - d->Buffer) + 1); + if (d->Fd.Read(d->End, dataSize, &Actual) == false) return false; - if (Actual != d->Size - (d->End - d->Buffer)) + if (Actual != dataSize || d->Fd.Eof() == true) d->Done = true; d->End += Actual; } @@ -171,8 +181,13 @@ bool pkgTagFile::Fill() for (const char *E = d->End - 1; E - d->End < 6 && (*E == '\n' || *E == '\r'); E--) if (*E == '\n') LineCount++; - for (; LineCount < 2; LineCount++) - *d->End++ = '\n'; + if (LineCount < 2) + { + if ((unsigned)(d->End - d->Buffer) >= d->Size) + Resize(d->Size + 3); + for (; LineCount < 2; LineCount++) + *d->End++ = '\n'; + } return true; } diff --git a/apt-pkg/tagfile.h b/apt-pkg/tagfile.h index fedd72701..66c56799d 100644 --- a/apt-pkg/tagfile.h +++ b/apt-pkg/tagfile.h @@ -95,6 +95,7 @@ class pkgTagFile bool Fill(); bool Resize(); + bool Resize(unsigned long long const newSize); public: -- cgit v1.2.3 From 4b2803b8ff72b0c865c6539b2f99abea5ceee4c6 Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Thu, 15 Aug 2013 17:26:30 +0200 Subject: use malloc instead of new[] in pkgTagFile We don't need initialized memory for pkgTagFile, but more to the point we can use realloc this way which hides the bloody details of increasing the size of the buffer used. Git-Dch: Ignore --- apt-pkg/tagfile.cc | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/apt-pkg/tagfile.cc b/apt-pkg/tagfile.cc index aa0f1eee8..10bc08d95 100644 --- a/apt-pkg/tagfile.cc +++ b/apt-pkg/tagfile.cc @@ -58,18 +58,19 @@ pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long long Size) d = new pkgTagFilePrivate(pFd, Size); if (d->Fd.IsOpen() == false) - { d->Start = d->End = d->Buffer = 0; + else + d->Buffer = (char*)malloc(sizeof(char) * Size); + + if (d->Buffer == NULL) d->Done = true; - d->iOffset = 0; - return; - } - - d->Buffer = new char[Size]; + else + d->Done = false; + d->Start = d->End = d->Buffer; - d->Done = false; d->iOffset = 0; - Fill(); + if (d->Done == false) + Fill(); } /*}}}*/ // TagFile::~pkgTagFile - Destructor /*{{{*/ @@ -77,11 +78,11 @@ pkgTagFile::pkgTagFile(FileFd *pFd,unsigned long long Size) /* */ pkgTagFile::~pkgTagFile() { - delete [] d->Buffer; + free(d->Buffer); delete d; } /*}}}*/ -// TagFile::Offset - Return the current offset in the buffer /*{{{*/ +// TagFile::Offset - Return the current offset in the buffer /*{{{*/ unsigned long pkgTagFile::Offset() { return d->iOffset; @@ -103,14 +104,13 @@ bool pkgTagFile::Resize() bool pkgTagFile::Resize(unsigned long long const newSize) { unsigned long long const EndSize = d->End - d->Start; - char *tmp; // get new buffer and use it - tmp = new char[newSize]; - memcpy(tmp, d->Buffer, d->Size); + char* newBuffer = (char*)realloc(d->Buffer, sizeof(char) * newSize); + if (newBuffer == NULL) + return false; + d->Buffer = newBuffer; d->Size = newSize; - delete [] d->Buffer; - d->Buffer = tmp; // update the start/end pointers to the new buffer d->Start = d->Buffer; -- cgit v1.2.3 From 48498443e74b2a7e089709b954c50b7df374684b Mon Sep 17 00:00:00 2001 From: David Kalnischkies Date: Tue, 13 Aug 2013 18:18:15 +0200 Subject: allow Pre-Install-Pkgs hooks to get info over an FD != stdin This adds ::InfoFD option alongside the ::Version one to request sending the information to the specified FD, by default it is STDIN as it was the case before. The environment variable APT_HOOK_INFO_FD contains the FD the data is on as a confirmation that the APT version used understood the request. Allowing the hook to choose the FD is needed/helpful e.g. for shellscripts which have a hard time accessing FDs above 9 (as >= 10 are usually used internally by them) Closes: #671728 --- apt-pkg/deb/dpkgpm.cc | 20 +++-- doc/apt.conf.5.xml | 13 ++- ...bug-712116-dpkg-pre-install-pkgs-hook-multiarch | 94 +++++++++++++--------- 3 files changed, 81 insertions(+), 46 deletions(-) diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc index 959d06455..4b5467eff 100644 --- a/apt-pkg/deb/dpkgpm.cc +++ b/apt-pkg/deb/dpkgpm.cc @@ -382,24 +382,32 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf) OptSec = "DPkg::Tools::Options::" + string(Opts->Value.c_str(),Pos); unsigned int Version = _config->FindI(OptSec+"::Version",1); + unsigned int InfoFD = _config->FindI(OptSec + "::InfoFD", STDIN_FILENO); // Create the pipes int Pipes[2]; if (pipe(Pipes) != 0) return _error->Errno("pipe","Failed to create IPC pipe to subprocess"); - SetCloseExec(Pipes[0],true); + if (InfoFD != (unsigned)Pipes[0]) + SetCloseExec(Pipes[0],true); + else + _config->Set("APT::Keep-Fds::", Pipes[0]); SetCloseExec(Pipes[1],true); - + // Purified Fork for running the script - pid_t Process = ExecFork(); + pid_t Process = ExecFork(); if (Process == 0) { // Setup the FDs - dup2(Pipes[0],STDIN_FILENO); + dup2(Pipes[0], InfoFD); SetCloseExec(STDOUT_FILENO,false); - SetCloseExec(STDIN_FILENO,false); + SetCloseExec(STDIN_FILENO,false); SetCloseExec(STDERR_FILENO,false); + string hookfd; + strprintf(hookfd, "%d", InfoFD); + setenv("APT_HOOK_INFO_FD", hookfd.c_str(), 1); + dpkgChrootDirectory(); const char *Args[4]; Args[0] = "/bin/sh"; @@ -409,6 +417,8 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf) execv(Args[0],(char **)Args); _exit(100); } + if (InfoFD == (unsigned)Pipes[0]) + _config->Clear("APT::Keep-Fds", Pipes[0]); close(Pipes[0]); FILE *F = fdopen(Pipes[1],"w"); if (F == 0) diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml index f5e1f966d..42119baa5 100644 --- a/doc/apt.conf.5.xml +++ b/doc/apt.conf.5.xml @@ -688,7 +688,8 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";}; options this must be specified in list notation. The commands are invoked in order using /bin/sh; should any fail APT will abort. APT will pass the filenames of all .deb files it is going to - install to the commands, one per line on standard input. + install to the commands, one per line on the requested file descriptor, defaulting + to standard input. Version 2 of this protocol dumps more information, including the protocol version, the APT configuration space and the packages, files @@ -700,7 +701,15 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";}; DPkg::Tools::options::cmd::Version accordingly, the default being version 1. If APT isn't supporting the requested version it will send the information in the highest version it has support for instead. - + + + The file descriptor to be used to send the information can be requested with + DPkg::Tools::options::cmd::InfoFD + which defaults to 0 for standard input and is available since + version 0.9.11. Support for the option can be detected by looking for the environment + variable APT_HOOK_INFO_FD which contains the number of the used + file descriptor as a confirmation. + diff --git a/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch b/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch index af65397ea..62355a6b5 100755 --- a/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch +++ b/test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch @@ -26,95 +26,111 @@ hook='pre-install-pkgs' enablehookversion() { echo "#!/bin/sh -while read line; do +FD=0 +echo -n > ${hook}-v${1}.list +if [ -n \"${2}\" ]; then + FD=\$APT_HOOK_INFO_FD + if [ "\$FD" != \"${2}\" ]; then echo \"ERROR: Information is not on requested FD: \$FD != ${2}\" >> ${hook}-v${1}.list; fi +fi +while read ${hook}-v${1}.list" > ${hook}-v${1}.sh +done >> ${hook}-v${1}.list" > ${hook}-v${1}.sh chmod +x ${hook}-v${1}.sh echo "dpkg::${hook}:: \"./${hook}-v${1}.sh --foo -bar\"; DPkg::Tools::options::\"./${hook}-v${1}.sh\"::Version \"$1\";" > rootdir/etc/apt/apt.conf.d/hook-v$1 + if [ -n "$2" ]; then + echo "DPkg::Tools::options::\"./${hook}-v${1}.sh\"::InfoFD \"${2}\";" >> rootdir/etc/apt/apt.conf.d/hook-v$1 + fi } -enablehookversion 2 -enablehookversion 3 - observehook() { rm -f ${hook}-v2.list ${hook}-v3.list msgtest 'Observe hooks while' "$*" testsuccess --nomsg aptget "$@" -y --force-yes } -observehook install stuff -t stable -testfileequal "${hook}-v2.list" 'libsame - < 1 **CONFIGURE** +testrun() { + observehook install stuff -t stable + testfileequal "${hook}-v2.list" 'libsame - < 1 **CONFIGURE** toolkit - < 1 **CONFIGURE** stuff - < 1 **CONFIGURE**' -testfileequal "${hook}-v3.list" 'libsame - - none < 1 amd64 same **CONFIGURE** + testfileequal "${hook}-v3.list" 'libsame - - none < 1 amd64 same **CONFIGURE** toolkit - - none < 1 all foreign **CONFIGURE** stuff - - none < 1 amd64 none **CONFIGURE**' -observehook install stuff -t unstable -testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE** + observehook install stuff -t unstable + testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE** toolkit 1 < 2 **CONFIGURE** stuff 1 < 2 **CONFIGURE**' -testfileequal "${hook}-v3.list" 'libsame 1 amd64 same < 2 amd64 same **CONFIGURE** + testfileequal "${hook}-v3.list" 'libsame 1 amd64 same < 2 amd64 same **CONFIGURE** toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE** stuff 1 amd64 none < 2 amd64 none **CONFIGURE**' -observehook install stuff:i386 -t unstable -testfileequal "${hook}-v2.list" 'stuff 2 > - **REMOVE** + observehook install stuff:i386 -t unstable + testfileequal "${hook}-v2.list" 'stuff 2 > - **REMOVE** libsame - < 2 **CONFIGURE** stuff - < 2 **CONFIGURE**' -testfileequal "${hook}-v3.list" 'stuff 2 amd64 none > - - none **REMOVE** + testfileequal "${hook}-v3.list" 'stuff 2 amd64 none > - - none **REMOVE** libsame - - none < 2 i386 same **CONFIGURE** stuff - - none < 2 i386 none **CONFIGURE**' -observehook remove libsame -testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**' -testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**' + observehook remove libsame + testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE**' + testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE**' -observehook install stuff:i386/stable libsame:i386/stable toolkit/stable -testfileequal "${hook}-v2.list" 'libsame 2 > 1 **CONFIGURE** + observehook install stuff:i386/stable libsame:i386/stable toolkit/stable + testfileequal "${hook}-v2.list" 'libsame 2 > 1 **CONFIGURE** toolkit 2 > 1 **CONFIGURE** stuff 2 > 1 **CONFIGURE**' -testfileequal "${hook}-v3.list" 'libsame 2 i386 same > 1 i386 same **CONFIGURE** + testfileequal "${hook}-v3.list" 'libsame 2 i386 same > 1 i386 same **CONFIGURE** toolkit 2 amd64 foreign > 1 all foreign **CONFIGURE** stuff 2 i386 none > 1 i386 none **CONFIGURE**' -observehook install 'libsame:*' -testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE** + observehook install 'libsame:*' + testfileequal "${hook}-v2.list" 'libsame 1 < 2 **CONFIGURE** libsame - < 2 **CONFIGURE** toolkit 1 < 2 **CONFIGURE** stuff 1 < 2 **CONFIGURE**' -testfileequal "${hook}-v3.list" 'libsame 1 i386 same < 2 i386 same **CONFIGURE** + testfileequal "${hook}-v3.list" 'libsame 1 i386 same < 2 i386 same **CONFIGURE** libsame - - none < 2 amd64 same **CONFIGURE** toolkit 1 all foreign < 2 amd64 foreign **CONFIGURE** stuff 1 i386 none < 2 i386 none **CONFIGURE**' -observehook purge stuff:i386 'libsame:*' toolkit -testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE** + observehook purge stuff:i386 'libsame:*' toolkit + testfileequal "${hook}-v2.list" 'libsame 2 > - **REMOVE** stuff 2 > - **REMOVE** libsame 2 > - **REMOVE** toolkit 2 > - **REMOVE**' -testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE** + testfileequal "${hook}-v3.list" 'libsame 2 amd64 same > - - none **REMOVE** stuff 2 i386 none > - - none **REMOVE** libsame 2 i386 same > - - none **REMOVE** toolkit 2 amd64 foreign > - - none **REMOVE**' -observehook install confpkg -testfileequal "${hook}-v2.list" 'confpkg - < 1 **CONFIGURE**' -testfileequal "${hook}-v3.list" 'confpkg - - none < 1 amd64 none **CONFIGURE**' + observehook install confpkg + testfileequal "${hook}-v2.list" 'confpkg - < 1 **CONFIGURE**' + testfileequal "${hook}-v3.list" 'confpkg - - none < 1 amd64 none **CONFIGURE**' + + observehook remove confpkg + testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**' + testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**' -observehook remove confpkg -testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**' -testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**' + msgtest 'Conffiles of package remained after remove' 'confpkg' + dpkg -l confpkg | grep -q '^rc' && msgpass || msgfail -msgtest 'Conffiles of package remained after remove' 'confpkg' -dpkg -l confpkg | grep -q '^rc' && msgpass || msgfail + observehook purge confpkg + testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**' + testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**' -observehook purge confpkg -testfileequal "${hook}-v2.list" 'confpkg 1 > - **REMOVE**' -testfileequal "${hook}-v3.list" 'confpkg 1 amd64 none > - - none **REMOVE**' + msgtest 'Conffiles are gone after purge' 'confpkg' + dpkg -l confpkg 2>/dev/null | grep -q '^rc' && msgfail || msgpass +} + +enablehookversion 2 +enablehookversion 3 +testrun -msgtest 'Conffiles are gone after purge' 'confpkg' -dpkg -l confpkg 2>/dev/null | grep -q '^rc' && msgfail || msgpass +enablehookversion 2 13 +enablehookversion 3 13 +testrun -- cgit v1.2.3