summaryrefslogtreecommitdiff
path: root/apt-pkg
diff options
context:
space:
mode:
authorMichael Vogt <michael.vogt@ubuntu.com>2008-06-03 17:42:15 +0200
committerMichael Vogt <michael.vogt@ubuntu.com>2008-06-03 17:42:15 +0200
commitbb6dd359654f4debd9816cc27fd893a437eb66cd (patch)
tree90455b04278331072984b0536bee3d5a2b238a90 /apt-pkg
parent9bf036e28d4401f92a79f3486095ab1088d7ace5 (diff)
parent81fef212a8945e713d6d8f7f0c0030b03d4caf47 (diff)
* Apply patch to avoid truncating of arbitrary files. Thanks to Bryan
Donlan <bdonlan@fushizen.net> for the patch. Closes: #482476 * Avoid using dbus if dbus-daemon isn't running. Closes: #438803 * apt-pkg/deb/dpkgpm.cc: - improve apt progress reporting, display trigger actions * apt-pkg/depcache.cc: - when checking for new important deps, skip critical ones (LP: #236360) * Vietnamese updated. Closes: #479748 * Russian updated. Closes: #479777 * Galician updated. Closes: #479792 * Portuguese updated. Closes: #479847 * Swedish updated. Closes: #479871 * Dutch updated. Closes: #480125 * Kurdish added. Closes: #480150 * Brazilian Portuguese updated. Closes: #480561 * Hungarian updated. Closes: #480662 * Apply patch to avoid truncating of arbitrary files. Thanks to Bryan Donlan <bdonlan@fushizen.net> for the patch. Closes: #482476 * Avoid using dbus if dbus-daemon isn't running. Closes: #438803 * debian/apt.cron.daily: - apply patch based on the ideas of Francesco Poli for better behavior when the cache can not be locked (closes: #459344)
Diffstat (limited to 'apt-pkg')
-rw-r--r--apt-pkg/contrib/fileutl.cc4
-rw-r--r--apt-pkg/deb/dpkgpm.cc42
-rw-r--r--apt-pkg/deb/dpkgpm.h2
-rw-r--r--apt-pkg/depcache.cc5
4 files changed, 49 insertions, 4 deletions
diff --git a/apt-pkg/contrib/fileutl.cc b/apt-pkg/contrib/fileutl.cc
index 2b7e25080..a5976cf3a 100644
--- a/apt-pkg/contrib/fileutl.cc
+++ b/apt-pkg/contrib/fileutl.cc
@@ -138,7 +138,9 @@ bool CopyFile(FileFd &From,FileFd &To)
close at some time. */
int GetLock(string File,bool Errors)
{
- int FD = open(File.c_str(),O_RDWR | O_CREAT | O_TRUNC,0640);
+ // GetLock() is used in aptitude on directories with public-write access
+ // Use O_NOFOLLOW here to prevent symlink traversal attacks
+ int FD = open(File.c_str(),O_RDWR | O_CREAT | O_NOFOLLOW,0640);
if (FD < 0)
{
// Read only .. cant have locking problems there.
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index b11ecf132..74f672dd9 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -333,6 +333,12 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
'status: /var/cache/apt/archives/krecipes_0.8.1-0ubuntu1_i386.deb : error : trying to overwrite `/usr/share/doc/kde/HTML/en/krecipes/krectip.png', which is also in package krecipes-data
and conffile-prompt like this
'status: conffile-prompt: conffile : 'current-conffile' 'new-conffile' useredited distedited
+
+ Newer versions of dpkg sent also:
+ 'processing: install: pkg'
+ 'processing: configure: pkg'
+ 'processing: remove: pkg'
+ 'processing: trigproc: trigger'
*/
char* list[5];
@@ -351,6 +357,34 @@ void pkgDPkgPM::ProcessDpkgStatusLine(int OutStatusFd, char *line)
char *pkg = list[1];
char *action = _strstrip(list[2]);
+ // 'processing' from dpkg looks like
+ // 'processing: action: pkg'
+ if(strncmp(list[0], "processing", strlen("processing")) == 0)
+ {
+ char s[200];
+ map<string,string>::iterator iter;
+ char *pkg_or_trigger = _strstrip(list[2]);
+ action =_strstrip( list[1]);
+ iter = PackageProcessingOps.find(action);
+ if(iter == PackageProcessingOps.end())
+ {
+ if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
+ std::clog << "ignoring unknwon action: " << action << std::endl;
+ return;
+ }
+ snprintf(s, sizeof(s), _(iter->second.c_str()), pkg_or_trigger);
+
+ status << "pmstatus:" << pkg_or_trigger
+ << ":" << (PackagesDone/float(PackagesTotal)*100.0)
+ << ":" << s
+ << endl;
+ if(OutStatusFd > 0)
+ write(OutStatusFd, status.str().c_str(), status.str().size());
+ if (_config->FindB("Debug::pkgDPkgProgressReporting",false) == true)
+ std::clog << "send: '" << status.str() << "'" << endl;
+ return;
+ }
+
if(strncmp(action,"error",strlen("error")) == 0)
{
status << "pmerror:" << list[1]
@@ -528,7 +562,7 @@ bool pkgDPkgPM::Go(int OutStatusFd)
if (RunScriptsWithPkgs("DPkg::Pre-Install-Pkgs") == false)
return false;
-
+
// map the dpkg states to the operations that are performed
// (this is sorted in the same way as Item::Ops)
static const struct DpkgState DpkgStatesOpMap[][7] = {
@@ -568,6 +602,12 @@ bool pkgDPkgPM::Go(int OutStatusFd)
},
};
+ // populate the "processing" map
+ PackageProcessingOps.insert( make_pair("install",N_("Installing %s")) );
+ PackageProcessingOps.insert( make_pair("configure",N_("Configuring %s")) );
+ PackageProcessingOps.insert( make_pair("remove",N_("Removing %s")) );
+ PackageProcessingOps.insert( make_pair("trigproc",N_("Triggering %s")) );
+
// init the PackageOps map, go over the list of packages that
// that will be [installed|configured|removed|purged] and add
// them to the PackageOps map (the dpkg states it goes through)
diff --git a/apt-pkg/deb/dpkgpm.h b/apt-pkg/deb/dpkgpm.h
index 3801d5625..51668bdf7 100644
--- a/apt-pkg/deb/dpkgpm.h
+++ b/apt-pkg/deb/dpkgpm.h
@@ -48,6 +48,8 @@ class pkgDPkgPM : public pkgPackageManager
// the int is the state that is already done (e.g. a package that is
// going to be install is already in state "half-installed")
map<string,unsigned int> PackageOpsDone;
+ // map the dpkg "processing" info to human readable names
+ map<string,string> PackageProcessingOps;
// progress reporting
unsigned int PackagesDone;
unsigned int PackagesTotal;
diff --git a/apt-pkg/depcache.cc b/apt-pkg/depcache.cc
index 293630e50..8d8befbdf 100644
--- a/apt-pkg/depcache.cc
+++ b/apt-pkg/depcache.cc
@@ -914,8 +914,9 @@ void pkgDepCache::MarkInstall(PkgIterator const &Pkg,bool AutoInst,
{
//FIXME: deal better with or-groups(?)
DepIterator LocalStart = D;
-
- if(IsImportantDep(D) && Start.TargetPkg() == D.TargetPkg())
+
+ if(IsImportantDep(D) && !D.IsCritical() &&
+ Start.TargetPkg() == D.TargetPkg())
{
if(!isPreviouslySatisfiedImportantDep)
{