[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#924662: apt: vendor/getinfo can misdetect parent of Ubuntu derivatives, causing unsatisfiable dependency



On Fri, 15 Mar 2019 at 15:21:42 +0000, Simon McVittie wrote:
> Proposed patches: https://salsa.debian.org/apt-team/apt/merge_requests/55
> or attached.

Sorry, really attached now (I've taken the opportunity to reference
the bug number).

    smcv
>From e6633f03b2537e10956b38e9b2d5f2ec6809bb7b Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 15 Mar 2019 14:42:03 +0000
Subject: [PATCH 1/2] vendor/getinfo: Iterate through vendors in lexicographic
 order

find(1) works in readdir() order, which isn't guaranteed to be sorted.
If the current vendor is not an exact match for any subdirectory in
vendor/, and is somehow a derivative of more than one of them, we should
at least produce a deterministic answer.

Closes: #924662
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 vendor/getinfo | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vendor/getinfo b/vendor/getinfo
index 37eb74cef..8830c238f 100755
--- a/vendor/getinfo
+++ b/vendor/getinfo
@@ -6,7 +6,7 @@ BASEDIR="$(readlink -f "$(dirname $0)")"
 getcurrent() {
 	# search for an exact match to use the correct sources.list example
 	cd $BASEDIR
-	DISTROS="$(find . -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2)"
+	DISTROS="$(find . -mindepth 1 -maxdepth 1 -type d | cut -d'/' -f 2 | LC_ALL=C sort)"
 	for DISTRO in $DISTROS; do
 		if dpkg-vendor --is $DISTRO; then
 			echo $DISTRO
-- 
2.20.1

>From 0445980feb3099945674c28da3bd8b329a4e2ff1 Mon Sep 17 00:00:00 2001
From: Simon McVittie <smcv@collabora.com>
Date: Fri, 15 Mar 2019 14:39:40 +0000
Subject: [PATCH 2/2] vendor/getinfo: Don't assume that Ubuntu is the last
 vendor

If your dpkg-vendor configuration in base-files is an Ubuntu derivative,
but not exactly Ubuntu, and not an exact match for anything in vendor/,
we want to use vendor/ubuntu.

Previously we used whatever $DISTRO happened to be at the end of the
"for" loop above, but that's undesirable: even if we assume that find(1)
returns results in alphabetical order (which is not guaranteed), we
wouldn't want to return a non-Ubuntu result if a future apt version
happens to have a vendor that sorts later than vendor/ubuntu, for
example vendor/zombieos or something.

Closes: #924662
Signed-off-by: Simon McVittie <smcv@collabora.com>
---
 vendor/getinfo | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/vendor/getinfo b/vendor/getinfo
index 8830c238f..2ef257c90 100755
--- a/vendor/getinfo
+++ b/vendor/getinfo
@@ -28,7 +28,7 @@ getcurrent() {
 
 	# Do the ubuntu/debian dance we talked about
 	if dpkg-vendor --derives-from ubuntu; then
-		echo $DISTRO
+		echo ubuntu
 		return 0
 	fi
 
-- 
2.20.1


Reply to: