summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--apt-pkg/acquire-item.cc13
-rw-r--r--apt-pkg/algorithms.cc8
-rw-r--r--apt-pkg/contrib/configuration.cc12
-rw-r--r--apt-pkg/contrib/configuration.h1
-rw-r--r--apt-pkg/contrib/fileutl.cc51
-rw-r--r--apt-pkg/contrib/fileutl.h6
-rw-r--r--apt-pkg/contrib/netrc.cc12
-rw-r--r--apt-pkg/contrib/netrc.h4
-rw-r--r--apt-pkg/deb/debsrcrecords.cc125
-rw-r--r--apt-pkg/deb/dpkgpm.cc7
-rw-r--r--apt-pkg/init.h2
-rw-r--r--apt-pkg/pkgcache.cc4
-rw-r--r--apt-pkg/pkgcache.h2
-rw-r--r--apt-pkg/srcrecords.h1
-rw-r--r--cmdline/apt-get.cc19
-rw-r--r--configure.ac2
-rw-r--r--debian/changelog37
-rw-r--r--debian/control2
-rw-r--r--debian/libapt-pkg4.13.install.in (renamed from debian/libapt-pkg4.12.install.in)0
-rw-r--r--debian/libapt-pkg4.13.symbols (renamed from debian/libapt-pkg4.12.symbols)2
-rw-r--r--doc/apt.conf.5.xml10
-rwxr-xr-xtest/integration/skip-aptwebserver25
-rwxr-xr-xtest/integration/test-debsrc-hashes77
-rw-r--r--test/interactive-helper/makefile2
-rw-r--r--test/libapt/configuration_test.cc4
-rw-r--r--test/libapt/fileutl_test.cc42
-rw-r--r--test/libapt/makefile5
27 files changed, 381 insertions, 94 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 95dadcd6d..12000a8c1 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -1247,9 +1247,20 @@ void pkgAcqMetaIndex::Done(string Message,unsigned long long Size,string Hash, /
}
else
{
+ // FIXME: move this into pkgAcqMetaClearSig::Done on the next
+ // ABI break
+
+ // if we expect a ClearTextSignature (InRelase), ensure that
+ // this is what we get and if not fail to queue a
+ // Release/Release.gpg, see #346386
+ if (SigFile == DestFile && !StartsWithGPGClearTextSignature(DestFile))
+ {
+ Failed(Message, Cfg);
+ return;
+ }
+
// There was a signature file, so pass it to gpgv for
// verification
-
if (_config->FindB("Debug::pkgAcquire::Auth", false))
std::cerr << "Metaindex acquired, queueing gpg verification ("
<< SigFile << "," << DestFile << ")\n";
diff --git a/apt-pkg/algorithms.cc b/apt-pkg/algorithms.cc
index 85799a11b..6296e8fe8 100644
--- a/apt-pkg/algorithms.cc
+++ b/apt-pkg/algorithms.cc
@@ -550,14 +550,12 @@ void pkgProblemResolver::MakeScores()
unsigned long Size = Cache.Head().PackageCount;
memset(Scores,0,sizeof(*Scores)*Size);
- // Maps to pkgCache::State::VerPriority
- // which is "Important Required Standard Optional Extra"
- // (yes, that is confusing, the order of pkgCache::State::VerPriority
- // needs to be adjusted but that requires a ABI break)
+ // maps to pkgCache::State::VerPriority:
+ // Required Important Standard Optional Extra
int PrioMap[] = {
0,
- _config->FindI("pkgProblemResolver::Scores::Important",2),
_config->FindI("pkgProblemResolver::Scores::Required",3),
+ _config->FindI("pkgProblemResolver::Scores::Important",2),
_config->FindI("pkgProblemResolver::Scores::Standard",1),
_config->FindI("pkgProblemResolver::Scores::Optional",-1),
_config->FindI("pkgProblemResolver::Scores::Extra",-2)
diff --git a/apt-pkg/contrib/configuration.cc b/apt-pkg/contrib/configuration.cc
index 376617401..4ef4663c0 100644
--- a/apt-pkg/contrib/configuration.cc
+++ b/apt-pkg/contrib/configuration.cc
@@ -422,6 +422,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 /*{{{*/
// ---------------------------------------------------------------------
/* */
diff --git a/apt-pkg/contrib/configuration.h b/apt-pkg/contrib/configuration.h
index ea94c2fe6..8e09ea0a6 100644
--- a/apt-pkg/contrib/configuration.h
+++ b/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);
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index f24df65fc..ac2879017 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/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>
@@ -856,6 +858,26 @@ bool ExecWait(pid_t Pid,const char *Name,bool Reap)
}
/*}}}*/
+// StartsWithGPGClearTextSignature - Check if a file is Pgp/GPG clearsigned /*{{{*/
+// ---------------------------------------------------------------------
+/* */
+bool StartsWithGPGClearTextSignature(string const &FileName)
+{
+ static const char* SIGMSG = "-----BEGIN PGP SIGNED MESSAGE-----\n";
+ char buffer[strlen(SIGMSG)+1];
+ FILE* gpg = fopen(FileName.c_str(), "r");
+ if (gpg == NULL)
+ return false;
+
+ char const * const test = fgets(buffer, sizeof(buffer), gpg);
+ fclose(gpg);
+ if (test == NULL || strcmp(buffer, SIGMSG) != 0)
+ return false;
+
+ return true;
+}
+
+
// FileFd::Open - Open a file /*{{{*/
// ---------------------------------------------------------------------
/* The most commonly used open mode combinations are given with Mode */
@@ -1766,3 +1788,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;
+}
+ /*}}}*/
diff --git a/apt-pkg/contrib/fileutl.h b/apt-pkg/contrib/fileutl.h
index 3ec01dd9a..9402c8f75 100644
--- a/apt-pkg/contrib/fileutl.h
+++ b/apt-pkg/contrib/fileutl.h
@@ -184,6 +184,9 @@ bool WaitFd(int Fd,bool write = false,unsigned long timeout = 0);
pid_t ExecFork();
bool ExecWait(pid_t Pid,const char *Name,bool Reap = false);
+// check if the given file starts with a PGP cleartext signature
+bool StartsWithGPGClearTextSignature(std::string const &FileName);
+
// File string manipulators
std::string flNotDir(std::string File);
std::string flNotFile(std::string File);
@@ -191,4 +194,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
diff --git a/apt-pkg/contrib/netrc.cc b/apt-pkg/contrib/netrc.cc
index de95aa4ab..e61a82f8c 100644
--- a/apt-pkg/contrib/netrc.cc
+++ b/apt-pkg/contrib/netrc.cc
@@ -153,18 +153,6 @@ static int parsenetrc_string (char *host, std::string &login, std::string &passw
return retcode;
}
-// for some unknown reason this method is exported so keep a compatible interface for now …
-int parsenetrc (char *host, char *login, char *password, char *netrcfile = NULL)
-{
- std::string login_string, password_string;
- int const ret = parsenetrc_string(host, login_string, password_string, netrcfile);
- if (ret < 0)
- return ret;
- strncpy(login, login_string.c_str(), LOGINSIZE - 1);
- strncpy(password, password_string.c_str(), PASSWORDSIZE - 1);
- return ret;
-}
-
void maybe_add_auth (URI &Uri, string NetRCFile)
{
diff --git a/apt-pkg/contrib/netrc.h b/apt-pkg/contrib/netrc.h
index 6feb5b726..7349126c4 100644
--- a/apt-pkg/contrib/netrc.h
+++ b/apt-pkg/contrib/netrc.h
@@ -25,9 +25,5 @@
class URI;
-// kill this export on the next ABI break - strongly doubt its in use anyway
-// outside of the apt itself, its really a internal interface
-__deprecated int parsenetrc (char *host, char *login, char *password, char *filename);
-
void maybe_add_auth (URI &Uri, std::string NetRCFile);
#endif
diff --git a/apt-pkg/deb/debsrcrecords.cc b/apt-pkg/deb/debsrcrecords.cc
index ce55ccd1f..f5fb2da4a 100644
--- a/apt-pkg/deb/debsrcrecords.cc
+++ b/apt-pkg/deb/debsrcrecords.cc
@@ -17,6 +17,7 @@
#include <apt-pkg/strutl.h>
#include <apt-pkg/configuration.h>
#include <apt-pkg/aptconfiguration.h>
+#include <apt-pkg/hashes.h>
using std::max;
/*}}}*/
@@ -114,64 +115,86 @@ bool debSrcRecordParser::BuildDepends(std::vector<pkgSrcRecords::Parser::BuildDe
bool debSrcRecordParser::Files(std::vector<pkgSrcRecords::File> &List)
{
List.erase(List.begin(),List.end());
+
+ // map from the Hashsum field to the hashsum function,
+ // unfortunately this is not a 1:1 mapping from
+ // Hashes::SupporedHashes as e.g. Files is a historic name for the md5
+ const std::pair<const char*, const char*> SourceHashFields[] = {
+ std::make_pair( "Checksums-Sha512", "SHA512"),
+ std::make_pair( "Checksums-Sha256", "SHA256"),
+ std::make_pair( "Checksums-Sha1", "SHA1"),
+ std::make_pair( "Files", "MD5Sum"), // historic Name
+ };
- string Files = Sect.FindS("Files");
- if (Files.empty() == true)
- return false;
+ for (unsigned int i=0;
+ i < sizeof(SourceHashFields)/sizeof(SourceHashFields[0]);
+ i++)
+ {
+ string Files = Sect.FindS(SourceHashFields[i].first);
+ if (Files.empty() == true)
+ continue;
- // Stash the / terminated directory prefix
- string Base = Sect.FindS("Directory");
- if (Base.empty() == false && Base[Base.length()-1] != '/')
- Base += '/';
+ // Stash the / terminated directory prefix
+ string Base = Sect.FindS("Directory");
+ if (Base.empty() == false && Base[Base.length()-1] != '/')
+ Base += '/';
- std::vector<std::string> const compExts = APT::Configuration::getCompressorExtensions();
+ std::vector<std::string> const compExts = APT::Configuration::getCompressorExtensions();
- // Iterate over the entire list grabbing each triplet
- const char *C = Files.c_str();
- while (*C != 0)
- {
- pkgSrcRecords::File F;
- string Size;
-
- // Parse each of the elements
- if (ParseQuoteWord(C,F.MD5Hash) == false ||
- ParseQuoteWord(C,Size) == false ||
- ParseQuoteWord(C,F.Path) == false)
- return _error->Error("Error parsing file record");
-
- // Parse the size and append the directory
- F.Size = atoi(Size.c_str());
- F.Path = Base + F.Path;
-
- // Try to guess what sort of file it is we are getting.
- string::size_type Pos = F.Path.length()-1;
- while (1)
- {
- string::size_type Tmp = F.Path.rfind('.',Pos);
- if (Tmp == string::npos)
- break;
- if (F.Type == "tar") {
- // source v3 has extension 'debian.tar.*' instead of 'diff.*'
- if (string(F.Path, Tmp+1, Pos-Tmp) == "debian")
- F.Type = "diff";
- break;
- }
- F.Type = string(F.Path,Tmp+1,Pos-Tmp);
+ // Iterate over the entire list grabbing each triplet
+ const char *C = Files.c_str();
+ while (*C != 0)
+ {
+ pkgSrcRecords::File F;
+ string Size;
+
+ // Parse each of the elements
+ std::string RawHash;
+ if (ParseQuoteWord(C, RawHash) == false ||
+ ParseQuoteWord(C, Size) == false ||
+ ParseQuoteWord(C, F.Path) == false)
+ return _error->Error("Error parsing '%s' record",
+ SourceHashFields[i].first);
+ // assign full hash string
+ F.Hash = HashString(SourceHashFields[i].second, RawHash).toStr();
+ // API compat hack
+ if(SourceHashFields[i].second == "MD5Sum")
+ F.MD5Hash = RawHash;
+
+ // Parse the size and append the directory
+ F.Size = atoi(Size.c_str());
+ F.Path = Base + F.Path;
+
+ // Try to guess what sort of file it is we are getting.
+ string::size_type Pos = F.Path.length()-1;
+ while (1)
+ {
+ string::size_type Tmp = F.Path.rfind('.',Pos);
+ if (Tmp == string::npos)
+ break;
+ if (F.Type == "tar") {
+ // source v3 has extension 'debian.tar.*' instead of 'diff.*'
+ if (string(F.Path, Tmp+1, Pos-Tmp) == "debian")
+ F.Type = "diff";
+ break;
+ }
+ F.Type = string(F.Path,Tmp+1,Pos-Tmp);
+
+ if (std::find(compExts.begin(), compExts.end(), std::string(".").append(F.Type)) != compExts.end() ||
+ F.Type == "tar")
+ {
+ Pos = Tmp-1;
+ continue;
+ }
- if (std::find(compExts.begin(), compExts.end(), std::string(".").append(F.Type)) != compExts.end() ||
- F.Type == "tar")
- {
- Pos = Tmp-1;
- continue;
- }
-
- break;
- }
+ break;
+ }
- List.push_back(F);
+ List.push_back(F);
+ }
+ break;
}
-
- return true;
+ return (List.size() > 0);
}
/*}}}*/
// SrcRecordParser::~SrcRecordParser - Destructor /*{{{*/
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 959d06455..03986d0b9 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -454,7 +454,7 @@ bool pkgDPkgPM::RunScriptsWithPkgs(const char *Cnf)
void pkgDPkgPM::DoStdin(int master)
{
unsigned char input_buf[256] = {0,};
- ssize_t len = read(0, input_buf, sizeof(input_buf));
+ ssize_t len = read(STDIN_FILENO, input_buf, sizeof(input_buf));
if (len)
FileFd::Write(master, input_buf, len);
else
@@ -1261,6 +1261,11 @@ bool pkgDPkgPM::Go(int OutStatusFd)
tcsetattr(0, TCSAFLUSH, &rtt);
sigprocmask(SIG_SETMASK, &original_sigmask, 0);
}
+ } else {
+ const char *s = _("Can not write log, tcgetattr() failed for stdout");
+ fprintf(stderr, "%s", s);
+ if(d->term_out)
+ fprintf(d->term_out, "%s",s);
}
// 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.
diff --git a/apt-pkg/init.h b/apt-pkg/init.h
index b6f3df753..00d361560 100644
--- a/apt-pkg/init.h
+++ b/apt-pkg/init.h
@@ -27,7 +27,7 @@ class Configuration;
// Non-ABI-Breaks should only increase RELEASE number.
// See also buildlib/libversion.mak
#define APT_PKG_MAJOR 4
-#define APT_PKG_MINOR 12
+#define APT_PKG_MINOR 13
#define APT_PKG_RELEASE 0
extern const char *pkgVersion;
diff --git a/apt-pkg/pkgcache.cc b/apt-pkg/pkgcache.cc
index 52e814c0b..0b8b6fe77 100644
--- a/apt-pkg/pkgcache.cc
+++ b/apt-pkg/pkgcache.cc
@@ -51,8 +51,8 @@ pkgCache::Header::Header()
/* Whenever the structures change the major version should be bumped,
whenever the generator changes the minor version should be bumped. */
- MajorVersion = 8;
- MinorVersion = 1;
+ MajorVersion = 9;
+ MinorVersion = 0;
Dirty = false;
HeaderSz = sizeof(pkgCache::Header);
diff --git a/apt-pkg/pkgcache.h b/apt-pkg/pkgcache.h
index 1a7013551..565ee657c 100644
--- a/apt-pkg/pkgcache.h
+++ b/apt-pkg/pkgcache.h
@@ -136,7 +136,7 @@ class pkgCache /*{{{*/
/** \brief priority of a package version
Zero is used for unparsable or absent Priority fields. */
- enum VerPriority {Important=1,Required=2,Standard=3,Optional=4,Extra=5};
+ enum VerPriority {Required=1,Important=2,Standard=3,Optional=4,Extra=5};
enum PkgSelectedState {Unknown=0,Install=1,Hold=2,DeInstall=3,Purge=4};
enum PkgInstState {Ok=0,ReInstReq=1,HoldInst=2,HoldReInstReq=3};
enum PkgCurrentState {NotInstalled=0,UnPacked=1,HalfConfigured=2,
diff --git a/apt-pkg/srcrecords.h b/apt-pkg/srcrecords.h
index ed69d0d72..796d2e1bd 100644
--- a/apt-pkg/srcrecords.h
+++ b/apt-pkg/srcrecords.h
@@ -32,6 +32,7 @@ class pkgSrcRecords
struct File
{
std::string MD5Hash;
+ std::string Hash;
unsigned long Size;
std::string Path;
std::string Type;
diff --git a/cmdline/apt-get.cc b/cmdline/apt-get.cc
index 4b7691d93..06daca09b 100644
--- a/cmdline/apt-get.cc
+++ b/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;
@@ -2585,15 +2591,12 @@ bool DoSource(CommandLine &CmdL)
if(queued.find(Last->Index().ArchiveURI(I->Path)) != queued.end())
continue;
queued.insert(Last->Index().ArchiveURI(I->Path));
-
+
// check if we have a file with that md5 sum already localy
- if(!I->MD5Hash.empty() && FileExists(flNotDir(I->Path)))
+ if(!I->Hash.empty() && FileExists(flNotDir(I->Path)))
{
- FileFd Fd(flNotDir(I->Path), FileFd::ReadOnly);
- MD5Summation sum;
- sum.AddFD(Fd.Fd(), Fd.Size());
- Fd.Close();
- if((string)sum.Result() == I->MD5Hash)
+ HashString hash_string = HashString(I->Hash);
+ if(hash_string.VerifyFile(flNotDir(I->Path)))
{
ioprintf(c1out,_("Skipping already downloaded file '%s'\n"),
flNotDir(I->Path).c_str());
@@ -2602,7 +2605,7 @@ bool DoSource(CommandLine &CmdL)
}
new pkgAcqFile(&Fetcher,Last->Index().ArchiveURI(I->Path),
- I->MD5Hash,I->Size,
+ I->Hash,I->Size,
Last->Index().SourceInfo(*Last,*I),Src);
}
}
diff --git a/configure.ac b/configure.ac
index 9fb20b95f..a628c034a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -18,7 +18,7 @@ AC_CONFIG_AUX_DIR(buildlib)
AC_CONFIG_HEADER(include/config.h:buildlib/config.h.in include/apti18n.h:buildlib/apti18n.h.in)
PACKAGE="apt"
-PACKAGE_VERSION="0.9.9.4"
+PACKAGE_VERSION="0.9.10"
PACKAGE_MAIL="APT Development Team <deity@lists.debian.org>"
AC_DEFINE_UNQUOTED(PACKAGE,"$PACKAGE")
AC_DEFINE_UNQUOTED(PACKAGE_VERSION,"$PACKAGE_VERSION")
diff --git a/debian/changelog b/debian/changelog
index 8e4def2b0..6727cde11 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,3 +1,31 @@
+apt (0.9.10~exp1) 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/webserver-simulate-broken-with-fix346386:
+ - fix invalid InRelease file download checking and add regression
+ test to server broken files to the buildin test webserver
+ * stop exporting the accidently exported parsenetrc() symbol
+ * lp:~mvo/apt/add-glob-function:
+ - add Glob() to fileutl.{cc,h}
+ * lp:~mvo/apt/config-clear:
+ - support Configuration.Clear() for a clear of the entire
+ configuration
+ * apt-pkg/deb/dpkgpm.cc:
+ - use tcgetattr() on STDOUT instead of STDIN so that term.log
+ works for redirected stdin
+ - print error in log if tcgetattr() fails instead of writing
+ a empty file
+ * use sha512 when available (LP: #1098752)
+ * [ABI-Break] lp:~mvo/apt/source-hashes:
+ - use sha{512,256,1} for deb-src when available LP: #1098738
+
+ -- Michael Vogt <mvo@debian.org> Fri, 01 Mar 2013 12:12:39 +0100
+
apt (0.9.10) unstable; urgency=low
The "Hello to Debconf" upload
@@ -346,12 +374,21 @@ apt (0.9.7.8) unstable; urgency=criticial
* SECURITY UPDATE: InRelease verification bypass
- CVE-2013-1051
+ [ Programs translation updates ]
+ * Japanese (Kenshi Muto). Closes: #699783
+
[ David Kalnischk ]
* apt-pkg/deb/debmetaindex.cc,
test/integration/test-bug-595691-empty-and-broken-archive-files,
+ * [ABI BREAK] apt-pkg/pkgcache.h:
+ - adjust pkgCache::State::VerPriority enum, to match reality
test/integration/test-releasefile-verification:
- disable InRelease downloading until the verification issue is
fixed, thanks to Ansgar Burchardt for finding the flaw
+ - quote plus in filenames to work around a bug in the S3 server
+ (LP: #1003633)
+ * apt-pkg/indexrecords.cc:
+ - support '\r' in the Release file
-- Michael Vogt <mvo@debian.org> Thu, 14 Mar 2013 07:47:36 +0100
diff --git a/debian/control b/debian/control
index ca18ff01f..a442b66c1 100644
--- a/debian/control
+++ b/debian/control
@@ -36,7 +36,7 @@ Description: commandline package manager
* apt-config as an interface to the configuration settings
* apt-key as an interface to manage authentication keys
-Package: libapt-pkg4.12
+Package: libapt-pkg4.13
Architecture: any
Multi-Arch: same
Pre-Depends: ${misc:Pre-Depends}
diff --git a/debian/libapt-pkg4.12.install.in b/debian/libapt-pkg4.13.install.in
index 56bed39d3..56bed39d3 100644
--- a/debian/libapt-pkg4.12.install.in
+++ b/debian/libapt-pkg4.13.install.in
diff --git a/debian/libapt-pkg4.12.symbols b/debian/libapt-pkg4.13.symbols
index 2b86c9676..07106d2de 100644
--- a/debian/libapt-pkg4.12.symbols
+++ b/debian/libapt-pkg4.13.symbols
@@ -1,4 +1,4 @@
-libapt-pkg.so.4.12 libapt-pkg4.12 #MINVER#
+libapt-pkg.so.4.13 libapt-pkg4.13 #MINVER#
* Build-Depends-Package: libapt-pkg-dev
TFRewritePackageOrder@Base 0.8.0
TFRewriteSourceOrder@Base 0.8.0
diff --git a/doc/apt.conf.5.xml b/doc/apt.conf.5.xml
index 9973fe42b..f5e1f966d 100644
--- a/doc/apt.conf.5.xml
+++ b/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
diff --git a/test/integration/skip-aptwebserver b/test/integration/skip-aptwebserver
new file mode 100755
index 000000000..0622941ce
--- /dev/null
+++ b/test/integration/skip-aptwebserver
@@ -0,0 +1,25 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture 'amd64'
+
+buildsimplenativepackage 'apt' 'all' '1.0' 'stable'
+
+setupaptarchive
+changetowebserver
+
+rm -rf rootdir/var/lib/apt/lists
+aptget update -qq
+testequal 'Hit http://localhost stable InRelease
+Hit http://localhost stable/main Sources
+Hit http://localhost stable/main amd64 Packages
+Hit http://localhost stable/main Translation-en
+Reading package lists...' aptget update
+
+mv rootdir/var/lib/apt/lists/localhost* rootdir/var/lib/apt/lists/partial
+aptget update
+
diff --git a/test/integration/test-debsrc-hashes b/test/integration/test-debsrc-hashes
new file mode 100755
index 000000000..5e917232b
--- /dev/null
+++ b/test/integration/test-debsrc-hashes
@@ -0,0 +1,77 @@
+#!/bin/sh
+set -e
+
+TESTDIR=$(readlink -f $(dirname $0))
+. $TESTDIR/framework
+
+setupenvironment
+configarchitecture "i386"
+
+# pkg-sha256-bad has a bad SHA sum, but good MD5 sum. If apt is
+# checking the best available hash (as it should), this will trigger
+# a hash mismatch.
+
+cat > aptarchive/Sources <<EOF
+Package: pkg-md5-ok
+Binary: pkg-md5-ok
+Version: 1.0
+Maintainer: Joe Sixpack <joe@example.org>
+Architecture: i386
+Files:
+ d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.dsc
+ d41d8cd98f00b204e9800998ecf8427e 0 pkg-md5-ok_1.0.tar.gz
+
+Package: pkg-sha256-ok
+Binary: pkg-sha256-ok
+Version: 1.0
+Maintainer: Joe Sixpack <joe@example.org>
+Architecture: i386
+Files:
+ d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.dsc
+ d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-ok_1.0.tar.gz
+Checksums-Sha1:
+ da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.dsc
+ da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-ok_1.0.tar.gz
+Checksums-Sha256:
+ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.dsc
+ e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 0 pkg-sha256-ok_1.0.tar.gz
+
+Package: pkg-sha256-bad
+Binary: pkg-sha256-bad
+Version: 1.0
+Maintainer: Joe Sixpack <joe@example.org>
+Architecture: i386
+Files:
+ d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.dsc
+ d41d8cd98f00b204e9800998ecf8427e 0 pkg-sha256-bad_1.0.tar.gz
+Checksums-Sha1:
+ da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.dsc
+ da39a3ee5e6b4b0d3255bfef95601890afd80709 0 pkg-sha256-bad_1.0.tar.gz
+Checksums-Sha256:
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 pkg-sha256-bad_1.0.dsc
+ xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx 0 pkg-sha256-bad_1.0.tar.gz
+EOF
+
+# create fetchable files
+for x in "pkg-md5-ok" "pkg-sha256-ok" "pkg-sha256-bad"; do
+ touch aptarchive/${x}_1.0.dsc
+ touch aptarchive/${x}_1.0.tar.gz
+done
+
+testok() {
+ msgtest "Test for hash ok of" "$*"
+ $* 2>&1 | grep "Download complete" > /dev/null && msgpass || msgfail
+}
+
+testmismatch() {
+ msgtest "Test for hash mismatch of" "$*"
+ $* 2>&1 | grep "Hash Sum mismatch" > /dev/null && msgpass || msgfail
+}
+
+setupaptarchive
+changetowebserver
+aptget update -qq
+
+testok aptget source -d pkg-md5-ok
+testok aptget source -d pkg-sha256-ok
+testmismatch aptget source -d pkg-sha256-bad
diff --git a/test/interactive-helper/makefile b/test/interactive-helper/makefile
index f43df97e3..74659cf12 100644
--- a/test/interactive-helper/makefile
+++ b/test/interactive-helper/makefile
@@ -39,7 +39,7 @@ include $(PROGRAM_H)
#SOURCE = rpmver.cc
#include $(PROGRAM_H)
-# Program for testing udevcdrom
+# very simple webserver for APT testing
PROGRAM=aptwebserver
SLIBS = -lapt-pkg
LIB_MAKES = apt-pkg/makefile
diff --git a/test/libapt/configuration_test.cc b/test/libapt/configuration_test.cc
index 87d5699ef..2c974ee0a 100644
--- a/test/libapt/configuration_test.cc
+++ b/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
diff --git a/test/libapt/fileutl_test.cc b/test/libapt/fileutl_test.cc
new file mode 100644
index 000000000..b6b8ac579
--- /dev/null
+++ b/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;
+}
diff --git a/test/libapt/makefile b/test/libapt/makefile
index 1b67cba9d..73403b24c 100644
--- a/test/libapt/makefile
+++ b/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