From cabe8d739b006fe084f403c32277acf5c5495f86 Mon Sep 17 00:00:00 2001 From: apb Date: Sun, 25 Mar 2007 07:56:38 +0000 Subject: [PATCH] If the PATH contains any components that are not absolute directory names, print a message and abort. In expert mode, downgrade this error to a warning. Fixes PR 36048 --- build.sh | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/build.sh b/build.sh index 4fe5bfae00b1..0934db7460b4 100755 --- a/build.sh +++ b/build.sh @@ -1,5 +1,5 @@ #! /usr/bin/env sh -# $NetBSD: build.sh,v 1.162 2007/02/19 14:20:11 briggs Exp $ +# $NetBSD: build.sh,v 1.163 2007/03/25 07:56:38 apb Exp $ # # Copyright (c) 2001-2005 The NetBSD Foundation, Inc. # All rights reserved. @@ -69,6 +69,11 @@ statusmsg() ${runcmd} echo "===> $@" | tee -a "${results}" } +warning() +{ + statusmsg "Warning: $@" +} + # Find a program in the PATH find_in_PATH() { @@ -793,6 +798,23 @@ parseoptions() export MAKEFLAGS MACHINE MACHINE_ARCH } +sanitycheck() +{ + # If the PATH contains any non-absolute components (including, + # but not limited to, "." or ""), then complain. This is fatal + # if expert mode is not in effect. + # + case ":${PATH}:/" in + *:[!/]*) + if ${do_expertmode}; then + warning "PATH contains non-absolute components" + else + bomb "PATH must not contain non-absolute components" + fi + ;; + esac +} + rebuildmake() { # Test make source file timestamps against installed ${toolprefix}make @@ -994,7 +1016,7 @@ createmakewrapper() eval cat <