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
This commit is contained in:
apb 2007-03-25 07:56:38 +00:00
parent faafdc7e21
commit cabe8d739b
1 changed files with 26 additions and 2 deletions

View File

@ -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 <<EOF ${makewrapout}
#! ${HOST_SH}
# Set proper variables to allow easy "make" building of a NetBSD subtree.
# Generated from: \$NetBSD: build.sh,v 1.162 2007/02/19 14:20:11 briggs Exp $
# Generated from: \$NetBSD: build.sh,v 1.163 2007/03/25 07:56:38 apb Exp $
# with these arguments: ${_args}
#
EOF
@ -1142,6 +1164,8 @@ main()
_args=$@
parseoptions "$@"
sanitycheck
build_start=$(date)
statusmsg "${progname} command: $0 $@"
statusmsg "${progname} started: ${build_start}"