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

Abort downgrade if the triggers db contains arch-qualified packages

Older dpkg versions won't be able to parse the triggers file when
there's arch-qualified package names, avoid getting into a broken
state by aborting early.
Guillem Jover лет назад: 14
Родитель
Сommit
2d0df68eed
1 измененных файлов с 18 добавлено и 0 удалено
  1. 18 0
      debian/dpkg.prerm

+ 18 - 0
debian/dpkg.prerm

@@ -63,6 +63,7 @@ downgrade_multiarch_infodb()
 {
     admindir=${DPKG_ADMINDIR:-/var/lib/dpkg}
     pkgadmindir=$admindir/info
+    triggersdir=$admindir/triggers
 
     coinst_pkgs="`ls "$pkgadmindir" | \
         sed -n -e 's/^\([^:]\+:[^.]\+\)\..*$/\1/p' | sort -u | \
@@ -110,6 +111,23 @@ downgrade_multiarch_infodb()
 	exit 1
     fi
 
+    file_triggers_pkgs="`sed -n -e 's/^[^ ]\+ \([^:]\+\):[^.]\+$/\1/p' \
+        $triggersdir/File| sort -u`"
+
+    if [ -n "$file_triggers_pkgs" ]; then
+	cat <<-MSG
+	dpkg: error: The triggers database contains arch-qualified package
+	names that the old dpkg won't parse. You should get rid of them (or
+	downgrade them to a non Multi-Arch: same version) before proceeding
+	with dpkg's downgrade.
+
+	List of affected packages:
+
+	$file_triggers_pkgs
+	MSG
+	exit 1
+    fi
+
     echo "Downgrading the multiarch dpkg control files database ..."
     ls $pkgadmindir | grep : | while read oldfile; do
         # We first do a round of hardlinks to the new names, so that the db