Просмотр исходного кода

u-a: Only warn for now on out of range priorities on --install

There seems to be packages using priorities > INT_MAX, which although
bogus as they were previously overflowing the int used to store them,
that would cause installation failures when upgrading from squeeze.

Turn this into a warning for now and clamp the values, which will be
switched back to an error after wheezy, in dpkg 1.17.x.

Closes: #676874
Guillem Jover лет назад: 14
Родитель
Сommit
18d9373b27
2 измененных файлов с 18 добавлено и 2 удалено
  1. 11 0
      debian/changelog
  2. 7 2
      utils/update-alternatives.c

+ 11 - 0
debian/changelog

@@ -1,3 +1,14 @@
+dpkg (1.16.4.3) UNRELEASED; urgency=low
+
+  * On «update-alternatives --install» only warn for now on out of range
+    priorities and clamp the values, as there seems to be packages using
+    priorities > INT_MAX, which although bogus as they were previously
+    overflowing the int used to store them, that would cause installation
+    failures when upgrading from squeeze. This will be reverted to an
+    error after wheezy. Closes: #676874
+
+ -- Guillem Jover <guillem@debian.org>  Sun, 10 Jun 2012 23:17:40 +0200
+
 dpkg (1.16.4.2) unstable; urgency=low
 
   * Check correctly for out of range negative field width values in dpkg-query

+ 7 - 2
utils/update-alternatives.c

@@ -2476,8 +2476,13 @@ main(int argc, char **argv)
 			prio = strtol(prio_str, &prio_end, 10);
 			if (prio_str == prio_end || *prio_end != '\0')
 				badusage(_("priority must be an integer"));
-			if (prio < INT_MIN || prio > INT_MAX || errno == ERANGE)
-				badusage(_("priority is out of range"));
+			if (prio < INT_MIN || prio > INT_MAX || errno == ERANGE) {
+				/* XXX: Switch back to error on 1.17.x. */
+				prio = clamp(prio, INT_MIN, INT_MAX);
+				warning(_("priority is out of range: "
+				          "%s clamped to %ld"),
+				        prio_str, prio);
+			}
 
 			a = alternative_new(argv[i + 2]);
 			inst_alt = alternative_new(argv[i + 2]);