From a2700ddf2536dcf3f712d2d23bcdbd3c6cdc58c8 Mon Sep 17 00:00:00 2001 From: rillig Date: Tue, 7 Feb 2006 21:34:48 +0000 Subject: When in "set -e" mode, the Solaris /bin/sh exits when "cd" fails, even if it occurs as the condition of a "while" or "if", or in combination with && or ||. This, of course, introduces a race condition if someone removes the directory between the two "cd"s. The result would be that the bulk build terminates, but that's not a big issue, as in this case there must be something much more severely broken. --- mk/bulk/pre-build | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'mk/bulk') diff --git a/mk/bulk/pre-build b/mk/bulk/pre-build index abb86c729f9..59ec9736d89 100644 --- a/mk/bulk/pre-build +++ b/mk/bulk/pre-build @@ -1,5 +1,5 @@ #!/bin/sh -# $NetBSD: pre-build,v 1.57 2006/01/29 23:07:04 rillig Exp $ +# $NetBSD: pre-build,v 1.58 2006/02/07 21:34:48 rillig Exp $ # # Clean up system to be ready for bulk pkg build # @@ -111,7 +111,11 @@ PKG_TOOLS_BIN=`(cd "${PKGLINT_PKG_DIR}" && ${BMAKE} show-var VARNAME=PKG_TOOLS_B for dbdir in "${PKG_DBDIR}" "${DEPOTBASE}"; do echo "pre-build> Removing all installed packages in ${dbdir}" - if cd "$dbdir" 1>/dev/null 2>&1; then + + # The Solaris /bin/sh requires the following weird-looking code. + if (cd "$dbdir" 1>/dev/null 2>&1); then + cd "$dbdir" + for pkg in * do if ${PKG_TOOLS_BIN}/pkg_info -K "$dbdir" -qe "$pkg"; then -- cgit v1.2.3