pkgsrc-Changes-HG archive

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

[pkgsrc/trunk]: pkgsrc/mk/bulk When in "set -e" mode, the Solaris /bin/sh exi...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/f07ff0efa29f
branches:  trunk
changeset: 507754:f07ff0efa29f
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Tue Feb 07 21:34:48 2006 +0000

description:
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.

diffstat:

 mk/bulk/pre-build |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (23 lines):

diff -r c3a523b8ce13 -r f07ff0efa29f mk/bulk/pre-build
--- a/mk/bulk/pre-build Tue Feb 07 21:33:37 2006 +0000
+++ b/mk/bulk/pre-build Tue Feb 07 21:34:48 2006 +0000
@@ -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 @@
 
 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



Home | Main Index | Thread Index | Old Index