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

Bug#561298: debootstrap: download_main fails to iterate through components



Package: debootstrap
Version: 1.0.20
Tags: patch

There's a bug in the following code in download_main.  I've left
comments in the code below describing it:

# Let's assume $p contains 'coreutils' for this explanation..
# $COMPONENTS contains at least 2 entries (ie, "foo bar")
            for c in $COMPONENTS; do
                local details=""
# $details contains ""
                for m in $MIRRORS; do
                        local path="dists/$SUITE/$c/binary-$ARCH/Packages"
                        local pkgdest="$TARGET/$($DLDEST pkg "$SUITE" "$c" "$ARCH" "$m" "$path")"
                        if [ ! -e "$pkgdest" ]; then continue; fi
                        details="$($PKGDETAILS PKGS "$m" "$pkgdest" "$p")"
# $details contains "coreutils -" if the package wasn't found in component 'foo'.
                        if [ "$details" = "$p -" ]; then continue; fi
# Assuming only 1 entry in $MIRRORS, break out of the loop..
...
                done
# At this point, $details contains "coreutils -"
                if [ "$details" != "" ]; then
                        break
# Whoops, coreutils wasn't actually found in 'foo'; it's actually in 'bar'.
# But since $details contains something other than "", we break out of
# the $COMPONENTS loop!  Debootstrap then fails, because coreutils couldn't
# be downloaded.
                fi
            done


This bug is only triggered when you have multiple COMPONENTS, which is
presumably why no one else has hit this (see bug #561283, which allows
usage of multiple components w/ mirror_style main).

The patch below fixes this issue.



--- /usr/share/debootstrap/functions.bak	2009-12-15 16:57:03.000000000 -0500
+++ /usr/share/debootstrap/functions	2009-12-15 19:23:57.000000000 -0500
@@ -685,7 +685,10 @@
 			local pkgdest="$TARGET/$($DLDEST pkg "$SUITE" "$c" "$ARCH" "$m" "$path")"
 			if [ ! -e "$pkgdest" ]; then continue; fi
 			details="$($PKGDETAILS PKGS "$m" "$pkgdest" "$p")"
-			if [ "$details" = "$p -" ]; then continue; fi
+			if [ "$details" = "$p -" ]; then
+				details=""
+				continue
+			fi
 			size="${details##* }"; details="${details% *}"
 			md5="${details##* }"; details="${details% *}"
 			local debdest="$($DLDEST deb $details)"





Reply to: