summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/acquire-item.cc48
-rw-r--r--apt-pkg/aptconfiguration.cc2
-rw-r--r--apt-pkg/deb/debindexfile.cc15
-rw-r--r--apt-pkg/deb/deblistparser.cc2
-rw-r--r--apt-pkg/deb/dpkgpm.cc76
-rw-r--r--apt-pkg/depcache.h2
-rw-r--r--apt-pkg/init.cc3
-rw-r--r--apt-pkg/init.h4
-rw-r--r--apt-pkg/orderlist.cc6
9 files changed, 121 insertions, 37 deletions
diff --git a/apt-pkg/acquire-item.cc b/apt-pkg/acquire-item.cc
index 36abe0ac3..d790bd898 100644
--- a/apt-pkg/acquire-item.cc
+++ b/apt-pkg/acquire-item.cc
@@ -271,6 +271,14 @@ void pkgAcqSubIndex::Done(string Message,unsigned long Size,string Md5Hash, /*{{
string FinalFile = _config->FindDir("Dir::State::lists")+URItoFileName(Desc.URI);
+ /* Downloaded invalid transindex => Error (LP: #346386) (Closes: #627642) */
+ indexRecords SubIndexParser;
+ if (FileExists(DestFile) == true && !SubIndexParser.Load(DestFile)) {
+ Status = StatError;
+ ErrorText = SubIndexParser.ErrorText;
+ return;
+ }
+
// sucess in downloading the index
// rename the index
if(Debug)
@@ -894,6 +902,30 @@ void pkgAcqIndex::Done(string Message,unsigned long Size,string Hash,
ReportMirrorFailure("HashChecksumFailure");
return;
}
+
+ /* Verify the index file for correctness (all indexes must
+ * have a Package field) (LP: #346386) (Closes: #627642) */
+ {
+ FileFd fd(DestFile, FileFd::ReadOnly);
+ pkgTagSection sec;
+ pkgTagFile tag(&fd);
+
+ // Only test for correctness if the file is not empty (empty is ok)
+ if (fd.Size() > 0) {
+ if (_error->PendingError() || !tag.Step(sec)) {
+ Status = StatError;
+ _error->DumpErrors();
+ Rename(DestFile,DestFile + ".FAILED");
+ return;
+ } else if (!sec.Exists("Package")) {
+ Status = StatError;
+ ErrorText = ("Encountered a section with no Package: header");
+ Rename(DestFile,DestFile + ".FAILED");
+ return;
+ }
+ }
+ }
+
// Done, move it into position
string FinalFile = _config->FindDir("Dir::State::lists");
FinalFile += URItoFileName(RealURI);
@@ -1330,6 +1362,16 @@ void pkgAcqMetaIndex::AuthDone(string Message) /*{{{*/
/*}}}*/
void pkgAcqMetaIndex::QueueIndexes(bool verify) /*{{{*/
{
+#if 0
+ /* Reject invalid, existing Release files (LP: #346386) (Closes: #627642)
+ * FIXME: Disabled; it breaks unsigned repositories without hashes */
+ if (!verify && FileExists(DestFile) && !MetaIndexParser->Load(DestFile))
+ {
+ Status = StatError;
+ ErrorText = MetaIndexParser->ErrorText;
+ return;
+ }
+#endif
for (vector <struct IndexTarget*>::const_iterator Target = IndexTargets->begin();
Target != IndexTargets->end();
Target++)
@@ -1493,6 +1535,12 @@ void pkgAcqMetaIndex::Failed(string Message,pkgAcquire::MethodConfig *Cnf)
LookupTag(Message,"Message").c_str());
RunScripts("APT::Update::Auth-Failure");
return;
+ } else if (LookupTag(Message,"Message").find("NODATA") != string::npos) {
+ /* Invalid signature file, reject (LP: #346386) (Closes: #627642) */
+ _error->Error(_("GPG error: %s: %s"),
+ Desc.Description.c_str(),
+ LookupTag(Message,"Message").c_str());
+ return;
} else {
_error->Warning(_("GPG error: %s: %s"),
Desc.Description.c_str(),
diff --git a/apt-pkg/aptconfiguration.cc b/apt-pkg/aptconfiguration.cc
index ca602d4bf..e8c8e73d0 100644
--- a/apt-pkg/aptconfiguration.cc
+++ b/apt-pkg/aptconfiguration.cc
@@ -224,7 +224,7 @@ std::vector<std::string> const Configuration::getLanguages(bool const &All,
environment.push_back("en");
}
- // Support settings like Acquire::Translation=none on the command line to
+ // Support settings like Acquire::Languages=none on the command line to
// override the configuration settings vector of languages.
string const forceLang = _config->Find("Acquire::Languages","");
if (forceLang.empty() == false) {
diff --git a/apt-pkg/deb/debindexfile.cc b/apt-pkg/deb/debindexfile.cc
index 1e8c04033..c9e7f1176 100644
--- a/apt-pkg/deb/debindexfile.cc
+++ b/apt-pkg/deb/debindexfile.cc
@@ -423,12 +423,10 @@ string debTranslationsIndex::IndexURI(const char *Type) const
/* */
bool debTranslationsIndex::GetIndexes(pkgAcquire *Owner) const
{
- if (TranslationsAvailable()) {
- string const TranslationFile = string("Translation-").append(Language);
- new pkgAcqIndexTrans(Owner, IndexURI(Language),
- Info(TranslationFile.c_str()),
- TranslationFile);
- }
+ string const TranslationFile = string("Translation-").append(Language);
+ new pkgAcqIndexTrans(Owner, IndexURI(Language),
+ Info(TranslationFile.c_str()),
+ TranslationFile);
return true;
}
@@ -468,9 +466,6 @@ string debTranslationsIndex::Info(const char *Type) const
/*}}}*/
bool debTranslationsIndex::HasPackages() const /*{{{*/
{
- if(!TranslationsAvailable())
- return false;
-
return FileExists(IndexFile(Language));
}
/*}}}*/
@@ -510,7 +505,7 @@ bool debTranslationsIndex::Merge(pkgCacheGenerator &Gen,OpProgress *Prog) const
{
// Check the translation file, if in use
string TranslationFile = IndexFile(Language);
- if (TranslationsAvailable() && FileExists(TranslationFile))
+ if (FileExists(TranslationFile))
{
FileFd Trans(TranslationFile,FileFd::ReadOnlyGzip);
debListParser TransParser(&Trans);
diff --git a/apt-pkg/deb/deblistparser.cc b/apt-pkg/deb/deblistparser.cc
index a94b79f05..b708296d3 100644
--- a/apt-pkg/deb/deblistparser.cc
+++ b/apt-pkg/deb/deblistparser.cc
@@ -196,7 +196,7 @@ string debListParser::DescriptionLanguage()
if (Section.FindS("Description").empty() == false)
return "";
- std::vector<string> const lang = APT::Configuration::getLanguages();
+ std::vector<string> const lang = APT::Configuration::getLanguages(true);
for (std::vector<string>::const_iterator l = lang.begin();
l != lang.end(); l++)
if (Section.FindS(string("Description-").append(*l).c_str()).empty() == false)
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index cd7c4e5d5..019b72bb8 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -14,8 +14,8 @@
#include <apt-pkg/depcache.h>
#include <apt-pkg/pkgrecords.h>
#include <apt-pkg/strutl.h>
-#include <apti18n.h>
#include <apt-pkg/fileutl.h>
+#include <apt-pkg/cachefile.h>
#include <unistd.h>
#include <stdlib.h>
@@ -32,6 +32,8 @@
#include <algorithm>
#include <sstream>
#include <map>
+#include <pwd.h>
+#include <grp.h>
#include <termios.h>
#include <unistd.h>
@@ -683,7 +685,13 @@ 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);
- chmod(logfile_name.c_str(), 0600);
+ struct passwd *pw;
+ struct group *gr;
+ pw = getpwnam("root");
+ gr = getgrnam("adm");
+ if (pw != NULL && gr != NULL)
+ chown(logfile_name.c_str(), pw->pw_uid, gr->gr_gid);
+ chmod(logfile_name.c_str(), 0644);
fprintf(d->term_out, "\nLog started: %s\n", timestr);
}
@@ -697,31 +705,42 @@ bool pkgDPkgPM::OpenLog()
return _error->WarningE("OpenLog", _("Could not open file '%s'"), history_name.c_str());
chmod(history_name.c_str(), 0644);
fprintf(d->history_out, "\nStart-Date: %s\n", timestr);
- string remove, purge, install, upgrade, downgrade;
+ string remove, purge, install, reinstall, upgrade, downgrade;
for (pkgCache::PkgIterator I = Cache.PkgBegin(); I.end() == false; I++)
{
- if (Cache[I].NewInstall())
- {
- install += I.FullName(false) + string(" (") + Cache[I].CandVersion;
- if (Cache[I].Flags & pkgCache::Flag::Auto)
- install+= ", automatic";
- install += string("), ");
- }
- else if (Cache[I].Upgrade())
- upgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), ");
- else if (Cache[I].Downgrade())
- downgrade += I.FullName(false) + string(" (") + Cache[I].CurVersion + string(", ") + Cache[I].CandVersion + string("), ");
- else if (Cache[I].Delete())
- {
- if ((Cache[I].iFlags & pkgDepCache::Purge) == pkgDepCache::Purge)
- purge += I.FullName(false) + string(" (") + Cache[I].CurVersion + string("), ");
- else
- remove += I.FullName(false) + string(" (") + Cache[I].CurVersion + string("), ");
+ enum { CANDIDATE, CANDIDATE_AUTO, CURRENT_CANDIDATE, CURRENT } infostring;
+ string *line = NULL;
+ #define HISTORYINFO(X, Y) { line = &X; infostring = Y; }
+ if (Cache[I].NewInstall() == true)
+ HISTORYINFO(install, CANDIDATE_AUTO)
+ else if (Cache[I].ReInstall() == true)
+ HISTORYINFO(reinstall, CANDIDATE)
+ else if (Cache[I].Upgrade() == true)
+ HISTORYINFO(upgrade, CURRENT_CANDIDATE)
+ else if (Cache[I].Downgrade() == true)
+ HISTORYINFO(downgrade, CURRENT_CANDIDATE)
+ else if (Cache[I].Delete() == true)
+ HISTORYINFO((Cache[I].Purge() ? purge : remove), CURRENT)
+ else
+ continue;
+ #undef HISTORYINFO
+ line->append(I.FullName(false)).append(" (");
+ switch (infostring) {
+ case CANDIDATE: line->append(Cache[I].CandVersion); break;
+ case CANDIDATE_AUTO:
+ line->append(Cache[I].CandVersion);
+ if ((Cache[I].Flags & pkgCache::Flag::Auto) == pkgCache::Flag::Auto)
+ line->append(", automatic");
+ break;
+ case CURRENT_CANDIDATE: line->append(Cache[I].CurVersion).append(", ").append(Cache[I].CandVersion); break;
+ case CURRENT: line->append(Cache[I].CurVersion); break;
}
+ line->append("), ");
}
if (_config->Exists("Commandline::AsString") == true)
WriteHistoryTag("Commandline", _config->Find("Commandline::AsString"));
WriteHistoryTag("Install", install);
+ WriteHistoryTag("Reinstall", reinstall);
WriteHistoryTag("Upgrade", upgrade);
WriteHistoryTag("Downgrade",downgrade);
WriteHistoryTag("Remove",remove);
@@ -1285,6 +1304,23 @@ bool pkgDPkgPM::Go(int OutStatusFd)
if (RunScripts("DPkg::Post-Invoke") == false)
return false;
+ if (_config->FindB("Debug::pkgDPkgPM",false) == false)
+ {
+ std::string const oldpkgcache = _config->FindFile("Dir::cache::pkgcache");
+ if (oldpkgcache.empty() == false && RealFileExists(oldpkgcache) == true &&
+ unlink(oldpkgcache.c_str()) == 0)
+ {
+ std::string const srcpkgcache = _config->FindFile("Dir::cache::srcpkgcache");
+ if (srcpkgcache.empty() == false && RealFileExists(srcpkgcache) == true)
+ {
+ _error->PushToStack();
+ pkgCacheFile CacheFile;
+ CacheFile.BuildCaches(NULL, true);
+ _error->RevertToStack();
+ }
+ }
+ }
+
Cache.writeStateFile(NULL);
return true;
}
diff --git a/apt-pkg/depcache.h b/apt-pkg/depcache.h
index 2942558b0..adc010c28 100644
--- a/apt-pkg/depcache.h
+++ b/apt-pkg/depcache.h
@@ -231,6 +231,7 @@ class pkgDepCache : protected pkgCache::Namespace
// Various test members for the current status of the package
inline bool NewInstall() const {return Status == 2 && Mode == ModeInstall;};
inline bool Delete() const {return Mode == ModeDelete;};
+ inline bool Purge() const {return Delete() == true && (iFlags & pkgDepCache::Purge) == pkgDepCache::Purge; };
inline bool Keep() const {return Mode == ModeKeep;};
inline bool Protect() const {return (iFlags & Protected) == Protected;};
inline bool Upgrade() const {return Status > 0 && Mode == ModeInstall;};
@@ -242,6 +243,7 @@ class pkgDepCache : protected pkgCache::Namespace
inline bool InstBroken() const {return (DepState & DepInstMin) != DepInstMin;};
inline bool InstPolicyBroken() const {return (DepState & DepInstPolicy) != DepInstPolicy;};
inline bool Install() const {return Mode == ModeInstall;};
+ inline bool ReInstall() const {return Delete() == false && (iFlags & pkgDepCache::ReInstall) == pkgDepCache::ReInstall;};
inline VerIterator InstVerIter(pkgCache &Cache)
{return VerIterator(Cache,InstallVer);};
inline VerIterator CandidateVerIter(pkgCache &Cache)
diff --git a/apt-pkg/init.cc b/apt-pkg/init.cc
index aff585e3b..66b0119e6 100644
--- a/apt-pkg/init.cc
+++ b/apt-pkg/init.cc
@@ -87,9 +87,6 @@ bool pkgInitConfig(Configuration &Cnf)
Cnf.Set("Dir::Ignore-Files-Silently::", "\\.bak$");
Cnf.Set("Dir::Ignore-Files-Silently::", "\\.dpkg-[a-z]+$");
- // Translation
- Cnf.Set("APT::Acquire::Translation", "environment");
-
// Default cdrom mount point
Cnf.Set("Acquire::cdrom::mount", "/media/cdrom/");
diff --git a/apt-pkg/init.h b/apt-pkg/init.h
index 15a1165b9..6b92dd200 100644
--- a/apt-pkg/init.h
+++ b/apt-pkg/init.h
@@ -22,8 +22,8 @@
// Non-ABI-Breaks should only increase RELEASE number.
// See also buildlib/libversion.mak
#define APT_PKG_MAJOR 4
-#define APT_PKG_MINOR 10
-#define APT_PKG_RELEASE 1
+#define APT_PKG_MINOR 11
+#define APT_PKG_RELEASE 0
extern const char *pkgVersion;
extern const char *pkgLibVersion;
diff --git a/apt-pkg/orderlist.cc b/apt-pkg/orderlist.cc
index ba43bc757..19661fc2d 100644
--- a/apt-pkg/orderlist.cc
+++ b/apt-pkg/orderlist.cc
@@ -1073,6 +1073,12 @@ bool pkgOrderList::CheckDep(DepIterator D)
just needs one */
if (D.IsNegative() == false)
{
+ // ignore provides by older versions of this package
+ if (((D.Reverse() == false && Pkg == D.ParentPkg()) ||
+ (D.Reverse() == true && Pkg == D.TargetPkg())) &&
+ Cache[Pkg].InstallVer != *I)
+ continue;
+
/* Try to find something that does not have the after flag set
if at all possible */
if (IsFlag(Pkg,After) == true)