summaryrefslogtreecommitdiff
path: root/apt-pkg/deb
diff options
context:
space:
mode:
Diffstat (limited to 'apt-pkg/deb')
-rw-r--r--apt-pkg/deb/debversion.cc23
-rw-r--r--apt-pkg/deb/dpkgpm.cc8
2 files changed, 29 insertions, 2 deletions
diff --git a/apt-pkg/deb/debversion.cc b/apt-pkg/deb/debversion.cc
index aeee61929..064d8fa5b 100644
--- a/apt-pkg/deb/debversion.cc
+++ b/apt-pkg/deb/debversion.cc
@@ -59,7 +59,7 @@ int debVersioningSystem::CmpFragment(const char *A,const char *AEnd,
}
/* Iterate over the whole string
- What this does is to spilt the whole string into groups of
+ What this does is to split the whole string into groups of
numeric and non numeric portions. For instance:
a67bhgs89
Has 4 portions 'a', '67', 'bhgs', '89'. A more normal:
@@ -140,6 +140,27 @@ int debVersioningSystem::DoCmpVersion(const char *A,const char *AEnd,
if (rhs == BEnd)
rhs = B;
+ // Special case: a zero epoch is the same as no epoch,
+ // so remove it.
+ if (lhs != A)
+ {
+ for (; *A == '0'; ++A);
+ if (A == lhs)
+ {
+ ++A;
+ ++lhs;
+ }
+ }
+ if (rhs != B)
+ {
+ for (; *B == '0'; ++B);
+ if (B == rhs)
+ {
+ ++B;
+ ++rhs;
+ }
+ }
+
// Compare the epoch
int Res = CmpFragment(A,lhs,B,rhs);
if (Res != 0)
diff --git a/apt-pkg/deb/dpkgpm.cc b/apt-pkg/deb/dpkgpm.cc
index 667db8ff2..bf0434ccc 100644
--- a/apt-pkg/deb/dpkgpm.cc
+++ b/apt-pkg/deb/dpkgpm.cc
@@ -624,7 +624,13 @@ bool pkgDPkgPM::Go(int OutStatusFd)
*/
char* list[5];
- TokSplitString(':', line, list, sizeof(list)/sizeof(list[0]));
+ if(!TokSplitString(':', line, list, sizeof(list)/sizeof(list[0])))
+ // FIXME: dpkg sends multiline error messages sometimes (see
+ // #374195 for a example. we should support this by
+ // either patching dpkg to not send multiline over the
+ // statusfd or by rewriting the code here to deal with
+ // it. for now we just ignore it and not crash
+ continue;
char *pkg = list[1];
char *action = _strstrip(list[2]);