The following commit has been merged in the master branch:
commit d918d025f1ef1c15b76eb2fcc14d5830514937a9
Author: Guillem Jover <[email protected]>
Date: Sun Sep 18 07:11:48 2011 +0200
dpkg: Do not fail on version parsing warnings in --compare-versions
The bogus versions might get fed into «dpkg --compare-versions» by
way of maintainer scripts, which would get the bogus versions from
the database, somewhere dpkg still allows those to exist.
diff --git a/debian/changelog b/debian/changelog
index 8d28abf..7183743 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -215,6 +215,9 @@ dpkg (1.16.1) UNRELEASED; urgency=low
it does not end up pulling triglib.
* Reduce dpkg-deb binary size by refectoring libdpkg modules so that it
does not end up pulling triglib.
+ * Do not fail on --compare-version when generating parse warnings.
+ Existing packages with invalid versions should not fail on their
+ maintainer scripts due to that.
[ Updated dpkg translations ]
* German (Sven Joachim). Closes: #620312
diff --git a/src/enquiry.c b/src/enquiry.c
index 54c0412..9ac18f5 100644
--- a/src/enquiry.c
+++ b/src/enquiry.c
@@ -524,14 +524,22 @@ cmpversions(const char *const *argv)
if (!rip->string) badusage(_("--compare-versions bad relation"));
if (*argv[0] && strcmp(argv[0],"<unknown>")) {
- if (parseversion(&a, argv[0], &err) < 0)
- ohshit(_("version '%s' has bad syntax: %s"), argv[0], err.str);
+ if (parseversion(&a, argv[0], &err) < 0) {
+ if (err.type == DPKG_MSG_WARN)
+ warning(_("version '%s' has bad syntax: %s"), argv[0], err.str);
+ else
+ ohshit(_("version '%s' has bad syntax: %s"), argv[0], err.str);
+ }
} else {
blankversion(&a);
}
if (*argv[2] && strcmp(argv[2],"<unknown>")) {
- if (parseversion(&b, argv[2], &err) < 0)
- ohshit(_("version '%s' has bad syntax: %s"), argv[2], err.str);
+ if (parseversion(&b, argv[2], &err) < 0) {
+ if (err.type == DPKG_MSG_WARN)
+ warning(_("version '%s' has bad syntax: %s"), argv[2], err.str);
+ else
+ ohshit(_("version '%s' has bad syntax: %s"), argv[2], err.str);
+ }
} else {
blankversion(&b);
}
--
dpkg's main repository
--
To UNSUBSCRIBE, email to [email protected]
with a subject of "unsubscribe". Trouble? Contact [email protected]