summaryrefslogtreecommitdiff
path: root/pkgtools/pkg_rolling-replace
diff options
context:
space:
mode:
authorgdt <gdt@pkgsrc.org>2010-12-20 15:24:24 +0000
committergdt <gdt@pkgsrc.org>2010-12-20 15:24:24 +0000
commitdbfd288b795eafde34200d7a1f7b0155cae18975 (patch)
treea2d1744cd1a65dfb10c616b43311cbf99e25b4bb /pkgtools/pkg_rolling-replace
parent2a806718bd85e6f723d13f87c086ef64165e102e (diff)
downloadpkgsrc-dbfd288b795eafde34200d7a1f7b0155cae18975.tar.gz
0.22: Avoid infinite loop in some error cases.
Sometimes, the set of packages to be replaced ($REPLACE_TODO) does not have any members which are installed (and hence in $TSORTED). This caused the loop over $TSORTED to not find any packages to replace. The check for not having found one was missing, resulting in the last package in TSORTED being replaced. Because $REPLACE_TODO is still non-empty, this repeats. This patch adds an abort when no packages in $TSORTED are in $REPLACE_TODO. Analysis and patch from Ian D. Leroux on pkgsrc-users@.
Diffstat (limited to 'pkgtools/pkg_rolling-replace')
-rw-r--r--pkgtools/pkg_rolling-replace/Makefile4
-rwxr-xr-xpkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh9
2 files changed, 8 insertions, 5 deletions
diff --git a/pkgtools/pkg_rolling-replace/Makefile b/pkgtools/pkg_rolling-replace/Makefile
index 2f3701fe3d7..63314cd85a1 100644
--- a/pkgtools/pkg_rolling-replace/Makefile
+++ b/pkgtools/pkg_rolling-replace/Makefile
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.29 2010/02/11 12:07:33 tnn Exp $
+# $NetBSD: Makefile,v 1.30 2010/12/20 15:24:24 gdt Exp $
-DISTNAME= pkg_rolling-replace-0.21
+DISTNAME= pkg_rolling-replace-0.22
CATEGORIES= pkgtools
MASTER_SITES= # empty
DISTFILES= # empty
diff --git a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
index 056c42681df..f17db7596dd 100755
--- a/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
+++ b/pkgtools/pkg_rolling-replace/files/pkg_rolling-replace.sh
@@ -1,6 +1,6 @@
#!/bin/sh
-# $NetBSD: pkg_rolling-replace.sh,v 1.28 2010/02/11 12:54:27 tnn Exp $
+# $NetBSD: pkg_rolling-replace.sh,v 1.29 2010/12/20 15:24:24 gdt Exp $
#<license>
# Copyright (c) 2006 BBN Technologies Corp. All rights reserved.
#
@@ -413,13 +413,16 @@ while [ -n "$REPLACE_TODO" ]; do
echo "${OPI} Tsorting dependency graph"
TSORTED=$(echo $DEPGRAPH_INSTALLED $DEPGRAPH_SRC | tsort)
+ pkgdir=
for pkg in $TSORTED; do
if is_member $pkg $REPLACE_TODO; then
+ pkgdir=$(${PKG_INFO} -Q PKGPATH $pkg)
+ [ -n "$pkgdir" ] || abort "Couldn't extract PKGPATH from installed package $pkg"
break;
fi
done
- pkgdir=$(${PKG_INFO} -Q PKGPATH $pkg)
- [ -n "$pkgdir" ] || abort "Couldn't extract PKGPATH from installed package $pkg"
+ # loop should never exit without selecting a package
+ [ -n "$pkgdir" ] || abort "pkg_chk reports the following packages need replacing, but they are not installed: $REPLACE_TODO"
echo "${OPI} Selecting $pkg ($pkgdir) as next package to replace"
sleep 1