Forráskód Böngészése

dpkg: Only allow setting selections for known packages

Guillem Jover 14 éve
szülő
commit
e2debc97e6
2 módosított fájl, 8 hozzáadás és 0 törlés
  1. 2 0
      debian/changelog
  2. 6 0
      src/select.c

+ 2 - 0
debian/changelog

@@ -67,6 +67,8 @@ dpkg (1.16.2) UNRELEASED; urgency=low
     --ignore-depends option.
   * Change dpkg-query to not load the available file by default for --list
     and --show, add a new --load-avail option to expose the old behaviour.
+  * Only allow setting selections via «dpkg --set-selections» for known
+    packages (i.e. those present in either the status or available files).
 
   [ Raphaël Hertzog ]
   * Update Dpkg::Shlibs to look into multiarch paths when cross-building

+ 6 - 0
src/select.c

@@ -161,6 +161,12 @@ setselections(const char *const *argv)
     if (pkg == NULL)
       ohshit(_("illegal package name at line %d: %.250s"), lno, err.str);
 
+    if (!pkg_is_informative(pkg, &pkg->installed) &&
+        !pkg_is_informative(pkg, &pkg->available)) {
+      warning(_("package not in database at line %d: %.250s"), lno, namevb.buf);
+      continue;
+    }
+
     nv = namevalue_find_by_name(wantinfos, selvb.buf);
     if (nv == NULL)
       ohshit(_("unknown wanted status at line %d: %.250s"), lno, selvb.buf);