m4sh: fix some namespace safety issues

* lib/m4sugar/m4sh.m4 (_AS_SHELL_SANITIZE): Avoid problems if
as_myself is inherited from environment.
(AS_TMPDIR): Be namespace clean.

Signed-off-by: Eric Blake <eblake@redhat.com>
This commit is contained in:
Eric Blake 2010-08-25 16:21:39 -06:00
parent 9b7d0212e7
commit e0ac12089e
2 changed files with 13 additions and 4 deletions

View File

@ -1,3 +1,10 @@
2010-08-25 Eric Blake <eblake@redhat.com>
m4sh: fix some namespace safety issues
* lib/m4sugar/m4sh.m4 (_AS_SHELL_SANITIZE): Avoid problems if
as_myself is inherited from environment.
(AS_TMPDIR): Be namespace clean.
2010-08-24 Ralf Wildenhues <Ralf.Wildenhues@gmx.de>
tests: fix AC_CACHE_CHECK to skip with bad shells.

View File

@ -425,6 +425,7 @@ _AS_PATH_SEPARATOR_PREPARE
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
as_myself=
case $[0] in @%:@((
*[[\\/]]* ) as_myself=$[0] ;;
*) _AS_PATH_WALK([],
@ -1618,12 +1619,13 @@ m4_define([AS_TMPDIR],
[# Create a (secure) tmp directory for tmp files.
m4_if([$2], [], [: ${TMPDIR=/tmp}])
{
tmp=`(umask 077 && mktemp -d "m4_default([$2], [$TMPDIR])/$1XXXXXX") 2>/dev/null` &&
test -n "$tmp" && test -d "$tmp"
as_tmp=`(umask 077 && mktemp -d "m4_default([$2],
[$TMPDIR])/$1XXXXXX") 2>/dev/null` &&
test -d "$as_tmp"
} ||
{
tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM
(umask 077 && mkdir "$tmp")
as_tmp=m4_default([$2], [$TMPDIR])/$1$$-$RANDOM
(umask 077 && mkdir "$as_tmp")
} || AS_ERROR([cannot create a temporary directory in m4_default([$2],
[$TMPDIR])])])# AS_TMPDIR