1
0
mirror of https://git.FreeBSD.org/src.git synced 2024-10-18 02:19:39 +00:00

sh: Test that bogus values of PWD are not imported from the environment.

Current versions pass this test trivially by never importing PWD, but I plan
to change sh to import PWD if it is an absolute pathname for the current
directory, possibly containing symlinks.
This commit is contained in:
Jilles Tjoelker 2010-04-11 20:21:34 +00:00
parent b7e9bee71c
commit e74e09f851
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=206491

View File

@ -0,0 +1,11 @@
# $FreeBSD$
# Check that bogus PWD values are not accepted from the environment.
cd / || exit 3
failures=0
[ "$(PWD=foo sh -c 'pwd')" = / ] || : $((failures += 1))
[ "$(PWD=/var/empty sh -c 'pwd')" = / ] || : $((failures += 1))
[ "$(PWD=/var/empty/foo sh -c 'pwd')" = / ] || : $((failures += 1))
[ "$(PWD=/bin/ls sh -c 'pwd')" = / ] || : $((failures += 1))
exit $((failures != 0))