Sfoglia il codice sorgente

Merge branch 'debian/sid' of git://git.debian.org/git/apt/apt into debian/sid

Christian PERRIER 13 anni fa
parent
commit
010364b7b5
51 ha cambiato i file con 713 aggiunte e 7512 eliminazioni
  1. 0 7325
      abicheck/abi-compliance-checker.pl
  2. 6 1
      abicheck/run_abi_test
  3. 27 4
      apt-pkg/acquire-item.cc
  4. 2 0
      apt-pkg/acquire-item.h
  5. 12 0
      apt-pkg/contrib/configuration.cc
  6. 1 0
      apt-pkg/contrib/configuration.h
  7. 31 0
      apt-pkg/contrib/fileutl.cc
  8. 3 0
      apt-pkg/contrib/fileutl.h
  9. 22 15
      apt-pkg/deb/dpkgpm.cc
  10. 2 1
      cmdline/apt-cdrom.cc
  11. 6 0
      cmdline/apt-get.cc
  12. 125 46
      cmdline/apt-key
  13. 9 5
      debian/apt.postinst
  14. 57 2
      debian/changelog
  15. 6 4
      doc/apt.conf.5.xml
  16. 77 10
      test/integration/framework
  17. BIN
      test/integration/rexexpired.pub
  18. BIN
      test/integration/rexexpired.sec
  19. 1 1
      test/integration/skip-avoid-avoiding-breaks-predepends
  20. 1 1
      test/integration/test-apt-cdrom
  21. 5 5
      test/integration/test-apt-get-autoremove
  22. 107 0
      test/integration/test-apt-key
  23. 2 2
      test/integration/test-bug-407511-fail-invalid-default-release
  24. 2 2
      test/integration/test-bug-602412-dequote-redirect
  25. 1 1
      test/integration/test-bug-604222-new-and-autoremove
  26. 5 5
      test/integration/test-bug-604401-files-are-directories
  27. 10 10
      test/integration/test-bug-611729-mark-as-manual
  28. 8 8
      test/integration/test-bug-612099-multiarch-conflicts
  29. 2 2
      test/integration/test-bug-612557-garbage-upgrade
  30. 2 2
      test/integration/test-bug-612958-use-dpkg-multiarch-config
  31. 1 1
      test/integration/test-bug-613420-new-garbage-dependency
  32. 1 1
      test/integration/test-bug-618288-multiarch-same-lockstep
  33. 1 1
      test/integration/test-bug-64141-install-dependencies-for-on-hold
  34. 2 2
      test/integration/test-bug-673536-pre-depends-breaks-loop
  35. 2 2
      test/integration/test-bug-679371-apt-get-autoclean-multiarch
  36. 2 2
      test/integration/test-bug-686346-package-missing-architecture
  37. 1 1
      test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch
  38. 2 2
      test/integration/test-bug-717891-abolute-uris-for-proxies
  39. 41 0
      test/integration/test-bug-719263-print-uris-removes-authentication
  40. 17 17
      test/integration/test-compressed-indexes
  41. 1 1
      test/integration/test-cve-2013-1051-InRelease-parsing
  42. 1 1
      test/integration/test-disappearing-packages
  43. 2 2
      test/integration/test-pdiff-usage
  44. 4 4
      test/integration/test-policy-pinning
  45. 16 16
      test/integration/test-releasefile-valid-until
  46. 33 2
      test/integration/test-releasefile-verification
  47. 2 4
      test/integration/test-ubuntu-bug-761175-remove-purge
  48. 1 1
      test/integration/test-ubuntu-bug-784473-InRelease-one-message-only
  49. 4 0
      test/libapt/configuration_test.cc
  50. 42 0
      test/libapt/fileutl_test.cc
  51. 5 0
      test/libapt/makefile

File diff suppressed because it is too large
+ 0 - 7325
abicheck/abi-compliance-checker.pl


+ 6 - 1
abicheck/run_abi_test

@@ -5,10 +5,15 @@ if [ ! -d ../build ]; then
 	exit 1
 fi
 
+if [ ! -x "$(which abi-compliance-checker 2>/dev/null )" ]; then
+	echo "Please install the 'abi-compliance-checker' package"
+	exit 1
+fi
+
 LIBPATH=$(find /usr/lib/ -type f  -name "libapt-*.so.*" -printf %p\\\\n)
 sed s#@installed_libapt@#$LIBPATH# apt_installed.xml.in > apt_installed.xml
 
 BUILDPATH=$(readlink -f ../build)
 sed s#@build_path@#$BUILDPATH# apt_build.xml.in > apt_build.xml
 
-perl abi-compliance-checker.pl -l apt -d1 apt_installed.xml -d2 apt_build.xml
+abi-compliance-checker -l apt -d1 apt_installed.xml -d2 apt_build.xml

+ 27 - 4
apt-pkg/acquire-item.cc

@@ -1067,8 +1067,7 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,				/*{{{*/
       
    string Final = _config->FindDir("Dir::State::lists");
    Final += URItoFileName(RealURI);
-   struct stat Buf;
-   if (stat(Final.c_str(),&Buf) == 0)
+   if (RealFileExists(Final) == true)
    {
       // File was already in place.  It needs to be re-downloaded/verified
       // because Release might have changed, we do give it a differnt
@@ -1080,6 +1079,19 @@ pkgAcqMetaSig::pkgAcqMetaSig(pkgAcquire *Owner,				/*{{{*/
    }
 
    QueueURI(Desc);
+}
+									/*}}}*/
+pkgAcqMetaSig::~pkgAcqMetaSig()						/*{{{*/
+{
+   // if the file was never queued undo file-changes done in the constructor
+   if (QueueCounter == 1 && Status == StatIdle && FileSize == 0 && Complete == false &&
+	 LastGoodSig.empty() == false)
+   {
+      string const Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
+      if (RealFileExists(Final) == false && RealFileExists(LastGoodSig) == true)
+	 Rename(LastGoodSig, Final);
+   }
+
 }
 									/*}}}*/
 // pkgAcqMetaSig::Custom600Headers - Insert custom request headers	/*{{{*/
@@ -1595,14 +1607,25 @@ pkgAcqMetaClearSig::pkgAcqMetaClearSig(pkgAcquire *Owner,		/*{{{*/
 
    // keep the old InRelease around in case of transistent network errors
    string const Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
-   struct stat Buf;
-   if (stat(Final.c_str(),&Buf) == 0)
+   if (RealFileExists(Final) == true)
    {
       string const LastGoodSig = DestFile + ".reverify";
       Rename(Final,LastGoodSig);
    }
 }
 									/*}}}*/
+pkgAcqMetaClearSig::~pkgAcqMetaClearSig()				/*{{{*/
+{
+   // if the file was never queued undo file-changes done in the constructor
+   if (QueueCounter == 1 && Status == StatIdle && FileSize == 0 && Complete == false)
+   {
+      string const Final = _config->FindDir("Dir::State::lists") + URItoFileName(RealURI);
+      string const LastGoodSig = DestFile + ".reverify";
+      if (RealFileExists(Final) == false && RealFileExists(LastGoodSig) == true)
+	 Rename(LastGoodSig, Final);
+   }
+}
+									/*}}}*/
 // pkgAcqMetaClearSig::Custom600Headers - Insert custom request headers	/*{{{*/
 // ---------------------------------------------------------------------
 // FIXME: this can go away once the InRelease file is used widely

+ 2 - 0
apt-pkg/acquire-item.h

@@ -774,6 +774,7 @@ class pkgAcqMetaSig : public pkgAcquire::Item
 		 std::string MetaIndexURI, std::string MetaIndexURIDesc, std::string MetaIndexShortDesc,
 		 const std::vector<struct IndexTarget*>* IndexTargets,
 		 indexRecords* MetaIndexParser);
+   virtual ~pkgAcqMetaSig();
 };
 									/*}}}*/
 /** \brief An item that is responsible for downloading the meta-index	{{{
@@ -904,6 +905,7 @@ public:
 		std::string const &MetaSigURI, std::string const &MetaSigURIDesc, std::string const &MetaSigShortDesc,
 		const std::vector<struct IndexTarget*>* IndexTargets,
 		indexRecords* MetaIndexParser);
+   virtual ~pkgAcqMetaClearSig();
 };
 									/*}}}*/
 /** \brief An item that is responsible for fetching a package file.	{{{

+ 12 - 0
apt-pkg/contrib/configuration.cc

@@ -420,6 +420,18 @@ void Configuration::Clear(string const &Name, string const &Value)
       }
    }
      
+}
+									/*}}}*/
+// Configuration::Clear - Clear everything				/*{{{*/
+// ---------------------------------------------------------------------
+void Configuration::Clear()
+{
+   const Configuration::Item *Top = Tree(0);
+   while( Top != 0 )
+   {
+      Clear(Top->FullTag());
+      Top = Top->Next;
+   }
 }
 									/*}}}*/
 // Configuration::Clear - Clear an entire tree				/*{{{*/

+ 1 - 0
apt-pkg/contrib/configuration.h

@@ -94,6 +94,7 @@ class Configuration
 
    // clear a whole tree
    void Clear(const std::string &Name);
+   void Clear();
 
    // remove a certain value from a list (e.g. the list of "APT::Keep-Fds")
    void Clear(std::string const &List, std::string const &Value);

+ 31 - 0
apt-pkg/contrib/fileutl.cc

@@ -41,6 +41,8 @@
 #include <dirent.h>
 #include <signal.h>
 #include <errno.h>
+#include <glob.h>
+
 #include <set>
 #include <algorithm>
 
@@ -1766,3 +1768,32 @@ bool FileFd::FileFdError(const char *Description,...) {
 									/*}}}*/
 
 gzFile FileFd::gzFd() { return (gzFile) d->gz; }
+
+
+// Glob - wrapper around "glob()"                                      /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+std::vector<std::string> Glob(std::string const &pattern, int flags)
+{
+   std::vector<std::string> result;
+   glob_t globbuf;
+   int glob_res, i;
+
+   glob_res = glob(pattern.c_str(),  flags, NULL, &globbuf);
+
+   if (glob_res != 0)
+   {
+      if(glob_res != GLOB_NOMATCH) {
+         _error->Errno("glob", "Problem with glob");
+         return result;
+      }
+   }
+
+   // append results
+   for(i=0;i<globbuf.gl_pathc;i++)
+      result.push_back(string(globbuf.gl_pathv[i]));
+
+   globfree(&globbuf);
+   return result;
+}
+									/*}}}*/

+ 3 - 0
apt-pkg/contrib/fileutl.h

@@ -191,4 +191,7 @@ std::string flNoLink(std::string File);
 std::string flExtension(std::string File);
 std::string flCombine(std::string Dir,std::string File);
 
+// simple c++ glob
+std::vector<std::string> Glob(std::string const &pattern, int flags=0);
+
 #endif

+ 22 - 15
apt-pkg/deb/dpkgpm.cc

@@ -751,14 +751,15 @@ bool pkgDPkgPM::OpenLog()
 	 return _error->WarningE("OpenLog", _("Could not open file '%s'"), logfile_name.c_str());
       setvbuf(d->term_out, NULL, _IONBF, 0);
       SetCloseExec(fileno(d->term_out), true);
-      struct passwd *pw;
-      struct group *gr;
-      pw = getpwnam("root");
-      gr = getgrnam("adm");
-      if (pw != NULL && gr != NULL)
-         if(chown(logfile_name.c_str(), pw->pw_uid, gr->gr_gid) != 0)
-            _error->Errno("OpenLog", "chown failed");
-      chmod(logfile_name.c_str(), 0640);
+      if (getuid() == 0) // if we aren't root, we can't chown a file, so don't try it
+      {
+	 struct passwd *pw = getpwnam("root");
+	 struct group *gr = getgrnam("adm");
+	 if (pw != NULL && gr != NULL && chown(logfile_name.c_str(), pw->pw_uid, gr->gr_gid) != 0)
+	    _error->WarningE("OpenLog", "chown to root:adm of file %s failed", logfile_name.c_str());
+      }
+      if (chmod(logfile_name.c_str(), 0640) != 0)
+	 _error->WarningE("OpenLog", "chmod 0640 of file %s failed", logfile_name.c_str());
       fprintf(d->term_out, "\nLog started: %s\n", timestr);
    }
 
@@ -1237,16 +1238,13 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 
       // if tcgetattr does not return zero there was a error
       // and we do not do any pty magic
-      if (tcgetattr(0, &tt) == 0)
+      _error->PushToStack();
+      if (tcgetattr(STDOUT_FILENO, &tt) == 0)
       {
 	 ioctl(0, TIOCGWINSZ, (char *)&win);
-	 if (openpty(&master, &slave, NULL, &tt, &win) < 0) 
+	 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);
-            if(d->term_out)
-              fprintf(d->term_out, "%s",s);
+	    _error->Errno("openpty", _("Can not write log (%s)"), _("Is /dev/pts mounted?"));
 	    master = slave = -1;
 	 }  else {
 	    struct termios rtt;
@@ -1264,6 +1262,15 @@ bool pkgDPkgPM::Go(int OutStatusFd)
 	    sigprocmask(SIG_SETMASK, &original_sigmask, 0);
 	 }
       }
+      // complain only if stdout is either a terminal (but still failed) or is an invalid
+      // descriptor otherwise we would complain about redirection to e.g. /dev/null as well.
+      else if (isatty(STDOUT_FILENO) == 1 || errno == EBADF)
+         _error->Errno("tcgetattr", _("Can not write log (%s)"), _("Is stdout a terminal?"));
+
+      if (_error->PendingError() == true)
+	 _error->DumpErrors(std::cerr);
+      _error->RevertToStack();
+
        // Fork dpkg
       pid_t Child;
       _config->Set("APT::Keep-Fds::",fd[1]);

+ 2 - 1
cmdline/apt-cdrom.cc

@@ -67,7 +67,8 @@ void pkgCdromTextStatus::Prompt(const char *Text)
    char C;
    cout << Text << ' ' << flush;
    if (read(STDIN_FILENO,&C,1) < 0)
-      _error->Errno("pkgCdromTextStatus::Prompt", "failed to prompt");
+      _error->Errno("pkgCdromTextStatus::Prompt", 
+                    "Failed to read from standard input (not a terminal?)");
    if (C != '\n')
       cout << endl;
 }

+ 6 - 0
cmdline/apt-get.cc

@@ -1874,6 +1874,9 @@ bool DoAutomaticRemove(CacheFile &Cache)
    packages */
 bool DoUpgrade(CommandLine &CmdL)
 {
+   if (CmdL.FileSize() != 1)
+      return _error->Error(_("The upgrade command takes no arguments"));
+
    CacheFile Cache;
    if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
       return false;
@@ -2206,6 +2209,9 @@ bool DoMarkAuto(CommandLine &CmdL)
 /* Intelligent upgrader that will install and remove packages at will */
 bool DoDistUpgrade(CommandLine &CmdL)
 {
+   if (CmdL.FileSize() != 1)
+      return _error->Error(_("The dist-upgrade command takes no arguments"));
+
    CacheFile Cache;
    if (Cache.OpenForInstall() == false || Cache.CheckDeps() == false)
       return false;

+ 125 - 46
cmdline/apt-key

@@ -3,27 +3,39 @@
 set -e
 unset GREP_OPTIONS
 
-# We don't use a secret keyring, of course, but gpg panics and
-# implodes if there isn't one available
-SECRETKEYRING="$(mktemp)"
-trap "rm -f '${SECRETKEYRING}'" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
-GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring --secret-keyring ${SECRETKEYRING}"
+GPG_CMD="gpg --ignore-time-conflict --no-options --no-default-keyring"
 
-if [ "$(id -u)" -eq 0 ]; then
-	# we could use a tmpfile here too, but creation of this tends to be time-consuming
-	eval $(apt-config shell TRUSTDBDIR Dir::Etc/d)
-	GPG_CMD="$GPG_CMD --trustdb-name ${TRUSTDBDIR}/trustdb.gpg"
-fi
+# gpg needs a trustdb to function, but it can't be invalid (not even empty)
+# so we create a temporary directory to store our fresh readable trustdb in
+TRUSTDBDIR="$(mktemp -d)"
+CURRENTTRAP="${CURRENTTRAP} rm -rf '${TRUSTDBDIR}';"
+trap "${CURRENTTRAP}" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+chmod 700 "$TRUSTDBDIR"
+# We also don't use a secret keyring, of course, but gpg panics and
+# implodes if there isn't one available - and writeable for imports
+SECRETKEYRING="${TRUSTDBDIR}/secring.gpg"
+touch $SECRETKEYRING
+GPG_CMD="$GPG_CMD --secret-keyring $SECRETKEYRING"
+GPG_CMD="$GPG_CMD --trustdb-name ${TRUSTDBDIR}/trustdb.gpg"
+
+# now create the trustdb with an (empty) dummy keyring
+$GPG_CMD --quiet --check-trustdb --keyring $SECRETKEYRING
+# and make sure that gpg isn't trying to update the file
+GPG_CMD="$GPG_CMD --no-auto-check-trustdb --trust-model always"
 
 GPG="$GPG_CMD"
 
 MASTER_KEYRING=""
-ARCHIVE_KEYRING_URI=""
 #MASTER_KEYRING=/usr/share/keyrings/debian-master-keyring.gpg
+eval $(apt-config shell MASTER_KEYRING APT::Key::MasterKeyring)
+ARCHIVE_KEYRING_URI=""
 #ARCHIVE_KEYRING_URI=http://ftp.debian.org/debian/debian-archive-keyring.gpg
+eval $(apt-config shell ARCHIVE_KEYRING_URI APT::Key::ArchiveKeyringURI)
 
 ARCHIVE_KEYRING=/usr/share/keyrings/debian-archive-keyring.gpg
+eval $(apt-config shell ARCHIVE_KEYRING APT::Key::ArchiveKeyring)
 REMOVED_KEYS=/usr/share/keyrings/debian-archive-removed-keys.gpg
+eval $(apt-config shell REMOVED_KEYS APT::Key::RemovedKeys)
 
 requires_root() {
 	if [ "$(id -u)" -ne 0 ]; then
@@ -139,6 +151,60 @@ update() {
     fi
 }
 
+remove_key_from_keyring() {
+    local GPG="$GPG_CMD --keyring $1"
+    # check if the key is in this keyring: the key id is in the 5 column at the end
+    if ! $GPG --with-colons --list-keys 2>&1 | grep -q "^pub:[^:]*:[^:]*:[^:]*:[0-9A-F]\+$2:"; then
+	return
+    fi
+    if [ ! -w "$1" ]; then
+	echo >&2 "Key ${2} is in keyring ${1}, but can't be removed as it is read only."
+	return
+    fi
+    # check if it is the only key in the keyring and if so remove the keyring alltogether
+    if [ '1' = "$($GPG --with-colons --list-keys | grep "^pub:[^:]*:[^:]*:[^:]*:[0-9A-F]\+:" | wc -l)" ]; then
+	mv -f "$1" "${1}~" # behave like gpg
+	return
+    fi
+    # we can't just modify pointed to files as these might be in /usr or something
+    local REALTARGET
+    if [ -L "$1" ]; then
+	REALTARGET="$(readlink -f "$1")"
+	mv -f "$1" "${1}.dpkg-tmp"
+	cp -a "$REALTARGET" "$1"
+	ls "$(dirname $1)"
+    fi
+    # delete the key from the keyring
+    $GPG --batch --delete-key --yes "$2"
+    if [ -n "$REALTARGET" ]; then
+	# the real backup is the old link, not the copy we made
+	mv -f "${1}.dpkg-tmp" "${1}~"
+    fi
+}
+
+remove_key() {
+    requires_root
+
+    # if a --keyring was given, just remove from there
+    if [ -n "$FORCED_KEYRING" ]; then
+	remove_key_from_keyring "$FORCED_KEYRING" "$1"
+    else
+	# otherwise all known keyrings are up for inspection
+	local TRUSTEDFILE="/etc/apt/trusted.gpg"
+	eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring)
+	eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f)
+	remove_key_from_keyring "$TRUSTEDFILE" "$1"
+	TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
+	eval $(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)
+	if [ -d "$TRUSTEDPARTS" ]; then
+	    for trusted in $(run-parts --list "$TRUSTEDPARTS" --regex '^.*\.gpg$'); do
+		remove_key_from_keyring "$trusted" "$1"
+	    done
+	fi
+    fi
+    echo "OK"
+}
+
 
 usage() {
     echo "Usage: apt-key [--keyring file] [command] [arguments]"
@@ -158,39 +224,54 @@ usage() {
     echo "If no specific keyring file is given the command applies to all keyring files."
 }
 
-# Determine on which keyring we want to work
-if [ "$1" = "--keyring" ]; then
-        #echo "keyfile given"
-	shift
-	TRUSTEDFILE="$1"
-	if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ] || [ "$2" = 'adv' ]; then
-		GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
-	else
-		echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"
-		exit 1
-	fi
-	shift
-# otherwise use the default
-else
-	#echo "generate list"
-	TRUSTEDFILE="/etc/apt/trusted.gpg"
-	eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring)
-	eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f)
-	if [ -r "$TRUSTEDFILE" ]; then
-		GPG="$GPG --keyring $TRUSTEDFILE"
-	fi
-	GPG="$GPG --primary-keyring $TRUSTEDFILE"
-	TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
-	eval $(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)
-	if [ -d "$TRUSTEDPARTS" ]; then
-		#echo "parts active"
-		for trusted in $(run-parts --list $TRUSTEDPARTS --regex '^.*\.gpg$'); do
-			#echo "part -> $trusted"
-			GPG="$GPG --keyring $trusted"
-		done
-	fi
+while [ -n "$1" ]; do
+   case "$1" in
+      --keyring)
+	 shift
+	 TRUSTEDFILE="$1"
+	 FORCED_KEYRING="$1"
+	 if [ -r "$TRUSTEDFILE" ] || [ "$2" = 'add' ] || [ "$2" = 'adv' ]; then
+	    GPG="$GPG --keyring $TRUSTEDFILE --primary-keyring $TRUSTEDFILE"
+	 else
+	    echo >&2 "Error: The specified keyring »$TRUSTEDFILE« is missing or not readable"
+	    exit 1
+	 fi
+	 shift
+	 ;;
+      --fakeroot)
+	 requires_root() { true; }
+	 shift
+	 ;;
+      --*)
+	 echo >&2 "Unknown option: $1"
+	 usage
+	 exit 1;;
+      *)
+	 break;;
+   esac
+done
+
+if [ -z "$TRUSTEDFILE" ]; then
+   TRUSTEDFILE="/etc/apt/trusted.gpg"
+   eval $(apt-config shell TRUSTEDFILE Apt::GPGV::TrustedKeyring)
+   eval $(apt-config shell TRUSTEDFILE Dir::Etc::Trusted/f)
+   if [ -r "$TRUSTEDFILE" ]; then
+      GPG="$GPG --keyring $TRUSTEDFILE"
+   fi
+   GPG="$GPG --primary-keyring $TRUSTEDFILE"
+   TRUSTEDPARTS="/etc/apt/trusted.gpg.d"
+   eval $(apt-config shell TRUSTEDPARTS Dir::Etc::TrustedParts/d)
+   if [ -d "$TRUSTEDPARTS" ]; then
+      # strip / suffix as gpg will double-slash in that case (#665411)
+      STRIPPED_TRUSTEDPARTS="${TRUSTEDPARTS%/}"
+      if [ "${STRIPPED_TRUSTEDPARTS}/" = "$TRUSTEDPARTS" ]; then
+	 TRUSTEDPARTS="$STRIPPED_TRUSTEDPARTS"
+      fi
+      for trusted in $(run-parts --list "$TRUSTEDPARTS" --regex '^.*\.gpg$'); do
+	 GPG="$GPG --keyring $trusted"
+      done
+   fi
 fi
-#echo "COMMAND: $GPG"
 
 command="$1"
 if [ -z "$command" ]; then
@@ -213,10 +294,8 @@ case "$command" in
         echo "OK"
         ;;
     del|rm|remove)
-        requires_root
         init_keyring "$TRUSTEDFILE"
-        $GPG --quiet --batch --delete-key --yes "$1"
-        echo "OK"
+	remove_key "$1"
         ;;
     update)
         init_keyring "$TRUSTEDFILE"

+ 9 - 5
debian/apt.postinst

@@ -15,12 +15,16 @@ set -e
 
 case "$1" in
     configure)
-	SECRING='/etc/apt/secring.gpg'
-	# test if secring is an empty normal file
-	if test -f $SECRING -a ! -s $SECRING; then
-		rm -f $SECRING
+	if dpkg --compare-versions "$2" lt-nl 0.9.9.5; then
+	    # we are using tmpfiles for both
+	    rm -f /etc/apt/trustdb.gpg
+	    # this removal was done unconditional since 0.8.15.3
+	    SECRING='/etc/apt/secring.gpg'
+	    # test if secring is an empty normal file
+	    if test -f $SECRING -a ! -s $SECRING; then
+	        rm -f $SECRING
+	    fi
 	fi
-	apt-key update
 
         # ensure tighter permissons on the logs, see LP: #975199
         if dpkg --compare-versions "$2" lt-nl 0.9.7.7; then

+ 57 - 2
debian/changelog

@@ -1,10 +1,65 @@
-apt (0.9.9.5) UNRELEASED; urgency=low
+apt (0.9.11) UNRELEASED; urgency=low
 
+  [ Daniel Hartwig ]
+  * Clarify units of Acquire::http::Dl-Limit (closes: #705445)
+  * Show a error message if {,dist-}upgrade is used with additional
+    arguments (closes: #705510)
+
+  [ Michael Vogt ]
+  * lp:~mvo/apt/config-clear:
+    - support Configuration.Clear() for a clear of the entire 
+      configuration
+  * lp:~mvo/apt/add-glob-function:
+    -  add Glob() to fileutl.{cc,h}
+
+ -- Michael Vogt <michael.vogt@ubuntu.com>  Thu, 15 Aug 2013 09:27:35 +0200
+
+apt (0.9.10) unstable; urgency=low
+
+  The "Hello to Debconf" upload
+  
+  [ Christian Perrier ]
   * Vietnamese translation update. Closes: #718615
   * Japanese translation update. Closes: #719279
   * French translation update.
 
- -- Christian Perrier <bubulle@debian.org>  Sat, 03 Aug 2013 16:06:55 +0200
+  [ Michael Vogt ]
+  * work on fixing coverity scan results:
+    - fix some off-by-one errors
+    - fix some resource leaks
+    - fixes in chroot() handling
+    - fix some missing va_end()
+  * make the code -Wall clean again
+  * remove duplicated #include<list>
+  * add .travis.yml
+  * use the 'abi-complicance-checker' package and remove the buildin 
+    copy for the abi checks
+
+  [ David Kalnischkies ]
+  * ensure that FileFd::Size returns 0 in error cases
+  * add missing Turkish (tr) to po/LINGUAS
+  * correct management-typo in description found by lintian
+  * implement debian/rules build-{arch,indep} as required by policy 3.9.4
+  * reenable automatic parallel build of APT
+  * exclude config.{sub,guess} from source package
+  * update the symbol files to reflect current state
+  * unset LANGUAGE for showing [Y/n] answer hints
+  * fix some unitialized data members
+  * specific pins below 1000 cause downgrades (Closes: 543966)
+  * use pkgTagFile to parse "header" of Release files
+  * fix: --print-uris removes authentication (Closes: 719263)
+  * always use our own trustdb.gpg in apt-key
+  * use a tmpfile for trustdb.gpg in apt-key.
+    Thanks to Andreas Beckmann for the initial patch! (Closes: #687611)
+  * do not double-slash paths in apt-key (Closes: 665411)
+  * make the keyring locations in apt-key configurable
+  * let apt-key del work better with softlink and single key keyrings
+  * do not call 'apt-key update' in apt.postinst
+  
+  [ Colin Watson ]
+  * prefer native arch over higher priority for providers (Closes: #718482)
+
+ -- Michael Vogt <mvo@debian.org>  Mon, 12 Aug 2013 21:45:07 +0200
 
 apt (0.9.9.4) unstable; urgency=low
 

+ 6 - 4
doc/apt.conf.5.xml

@@ -386,10 +386,12 @@ DPkg::Pre-Install-Pkgs {"/usr/sbin/dpkg-preconfigure --apt";};
      <para><literal>Acquire::http::AllowRedirect</literal> controls whether APT will follow
      redirects, which is enabled by default.</para>
 
-     <para>The used bandwidth can be limited with <literal>Acquire::http::Dl-Limit</literal>
-     which accepts integer values in kilobytes. The default value is 0 which deactivates
-     the limit and tries to use all available bandwidth (note that this option implicitly
-     disables downloading from multiple servers at the same time.)</para>
+     <para>The used bandwidth can be limited with
+     <literal>Acquire::http::Dl-Limit</literal> which accepts integer
+     values in kilobytes per second. The default value is 0 which
+     deactivates the limit and tries to use all available bandwidth.
+     Note that this option implicitly disables downloading from
+     multiple servers at the same time.</para>
 
      <para><literal>Acquire::http::User-Agent</literal> can be used to set a different
      User-Agent for the http download method as some proxies allow access for clients

+ 77 - 10
test/integration/framework

@@ -131,13 +131,23 @@ exitwithstatus() {
         exit $((EXIT_CODE <= 255 ? EXIT_CODE : 255));
 }
 
+shellsetedetector() {
+	local exit_status=$?
+	if [ "$exit_status" != '0' ]; then
+		echo >&2 "${CERROR}E: Looks like the testcases ended prematurely with exitcode: ${exit_status}${CNORMAL}"
+		if [ "$EXIT_CODE" = '0' ]; then
+			EXIT_CODE="$exit_status"
+		fi
+	fi
+}
+
 addtrap() {
 	if [ "$1" = 'prefix' ]; then
 		CURRENTTRAP="$2 $CURRENTTRAP"
 	else
 		CURRENTTRAP="$CURRENTTRAP $1"
 	fi
-	trap "$CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
+	trap "shellsetedetector; $CURRENTTRAP exitwithstatus;" 0 HUP INT QUIT ILL ABRT FPE SEGV PIPE TERM
 }
 
 setupenvironment() {
@@ -177,7 +187,7 @@ setupenvironment() {
 	echo "DPKG::options:: \"--root=${TMPWORKINGDIRECTORY}/rootdir\";" >> aptconfig.conf
 	echo "DPKG::options:: \"--force-not-root\";" >> aptconfig.conf
 	echo "DPKG::options:: \"--force-bad-path\";" >> aptconfig.conf
-	if ! $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then
+	if ! $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then
 		echo "DPKG::options:: \"--force-architecture\";" >> aptconfig.conf # Added to test multiarch before dpkg is ready for it…
 	fi
 	echo "DPKG::options:: \"--log=${TMPWORKINGDIRECTORY}/rootdir/var/log/dpkg.log\";" >> aptconfig.conf
@@ -225,7 +235,7 @@ configdpkg() {
 			echo -n > rootdir/var/lib/dpkg/status
 		fi
 	fi
-	if $(which dpkg) --assert-multi-arch 2>&1 > /dev/null; then
+	if $(which dpkg) --assert-multi-arch >/dev/null 2>&1; then
 		local ARCHS="$(getarchitectures)"
 		if echo "$ARCHS" | grep -E -q '[^ ]+ [^ ]+'; then
 			DPKGARCH="$(dpkg --print-architecture)"
@@ -711,22 +721,45 @@ setupaptarchive() {
 
 signreleasefiles() {
 	local SIGNER="${1:-Joe Sixpack}"
+	local GPG="gpg --batch --yes --no-default-keyring --trustdb-name rootdir/etc/apt/trustdb.gpg"
 	msgninfo "\tSign archive with $SIGNER key… "
-	local SECKEYS=""
+	local REXKEY='keys/rexexpired'
+	local SECEXPIREBAK="${REXKEY}.sec.bak"
+	local PUBEXPIREBAK="${REXKEY}.pub.bak"
+	if [ "${SIGNER}" = 'Rex Expired' ]; then
+		# the key is expired, so gpg doesn't allow to sign with and the --faked-system-time
+		# option doesn't exist anymore (and using faketime would add a new obscure dependency)
+		# therefore we 'temporary' make the key not expired and restore a backup after signing
+		cp ${REXKEY}.sec $SECEXPIREBAK
+		cp ${REXKEY}.pub $PUBEXPIREBAK
+		local SECUNEXPIRED="${REXKEY}.sec.unexpired"
+		local PUBUNEXPIRED="${REXKEY}.pub.unexpired"
+		if [ -f "$SECUNEXPIRED" ] && [ -f "$PUBUNEXPIRED" ]; then
+			cp $SECUNEXPIRED ${REXKEY}.sec
+			cp $PUBUNEXPIRED ${REXKEY}.pub
+		else
+			printf "expire\n1w\nsave\n" | $GPG --keyring ${REXKEY}.pub --secret-keyring ${REXKEY}.sec --command-fd 0 --edit-key "${SIGNER}" >/dev/null 2>&1 || true
+			cp ${REXKEY}.sec $SECUNEXPIRED
+			cp ${REXKEY}.pub $PUBUNEXPIRED
+		fi
+	fi
 	for KEY in $(find keys/ -name '*.sec'); do
-		SECKEYS="$SECKEYS --secret-keyring $KEY"
+		GPG="$GPG --secret-keyring $KEY"
 	done
-	local PUBKEYS=""
 	for KEY in $(find keys/ -name '*.pub'); do
-		PUBKEYS="$PUBKEYS --keyring $KEY"
+		GPG="$GPG --keyring $KEY"
 	done
 	for RELEASE in $(find aptarchive/ -name Release); do
-		gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" -abs -o ${RELEASE}.gpg ${RELEASE}
+		$GPG --default-key "$SIGNER" --armor --detach-sign --sign --output ${RELEASE}.gpg ${RELEASE}
 		local INRELEASE="$(echo "${RELEASE}" | sed 's#/Release$#/InRelease#')"
-		gpg --yes --no-default-keyring $SECKEYS $PUBKEYS --default-key "$SIGNER" --clearsign -o $INRELEASE $RELEASE
+		$GPG --default-key "$SIGNER" --clearsign --output $INRELEASE $RELEASE
 		# we might have set a specific date for the Release file, so copy it
 		touch -d "$(stat --format "%y" ${RELEASE})" ${RELEASE}.gpg ${INRELEASE}
 	done
+	if [ -f "$SECEXPIREBAK" ] && [ -f "$PUBEXPIREBAK" ]; then
+		mv -f $SECEXPIREBAK ${REXKEY}.sec
+		mv -f $PUBEXPIREBAK ${REXKEY}.pub
+	fi
 	msgdone "info"
 }
 
@@ -828,7 +861,7 @@ testequalor2() {
 	echo "$2" > $COMPAREFILE2
 	shift 2
 	msgtest "Test for equality OR of" "$*"
-	$* 2>&1 1> $COMPAREAGAINST
+	$* >$COMPAREAGAINST 2>&1
 	(checkdiff $COMPAREFILE1 $COMPAREAGAINST 1> /dev/null ||
 		checkdiff $COMPAREFILE2 $COMPAREAGAINST 1> /dev/null) && msgpass ||
 		( echo "\n${CINFO}Diff against OR 1${CNORMAL}" "$(checkdiff $COMPAREFILE1 $COMPAREAGAINST)" \
@@ -905,6 +938,40 @@ testmarkedauto() {
 	aptmark showauto 2>&1 | checkdiff $COMPAREFILE - && msgpass || msgfail
 }
 
+testsuccess() {
+	if [ "$1" = '--nomsg' ]; then
+		shift
+	else
+		msgtest 'Test for successful execution of' "$*"
+	fi
+	local OUTPUT=$(mktemp)
+	addtrap "rm $OUTPUT;"
+	if $@ >${OUTPUT} 2>&1; then
+		msgpass
+	else
+		echo
+		cat $OUTPUT
+		msgfail
+	fi
+}
+
+testfailure() {
+	if [ "$1" = '--nomsg' ]; then
+		shift
+	else
+		msgtest 'Test for failure in  execution of' "$*"
+	fi
+	local OUTPUT=$(mktemp)
+	addtrap "rm $OUTPUT;"
+	if $@ >${OUTPUT} 2>&1; then
+		echo
+		cat $OUTPUT
+		msgfail
+	else
+		msgpass
+	fi
+}
+
 pause() {
 	echo "STOPPED execution. Press enter to continue"
 	local IGNORE

BIN
test/integration/rexexpired.pub


BIN
test/integration/rexexpired.sec


+ 1 - 1
test/integration/skip-avoid-avoiding-breaks-predepends

@@ -17,5 +17,5 @@ Pre-Depends: looping (>= 1.15)'
 
 setupaptarchive
 
-aptget dist-upgrade -y -o Debug::pkgOrderList=1 #-qq 2>&1 > /dev/null
+aptget dist-upgrade -y -o Debug::pkgOrderList=1 #-qq >/dev/null 2>&1
 testdpkginstalled looping loop1 loop2

+ 1 - 1
test/integration/test-apt-cdrom

@@ -102,5 +102,5 @@ aptcache show testing -o Acquire::Languages=en | grep -q '^Description-en: ' &&
 
 # check that we really can install from a 'cdrom'
 testdpkgnotinstalled testing
-aptget install testing -y > /dev/null 2>&1
+testsuccess aptget install testing -y
 testdpkginstalled testing

+ 5 - 5
test/integration/test-apt-get-autoremove

@@ -11,11 +11,11 @@ buildsimplenativepackage 'po-debconf' 'all' '1.0.16' 'unstable'
 buildsimplenativepackage 'debhelper' 'all' '8.0.0' 'unstable' 'Depends: po-debconf'
 setupaptarchive
 
-aptget install unrelated debhelper -qq 2>&1 > /dev/null
+testsuccess aptget install unrelated debhelper -y
 testdpkginstalled 'unrelated' 'debhelper' 'po-debconf'
 
 testmarkedauto 'po-debconf'
-aptget remove debhelper -y -qq 2>&1 > /dev/null
+testsuccess aptget remove debhelper -y
 testdpkgnotinstalled 'debhelper'
 testdpkginstalled 'po-debconf' 'unrelated'
 
@@ -30,15 +30,15 @@ Remv po-debconf [1.0.16]' aptget autoremove -s
 testdpkginstalled 'po-debconf'
 
 echo 'APT::NeverAutoRemove { "^po-debconf$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
-aptget autoremove -y -qq 2>&1 > /dev/null
+testsuccess aptget autoremove -y
 testdpkginstalled 'po-debconf'
 
 echo 'APT::NeverAutoRemove { "^po-.*$"; };' > rootdir/etc/apt/apt.conf.d/00autoremove
-aptget autoremove -y -qq 2>&1 > /dev/null
+testsuccess aptget autoremove -y
 testdpkginstalled "po-debconf"
 
 rm rootdir/etc/apt/apt.conf.d/00autoremove
-aptget autoremove -y -qq 2>&1 > /dev/null
+testsuccess aptget autoremove -y
 testdpkgnotinstalled 'po-debconf'
 testmarkedauto
 

+ 107 - 0
test/integration/test-apt-key

@@ -0,0 +1,107 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+msgtest 'Check that paths in list output are not' 'double-slashed'
+aptkey list 2>&1 | grep -q '//' && msgfail || msgpass
+
+msgtest 'Check that paths in finger output are not' 'double-slashed'
+aptkey finger 2>&1 | grep -q '//' && msgfail || msgpass
+
+echo 'APT::Key::ArchiveKeyring "./keys/joesixpack.pub";
+APT::Key::RemovedKeys "./keys/rexexpired.pub";' > rootdir/etc/apt/apt.conf.d/aptkey.conf
+
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub   2048R/DBAC8DAE 2010-08-18'
+
+testequal 'gpg: key DBAC8DAE: "Joe Sixpack (APT Testcases Dummy) <joe@example.org>" not changed
+gpg: Total number processed: 1
+gpg:              unchanged: 1' aptkey --fakeroot update
+
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub   2048R/DBAC8DAE 2010-08-18'
+
+testsuccess aptkey --fakeroot add ./keys/rexexpired.pub
+
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub   2048R/27CE74F9 2013-07-12 [expired: 2013-07-13]
+pub   2048R/DBAC8DAE 2010-08-18'
+
+msgtest 'Execute update again to trigger removal of' 'Rex Expired key'
+testsuccess --nomsg aptkey --fakeroot update
+
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub   2048R/DBAC8DAE 2010-08-18'
+
+msgtest "Try to remove a key which exists, but isn't in the" 'forced keyring'
+testsuccess --nomsg aptkey --fakeroot --keyring rootdir/etc/apt/trusted.gpg del DBAC8DAE
+
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub   2048R/DBAC8DAE 2010-08-18'
+
+testsuccess aptkey --fakeroot del DBAC8DAE
+testempty aptkey list
+
+# start from a clean plate again
+cleanplate() {
+	rm -rf rootdir/etc/apt/trusted.gpg.d/ rootdir/etc/apt/trusted.gpg
+	mkdir rootdir/etc/apt/trusted.gpg.d/
+}
+
+msgtest 'Test key removal with' 'single key in real file'
+cleanplate
+cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
+testempty aptkey list
+testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~
+
+msgtest 'Test key removal with' 'single key in softlink'
+cleanplate
+ln -s $(readlink -f ./keys/joesixpack.pub) rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
+testempty aptkey list
+testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess test -L rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~
+
+cleanplate
+testsuccess aptkey --fakeroot add ./keys/joesixpack.pub
+testsuccess aptkey --fakeroot add ./keys/marvinparanoid.pub
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub   2048R/DBAC8DAE 2010-08-18
+pub   2048R/528144E2 2011-01-16'
+cp -a rootdir/etc/apt/trusted.gpg keys/testcase-multikey.pub # store for reuse
+
+msgtest 'Test key removal with' 'multi key in real file'
+cleanplate
+cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg
+testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub   2048R/528144E2 2011-01-16'
+testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
+
+msgtest 'Test key removal with' 'multi key in softlink'
+cleanplate
+ln -s $(readlink -f ./keys/testcase-multikey.pub) rootdir/etc/apt/trusted.gpg.d/multikey.gpg
+testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub   2048R/528144E2 2011-01-16'
+testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
+testsuccess test ! -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg
+testsuccess test -L rootdir/etc/apt/trusted.gpg.d/multikey.gpg~
+
+msgtest 'Test key removal with' 'multiple files including key'
+cleanplate
+cp -a keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+cp -a keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg
+testsuccess --nomsg aptkey --fakeroot del DBAC8DAE
+aptkey list | grep '^pub' > aptkey.list
+testfileequal ./aptkey.list 'pub   2048R/528144E2 2011-01-16'
+testsuccess test ! -e rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg
+testsuccess cmp keys/joesixpack.pub rootdir/etc/apt/trusted.gpg.d/joesixpack.gpg~
+testsuccess cmp keys/testcase-multikey.pub rootdir/etc/apt/trusted.gpg.d/multikey.gpg~

+ 2 - 2
test/integration/test-bug-407511-fail-invalid-default-release

@@ -35,14 +35,14 @@ setupaptarchive
 
 passdist() {
 	msgtest 'Test that target-release is accepted' $1
-	aptget dist-upgrade -t $1 -qq && msgpass || msgfail
+	testsuccess --nomsg aptget dist-upgrade -t $1
 	msgtest 'Test that target-release pins with' $1
 	aptcache policy -t $1 | grep -q ' 990' && msgpass || msgfail
 }
 
 faildist() {
 	msgtest 'Test that target-release is refused' $1
-	aptget dist-upgrade -t $1 -qq 2> /dev/null && msgfail || msgpass
+	testfailure --nomsg aptget dist-upgrade -t $1
 }
 
 msgtest 'Test that no default-release is active in this test' 'setup'

+ 2 - 2
test/integration/test-bug-602412-dequote-redirect

@@ -16,7 +16,7 @@ mv aptarchive/pool aptarchive/newpool
 mv aptarchive/dists aptarchive/newdists
 
 msgtest 'Test redirection works in' 'apt-get update'
-aptget update -qq && msgpass || msgfail
+testsuccess --nomsg aptget update
 
 # check that I-M-S header is kept in redirections
 testequal 'Hit http://localhost:8080 unstable InRelease
@@ -26,4 +26,4 @@ Hit http://localhost:8080 unstable/main Translation-en
 Reading package lists...' aptget update #-o debug::pkgacquire=1 -o debug::pkgacquire::worker=1
 
 msgtest 'Test redirection works in' 'package download'
-aptget install unrelated --download-only -qq && msgpass || msgfail
+testsuccess --nomsg aptget install unrelated --download-only -y

+ 1 - 1
test/integration/test-bug-604222-new-and-autoremove

@@ -8,7 +8,7 @@ configarchitecture "i386"
 setupaptarchive
 
 touch rootdir/var/lib/apt/extended_states
-aptmark markauto 'libvtk5.4'
+testsuccess aptmark markauto 'libvtk5.4'
 testmarkedauto 'libvtk5.4'
 
 testequal "Reading package lists...

+ 5 - 5
test/integration/test-bug-604401-files-are-directories

@@ -11,7 +11,7 @@ test ! -e rootdir/etc/apt/apt.conf || mv rootdir/etc/apt/apt.conf rootdir/etc/ap
 
 msgtest "Directory instead of a file as apt.conf ignored"
 mkdir -p rootdir/etc/apt/apt.conf
-aptconfig dump > /dev/null && msgpass || msgfail
+testsuccess --nomsg aptconfig dump
 rmdir rootdir/etc/apt/apt.conf
 
 msgtest "Good link instead of a file as apt.conf ignored"
@@ -22,7 +22,7 @@ rm rootdir/etc/apt/apt.conf
 
 msgtest "Broken link instead of a file as apt.conf ignored"
 ln -s /tmp/doesnt-exist rootdir/etc/apt/apt.conf
-aptconfig dump > /dev/null && msgpass || msgfail
+testsuccess --nomsg aptconfig dump
 rm rootdir/etc/apt/apt.conf
 
 
@@ -30,7 +30,7 @@ test ! -e rootdir/etc/apt/sources.list || mv rootdir/etc/apt/sources.list rootdi
 
 msgtest "Directory instead of a file as sources.list ignored"
 mkdir -p rootdir/etc/apt/sources.list
-aptget update --print-uris 2> /dev/null && msgpass || msgfail
+testsuccess --nomsg aptget update --print-uris
 rmdir rootdir/etc/apt/sources.list
 
 msgtest "Good link instead of a file as sources.list ignored"
@@ -49,7 +49,7 @@ test ! -e rootdir/etc/apt/preferences || mv rootdir/etc/apt/preferences rootdir/
 
 msgtest "Directory instead of a file as preferences ignored"
 mkdir -p rootdir/etc/apt/preferences
-aptcache policy > /dev/null 2> /dev/null && msgpass || msgfail
+testsuccess --nomsg aptcache policy
 rmdir rootdir/etc/apt/preferences
 
 msgtest "Good link instead of a file as preferences ignored"
@@ -62,5 +62,5 @@ rm rootdir/etc/apt/preferences
 
 msgtest "Broken link instead of a file as preferences ignored"
 ln -s /tmp/doesnt-exist rootdir/etc/apt/preferences
-aptcache policy > /dev/null 2> /dev/null && msgpass || msgfail
+testsuccess --nomsg aptcache policy
 rm rootdir/etc/apt/preferences

+ 10 - 10
test/integration/test-bug-611729-mark-as-manual

@@ -15,21 +15,21 @@ buildsimplenativepackage "c" "all" "1.0" "stable" "Depends: b"
 setupaptarchive
 
 # dpkg freaks out if the last package is removed so keep one around
-aptget install peace-dpkg -y -qq 2>&1 > /dev/null
+testsuccess aptget install peace-dpkg -y
 testdpkginstalled peace-dpkg
 testmarkedauto
 
-aptget install a -y -qq 2>&1 > /dev/null
+testsuccess aptget install a -y
 testdpkginstalled a b
 testdpkgnotinstalled c
 testmarkedauto 'b'
 
-aptget remove a -y -qq 2>&1 > /dev/null
+testsuccess aptget remove a -y
 testdpkgnotinstalled a c
 testdpkginstalled b
 testmarkedauto 'b'
 
-aptget install c -y -qq 2>&1 > /dev/null
+testsuccess aptget install c -y
 testdpkgnotinstalled a
 testdpkginstalled b c
 testmarkedauto 'b'
@@ -50,7 +50,7 @@ testmarkedauto 'b'
 
 rm rootdir/var/log/apt/history.log
 
-aptget install b --reinstall -y -qq 2>&1 > /dev/null
+testsuccess aptget install b --reinstall -y
 testdpkgnotinstalled a
 testdpkginstalled b c
 testmarkedauto 'b'
@@ -67,24 +67,24 @@ b set to manually installed.
 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.' aptget install b
 testmarkedauto
 
-aptget remove b -y -qq 2>&1 > /dev/null
+testsuccess aptget remove b -y
 testdpkgnotinstalled a b c
 testmarkedauto
 
-aptget install a b -y -qq 2>&1 > /dev/null
+testsuccess aptget install a b -y
 testdpkginstalled a b
 testdpkgnotinstalled c
 testmarkedauto
 
-aptget purge a b -y -qq 2>&1 > /dev/null
+testsuccess aptget purge a b -y
 testdpkgnotinstalled a b c
 testmarkedauto
 
-aptget install b c -y -qq 2>&1 > /dev/null
+testsuccess aptget install b c -y
 testdpkgnotinstalled a
 testdpkginstalled b c
 testmarkedauto
 
-aptget install a -y -qq 2>&1 > /dev/null
+testsuccess aptget install a -y
 testdpkginstalled a b c
 testmarkedauto

+ 8 - 8
test/integration/test-bug-612099-multiarch-conflicts

@@ -15,7 +15,7 @@ buildsimplenativepackage 'foobar' 'amd64' '1.0' 'stable' 'Depends: libc6'
 
 setupaptarchive
 
-aptget install libc6:i386 -t stable -y -qq 2>&1 > /dev/null
+testsuccess aptget install libc6:i386 -t stable -y
 testdpkginstalled libc6:i386
 testequal 'Reading package lists...
 Building dependency tree...
@@ -78,9 +78,9 @@ Conf libc6 (2.0 testing [all])' aptget upgrade -t testing -s
 # FIXME: on amd64 systems this test wouldn't run with a real upgrade
 # as APT (here i386) disagree about the native architecture, so
 # we fake it here:
-#aptget upgrade -y -qq 2>&1 > /dev/null
-aptget purge libc6 -y -qq 2>&1 >/dev/null
-aptget install libc6:i386 -y -qq 2>&1 >/dev/null
+#aptget upgrade -y -qq >/dev/null 2>&1
+testsuccess aptget purge libc6 -y
+testsuccess aptget install libc6:i386 -y
 testdpkginstalled libc6:all
 
 testequal 'Reading package lists...
@@ -129,7 +129,7 @@ buildsimplenativepackage 'foobar-same' 'amd64' '1.0' 'stable' 'Depends: libc6-sa
 
 setupaptarchive
 
-aptget install libc6-same:i386 -t stable -y -qq 2>&1 > /dev/null
+testsuccess aptget install libc6-same:i386 -t stable -y
 testdpkginstalled libc6-same:i386
 
 testequal 'Reading package lists...
@@ -176,9 +176,9 @@ Conf libc6-same (2.0 testing [all])' aptget upgrade -t testing -s
 # FIXME: on amd64 systems this test wouldn't run with a real upgrade
 # as APT (here i386) disagree about the native architecture, so
 # we fake it here:
-#aptget upgrade -y -qq 2>&1 > /dev/null
-aptget purge libc6-same -y -qq 2>&1 >/dev/null
-aptget install libc6-same:i386 -y -qq 2>&1 >/dev/null
+#aptget upgrade -y -qq >/dev/null 2>&1
+testsuccess aptget purge libc6-same -y
+testsuccess aptget install libc6-same:i386 -y
 testdpkginstalled libc6-same:all
 
 

+ 2 - 2
test/integration/test-bug-612557-garbage-upgrade

@@ -13,7 +13,7 @@ insertpackage 'unstable' 'libreoffice-common' 'all' '1:3.3.0-2' 'Conflicts: open
 setupaptarchive
 
 touch rootdir/var/lib/apt/extended_states
-aptmark markauto python-uno openoffice.org-common
+testsuccess aptmark markauto python-uno openoffice.org-common
 #aptmark unmarkauto openoffice.org-emailmerge
 testmarkedauto python-uno openoffice.org-common
 
@@ -32,7 +32,7 @@ The following packages will be upgraded:
 After this operation, 53.2 MB disk space will be freed.
 E: Trivial Only specified but this is not a trivial operation.' aptget --trivial-only install python-uno
 
-aptmark markauto openoffice.org-emailmerge
+testsuccess aptmark markauto openoffice.org-emailmerge
 testmarkedauto python-uno openoffice.org-common openoffice.org-emailmerge
 
 testequal 'Reading package lists...

+ 2 - 2
test/integration/test-bug-612958-use-dpkg-multiarch-config

@@ -14,13 +14,13 @@ insertinstalledpackage 'libapt' 'armel' '1.0'
 testpass() {
 	rm rootdir/var/cache/apt/*.bin
 	msgtest 'Test architecture handling' "$1 with $2"
-	aptcache show libapt:$2 2> /dev/null > /dev/null && msgpass || msgfail
+	testsuccess --nomsg aptcache show libapt:$2
 }
 
 testfail() {
 	rm rootdir/var/cache/apt/*.bin
 	msgtest 'Test architecture handling' "$1 with $2"
-	aptcache show libapt:$2 2> /dev/null > /dev/null && msgfail || msgpass
+	testfailure --nomsg aptcache show libapt:$2
 }
 
 testpass 'no config' 'i386'

+ 1 - 1
test/integration/test-bug-613420-new-garbage-dependency

@@ -15,7 +15,7 @@ insertpackage 'unstable' 'openoffice.org-officebean' 'all' '1:3.3.0-5' 'Depends:
 setupaptarchive
 
 touch rootdir/var/lib/apt/extended_states
-aptmark markauto openoffice.org-officebean
+testsuccess aptmark markauto openoffice.org-officebean
 testmarkedauto openoffice.org-officebean
 
 testequal "Reading package lists...

+ 1 - 1
test/integration/test-bug-618288-multiarch-same-lockstep

@@ -16,7 +16,7 @@ buildsimplenativepackage 'apt' 'i386' '2' 'unstable' 'Depends: libsame (= 2)' ''
 buildsimplenativepackage 'apt2' 'amd64' '2' 'unstable' 'Depends: libsame (= 2)' '' 'required'
 
 setupaptarchive
-aptget dist-upgrade -s 2>&1 > output.apt
+aptget dist-upgrade -s >output.apt 2>&1
 
 # order in switch libsame:{amd64,i386} are unpacked is irrelevant, as both are installed - but we need to do it together
 LS_U_AMD="$(grep -o -n '^Inst libsame ' output.apt | cut -d: -f1)"

+ 1 - 1
test/integration/test-bug-64141-install-dependencies-for-on-hold

@@ -31,7 +31,7 @@ The following packages will be upgraded:
 After this operation, 0 B of additional disk space will be used.
 E: Trivial Only specified but this is not a trivial operation.' aptget dist-upgrade --trivial-only
 
-aptmark hold apt -qq
+testsuccess aptmark hold apt
 
 testequal 'Reading package lists...
 Building dependency tree...

+ 2 - 2
test/integration/test-bug-673536-pre-depends-breaks-loop

@@ -15,9 +15,9 @@ setupaptarchive
 # we check with 'real' packages here as the simulation reports a 'Conf broken'
 # which is technical correct for the simulation, but testing errormsg is ugly
 
-aptget install basic=1 -qq > /dev/null
+testsuccess aptget install basic=1 -y
 testdpkginstalled basic
 testdpkgnotinstalled common
 
-aptget dist-upgrade -qq > /dev/null
+testsuccess aptget dist-upgrade -y
 testdpkginstalled basic common

+ 2 - 2
test/integration/test-bug-679371-apt-get-autoclean-multiarch

@@ -14,8 +14,8 @@ setupaptarchive
 
 changetowebserver
 
-aptget update -qq
-aptget install pkgall pkgnative pkgforeign -y -qq > /dev/null
+testsuccess aptget update
+testsuccess aptget install pkgall pkgnative pkgforeign -y
 
 testdpkginstalled pkgall pkgnative pkgforeign
 

+ 2 - 2
test/integration/test-bug-686346-package-missing-architecture

@@ -58,13 +58,13 @@ Building dependency tree...
 # pkgd has no update with an architecture
 testdpkginstalled pkgd
 msgtest 'Test apt-get purge' 'pkgd'
-aptget purge pkgd -y >/dev/null 2>&1 && msgpass || msgfail
+testsuccess --nomsg aptget purge pkgd -y
 testdpkgnotinstalled pkgd
 
 # there is a pkgb with an architecture
 testdpkginstalled pkgb
 msgtest 'Test apt-get purge' 'pkgb:none'
-aptget purge pkgb:none -y >/dev/null 2>&1 && msgpass || msgfail
+testsuccess --nomsg aptget purge pkgb:none -y
 testdpkgnotinstalled pkgb
 
 # check that dependencies are created after the none package exists in the cache

+ 1 - 1
test/integration/test-bug-712116-dpkg-pre-install-pkgs-hook-multiarch

@@ -42,7 +42,7 @@ enablehookversion 3
 observehook() {
 	rm -f ${hook}-v2.list ${hook}-v3.list
 	msgtest 'Observe hooks while' "$*"
-	aptget "$@" -y --force-yes >/dev/null 2>&1 && msgpass || msgfail
+	testsuccess --nomsg aptget "$@" -y --force-yes
 }
 
 observehook install stuff -t stable

+ 2 - 2
test/integration/test-bug-717891-abolute-uris-for-proxies

@@ -12,12 +12,12 @@ setupaptarchive
 changetowebserver --request-absolute='uri'
 
 msgtest 'Check that absolute paths are' 'not accepted'
-aptget update >/dev/null 2>&1 && msgfail || msgpass
+testfailure --nomsg aptget update
 
 echo 'Acquire::http::Proxy "http://localhost:8080";' > rootdir/etc/apt/apt.conf.d/99proxy
 
 msgtest 'Check that requests to proxies are' 'absolute uris'
-aptget update >/dev/null 2>&1 && msgpass || msgfail
+testsuccess --nomsg aptget update
 
 testequal 'Reading package lists...
 Building dependency tree...

+ 41 - 0
test/integration/test-bug-719263-print-uris-removes-authentication

@@ -0,0 +1,41 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+insertinstalledpackage 'unrelated' 'all' '1'
+buildsimplenativepackage 'unrelated' 'all' '2' 'unstable'
+
+setupaptarchive
+
+testnoact() {
+	cp -a rootdir/var/lib/dpkg/status rootdir/var/lib/dpkg/status-backup-noact
+	touch rootdir/var/lib/apt/extended_states
+	testequal 'Reading package lists...
+Building dependency tree...
+Reading state information...
+The following packages will be upgraded:
+  unrelated
+1 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
+Inst unrelated [1] (2 unstable [all])
+Conf unrelated (2 unstable [all])' aptget install unrelated -s
+	testsuccess aptget install unrelated -y
+	testdpkginstalled unrelated
+	cp -a rootdir/var/lib/dpkg/status-backup-noact rootdir/var/lib/dpkg/status
+}
+
+testnoact
+testsuccess aptget update --print-uris
+testnoact
+
+# same thing, just not with InRelease this time
+rm -rf rootdir/var/lib/apt/lists
+testsuccess aptget update -o Acquire::TryInRelease=0
+
+testnoact
+testsuccess aptget update --print-uris -o Acquire::TryInRelease=0
+testnoact

+ 17 - 17
test/integration/test-compressed-indexes

@@ -46,10 +46,10 @@ testrun() {
 			msgpass
 		fi
 		msgtest "Check if package is downloadable"
-		aptget install -d testpkg -qq && msgpass || msgfail
-		msgtest "\tdeb file is present"; test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail
+		testsuccess --nomsg aptget install -d testpkg
+		msgtest "\tdeb file is present"; testsuccess --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb
 		aptget clean
-		msgtest "\tdeb file is gone"; ! test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb && msgpass || msgfail
+		msgtest "\tdeb file is gone"; testfailure --nomsg test -f rootdir/var/cache/apt/archives/testpkg_1.0_i386.deb
 	fi
 	rm -f rootdir/var/cache/apt/pkgcache.bin rootdir/var/cache/apt/srcpkgcache.bin
 	testequal "$GOODSHOW" aptcache show testpkg
@@ -62,9 +62,9 @@ testrun() {
 	testequal "$GOODSHOWSRC" aptcache showsrc testpkg
 	aptget clean
 	msgtest "Check if the source is aptgetable"
-	aptget source testpkg -qq 2> /dev/null > /dev/null && msgpass || msgfail
-	msgtest "\tdsc file is present"; test -f testpkg_1.0.dsc && msgpass || msgfail
-	msgtest "\tdirectory is present"; test -d testpkg-1.0 && msgpass || msgfail
+	testsuccess --nomsg aptget source testpkg
+	msgtest "\tdsc file is present"; testsuccess --nomsg test -f testpkg_1.0.dsc
+	msgtest "\tdirectory is present"; testsuccess --nomsg test -d testpkg-1.0
 	rm -rf testpkg-1.0
 }
 
@@ -72,11 +72,11 @@ echo 'Acquire::GzipIndexes "false";' > rootdir/etc/apt/apt.conf.d/02compressinde
 msgmsg "File: Test with uncompressed indexes"
 testrun
 
-aptget update -qq -o Acquire::Pdiffs=1
+testsuccess aptget update -o Acquire::Pdiffs=1
 msgmsg "File: Test with uncompressed indexes (update unchanged with pdiffs)"
 testrun
 
-aptget update -qq -o Acquire::Pdiffs=0
+testsuccess aptget update -o Acquire::Pdiffs=0
 msgmsg "File: Test with uncompressed indexes (update unchanged without pdiffs)"
 testrun
 
@@ -84,21 +84,21 @@ rm -rf rootdir/var/lib/apt/lists
 echo 'Acquire::CompressionTypes::Order:: "gz";
 Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex
 
-aptget update -qq
+testsuccess aptget update
 msgmsg "File: Test with compressed indexes"
 testrun "compressed"
 
-aptget update -qq -o Acquire::Pdiffs=1
+testsuccess aptget update -o Acquire::Pdiffs=1
 msgmsg "File: Test with compressed indexes (update unchanged with pdiffs)"
 testrun "compressed"
 
-aptget update -qq -o Acquire::Pdiffs=0
+testsuccess aptget update -o Acquire::Pdiffs=0
 msgmsg "File: Test with compressed indexes (update unchanged without pdiffs)"
 testrun "compressed"
 
 rm rootdir/etc/apt/apt.conf.d/02compressindex
 changetowebserver
-aptget update -qq
+testsuccess aptget update
 GOODPOLICY="$(aptcache policy testpkg)"
 test $(echo "$GOODPOLICY" | grep -e '^testpkg:' -e '^  Candidate:' -e '^  Installed: (none)' -e '500 http://' | wc -l) -eq 4
 testequal "$GOODPOLICY" aptcache policy testpkg
@@ -106,11 +106,11 @@ testequal "$GOODPOLICY" aptcache policy testpkg
 msgmsg "HTTP: Test with uncompressed indexes"
 testrun
 
-aptget update -qq -o Acquire::Pdiffs=1
+testsuccess aptget update -o Acquire::Pdiffs=1
 msgmsg "HTTP: Test with uncompressed indexes (update unchanged with pdiffs)"
 testrun
 
-aptget update -qq -o Acquire::Pdiffs=0
+testsuccess aptget update -o Acquire::Pdiffs=0
 msgmsg "HTTP: Test with uncompressed indexes (update unchanged without pdiffs)"
 testrun
 
@@ -118,14 +118,14 @@ rm -rf rootdir/var/lib/apt/lists
 echo 'Acquire::CompressionTypes::Order:: "gz";
 Acquire::GzipIndexes "true";' > rootdir/etc/apt/apt.conf.d/02compressindex
 
-aptget update -qq
+testsuccess aptget update
 msgmsg "HTTP: Test with compressed indexes"
 testrun "compressed"
 
-aptget update -qq -o Acquire::Pdiffs=1
+testsuccess aptget update -o Acquire::Pdiffs=1
 msgmsg "HTTP: Test with compressed indexes (update unchanged with pdiffs)"
 testrun "compressed"
 
-aptget update -qq -o Acquire::Pdiffs=0
+testsuccess aptget update -o Acquire::Pdiffs=0
 msgmsg "HTTP: Test with compressed indexes (update unchanged without pdiffs)"
 testrun "compressed"

+ 1 - 1
test/integration/test-cve-2013-1051-InRelease-parsing

@@ -14,7 +14,7 @@ setupaptarchive
 changetowebserver
 ARCHIVE='http://localhost:8080/'
 msgtest 'Initial apt-get update should work with' 'InRelease'
-aptget update -qq && msgpass || msgfail
+testsuccess --nomsg aptget update
 
 # check that the setup is correct
 testequal "good-pkg:

+ 1 - 1
test/integration/test-disappearing-packages

@@ -29,7 +29,7 @@ rm -rf "$BUILDDIR"
 
 setupaptarchive
 
-aptget install old-pkg=1.0 --trivial-only -qq 2>&1 > /dev/null
+testsuccess aptget install old-pkg=1.0 --trivial-only
 
 testmarkedauto # old-pkg is manual installed
 

+ 2 - 2
test/integration/test-pdiff-usage

@@ -11,7 +11,7 @@ buildaptarchive
 setupflataptarchive
 changetowebserver
 signreleasefiles
-aptget update -qq
+testsuccess aptget update
 
 testnopackage newstuff
 PKGFILE="${TESTDIR}/$(echo "$(basename $0)" | sed 's#^test-#Packages-#')"
@@ -38,7 +38,7 @@ SHA1-Patches:
 generatereleasefiles '+1hour'
 signreleasefiles
 find aptarchive -name 'Packages*' -type f -delete
-aptget update -qq
+testsuccess aptget update
 
 testnopackage oldstuff
 testequal "$(cat ${PKGFILE}-new)

+ 4 - 4
test/integration/test-policy-pinning

@@ -228,16 +228,16 @@ testequalpolicycoolstuff "" "2.0~bpo1" 990 500 600 "2.0~bpo1" -o Test=ButAutomat
 testequalpolicycoolstuff "" "1.0" 100 990 600 "2.0~bpo1" -o Test=ButAutomaticUpgrades -t stable
 
 rm rootdir/etc/apt/preferences
-aptget install coolstuff -qq > /dev/null 2> /dev/null
+testsuccess aptget install coolstuff -y
 testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
-aptget dist-upgrade -qq > /dev/null 2> /dev/null
+testsuccess aptget dist-upgrade -y
 testequalpolicycoolstuff "1.0" "1.0" 100 500 0 "" -o Test=ButAutomaticUpgrades
 testequalpolicycoolstuff "1.0" "1.0" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
 testequalpolicycoolstuff "1.0" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports
 
-aptget install coolstuff -t backports -qq > /dev/null 2> /dev/null
+testsuccess aptget install coolstuff -t backports -y
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades
-aptget dist-upgrade -qq > /dev/null 2> /dev/null
+testsuccess aptget dist-upgrade -y
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 500 0 "" -o Test=ButAutomaticUpgrades
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 100 990 0 "" -o Test=ButAutomaticUpgrades -t stable
 testequalpolicycoolstuff "2.0~bpo1" "2.0~bpo1" 990 500 0 "" -o Test=ButAutomaticUpgrades -t backports

+ 16 - 16
test/integration/test-releasefile-valid-until

@@ -32,64 +32,64 @@ aptgetupdate() {
 
 setupreleasefile
 msgtest 'Release file is accepted as it has' 'no Until'
-aptgetupdate && msgpass || msgfail
+testsuccess --nomsg aptgetupdate
 
 setupreleasefile
 msgtest 'Release file is accepted as it has' 'no Until and good Max-Valid'
-aptgetupdate -o Acquire::Max-ValidTime=3600 && msgpass || msgfail
+testsuccess --nomsg aptgetupdate -o Acquire::Max-ValidTime=3600
 
 setupreleasefile 'now - 2 days'
 msgtest 'Release file is rejected as it has' 'no Until, but bad Max-Valid'
-aptgetupdate -o Acquire::Max-ValidTime=3600 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=3600
 
 setupreleasefile 'now - 3 days' 'now + 1 day'
 msgtest 'Release file is accepted as it has' 'good Until'
-aptgetupdate && msgpass || msgfail
+testsuccess --nomsg aptgetupdate
 
 setupreleasefile 'now - 7 days' 'now - 4 days'
 msgtest 'Release file is rejected as it has' 'bad Until'
-aptgetupdate && msgfail || msgpass
+testfailure --nomsg aptgetupdate
 
 setupreleasefile 'now - 7 days' 'now - 4 days'
 msgtest 'Release file is rejected as it has' 'bad Until (ignore good Max-Valid)'
-aptgetupdate -o Acquire::Max-ValidTime=1209600 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=1209600
 
 setupreleasefile 'now - 7 days' 'now - 4 days'
 msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until)'
-aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400
 
 setupreleasefile 'now - 7 days' 'now + 4 days'
 msgtest 'Release file is rejected as it has' 'bad Max-Valid (good Until)'
-aptgetupdate -o Acquire::Max-ValidTime=86400 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400
 
 setupreleasefile 'now - 7 days' 'now + 4 days'
 msgtest 'Release file is accepted as it has' 'good labeled Max-Valid'
-aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600 && msgpass || msgfail
+testsuccess --nomsg aptgetupdate -o Acquire::Max-ValidTime=86400 -o Acquire::Max-ValidTime::Testcases=1209600
 
 setupreleasefile 'now - 7 days' 'now + 4 days'
 msgtest 'Release file is rejected as it has' 'bad labeled Max-Valid'
-aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=1209600 -o Acquire::Max-ValidTime::Testcases=86400
 
 setupreleasefile 'now - 7 days' 'now + 1 days'
 msgtest 'Release file is accepted as it has' 'good Until (good Min-Valid, no Max-Valid)'
-aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail
+testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600
 
 setupreleasefile 'now - 7 days' 'now - 4 days'
 msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, no Max-Valid)'
-aptgetupdate -o Acquire::Min-ValidTime=1209600 && msgpass || msgfail
+testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600
 
 setupreleasefile 'now - 7 days' 'now - 2 days'
 msgtest 'Release file is accepted as it has' 'good Min-Valid (bad Until, good Max-Valid) <'
-aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200 && msgpass || msgfail
+testsuccess --nomsg aptgetupdate -o Acquire::Min-ValidTime=1209600 -o Acquire::Max-ValidTime=2419200
 
 setupreleasefile 'now - 7 days' 'now - 2 days'
 msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, good Min-Valid) >'
-aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=2419200
 
 setupreleasefile 'now - 7 days' 'now - 2 days'
 msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) <'
-aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Min-ValidTime=12096 -o Acquire::Max-ValidTime=241920
 
 setupreleasefile 'now - 7 days' 'now - 2 days'
 msgtest 'Release file is rejected as it has' 'bad Max-Valid (bad Until, bad Min-Valid) >'
-aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920 && msgfail || msgpass
+testfailure --nomsg aptgetupdate -o Acquire::Max-ValidTime=12096 -o Acquire::Min-ValidTime=241920

+ 33 - 2
test/integration/test-releasefile-verification

@@ -107,13 +107,24 @@ runtest() {
 " aptcache show apt
 	installaptnew
 
+	prepare ${PKGFILE}
+	rm -rf rootdir/var/lib/apt/lists
+	cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
+	signreleasefiles 'Rex Expired'
+	find aptarchive/ -name "$DELETEFILE" -delete
+	msgtest 'Cold archive signed by' 'Rex Expired'
+	aptget update 2>&1 | grep -E '^W: .* KEYEXPIRED' > /dev/null && msgpass || msgfail
+	testequal "$(cat ${PKGFILE})
+" aptcache show apt
+	failaptold
+	rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
 
 	prepare ${PKGFILE}
 	rm -rf rootdir/var/lib/apt/lists
 	signreleasefiles 'Marvin Paranoid'
 	find aptarchive/ -name "$DELETEFILE" -delete
 	msgtest 'Cold archive signed by' 'Marvin Paranoid'
-	aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgpass || msgfail
+	aptget update 2>&1 | grep -E '^W: .* NO_PUBKEY' > /dev/null && msgpass || msgfail
 	testequal "$(cat ${PKGFILE})
 " aptcache show apt
 	failaptold
@@ -147,10 +158,30 @@ runtest() {
 	signreleasefiles 'Marvin Paranoid'
 	find aptarchive/ -name "$DELETEFILE" -delete
 	msgtest 'Good warm archive signed by' 'Marvin Paranoid'
-	aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgpass || msgfail
+	aptget update 2>&1 | grep -E '^W: .* NO_PUBKEY' > /dev/null && msgpass || msgfail
+	testequal "$(cat ${PKGFILE})
+" aptcache show apt
+	installaptold
+
+	prepare ${PKGFILE}-new
+	cp keys/rexexpired.pub rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
+	signreleasefiles 'Rex Expired'
+	find aptarchive/ -name "$DELETEFILE" -delete
+	msgtest 'Good warm archive signed by' 'Rex Expired'
+	aptget update 2>&1 | grep -E '^W: .* KEYEXPIRED' > /dev/null && msgpass || msgfail
 	testequal "$(cat ${PKGFILE})
 " aptcache show apt
 	installaptold
+	rm rootdir/etc/apt/trusted.gpg.d/rexexpired.gpg
+
+	prepare ${PKGFILE}-new
+	signreleasefiles
+	find aptarchive/ -name "$DELETEFILE" -delete
+	msgtest 'Good warm archive signed by' 'Joe Sixpack'
+	aptget update 2>&1 | grep -E '^(W|E): ' > /dev/null && msgfail || msgpass
+	testequal "$(cat ${PKGFILE}-new)
+" aptcache show apt
+	installaptnew
 }
 
 runtest2() {

+ 2 - 4
test/integration/test-ubuntu-bug-761175-remove-purge

@@ -18,12 +18,10 @@ setupaptarchive
 
 
 testdpkgnotinstalled compiz-core
-msgtest 'Install package' 'compiz-core'
-aptget install compiz-core -qq 2>&1 >/dev/null && msgpass || msgfail
+testsuccess aptget install compiz-core
 testdpkginstalled compiz-core
 
-msgtest 'Remove package' 'compiz-core'
-aptget remove compiz-core -y -qq 2>&1 >/dev/null && msgpass || msgfail
+testsuccess aptget remove compiz-core -y
 testdpkgnotinstalled compiz-core
 
 msgtest 'Check that conffiles are still around for' 'compiz-core'

+ 1 - 1
test/integration/test-ubuntu-bug-784473-InRelease-one-message-only

@@ -28,7 +28,7 @@ MD5Sum:
 done
 
 msgtest 'The unsigned garbage before signed block is' 'ignored'
-aptget update -qq > /dev/null 2>&1 && msgpass || msgfail
+testsuccess --nomsg aptget update
 
 ROOTDIR="$(readlink -f .)"
 testequal "Package files:

+ 4 - 0
test/libapt/configuration_test.cc

@@ -98,6 +98,10 @@ int main(int argc,const char *argv[]) {
 	equals(Cnf.FindDir("Dir::State"), "/rootdir/dev/null");
 	equals(Cnf.FindDir("Dir::State::lists"), "/rootdir/dev/null");
 
+        Cnf.Set("Moo::Bar", "1");
+        Cnf.Clear();
+        equals(Cnf.Find("Moo::Bar"), "");
+
 	//FIXME: Test for configuration file parsing;
 	// currently only integration/ tests test them implicitly
 

+ 42 - 0
test/libapt/fileutl_test.cc

@@ -0,0 +1,42 @@
+#include <apt-pkg/error.h>
+#include <apt-pkg/fileutl.h>
+
+#include "assert.h"
+#include <string>
+#include <vector>
+
+#include <stdio.h>
+#include <iostream>
+#include <stdlib.h>
+
+
+int main(int argc,char *argv[])
+{
+   std::vector<std::string> files;
+
+   // normal match
+   files = Glob("*.lst");
+   if (files.size() != 1)
+   {
+      _error->DumpErrors();
+      return 1;
+   }
+
+   // not there
+   files = Glob("xxxyyyzzz");
+   if (files.size() != 0 || _error->PendingError())
+   {
+      _error->DumpErrors();
+      return 1;
+   }
+
+   // many matches (number is a bit random)
+   files = Glob("*.cc");
+   if (files.size() < 10)
+   {
+      _error->DumpErrors();
+      return 1;
+   }
+
+   return 0;
+}

+ 5 - 0
test/libapt/makefile

@@ -98,6 +98,11 @@ include $(PROGRAM_H)
 PROGRAM = IndexCopyToSourceList${BASENAME}
 SLIBS = -lapt-pkg
 SOURCE = indexcopytosourcelist_test.cc
+
+# test fileutls
+PROGRAM = FileUtl${BASENAME}
+SLIBS = -lapt-pkg 
+SOURCE = fileutl_test.cc
 include $(PROGRAM_H)
 
 # test tagfile