Skip to content

Commit

Permalink
mktemp -d compatibility with old BSD systems
Browse files Browse the repository at this point in the history
Resolves #939
  • Loading branch information
krader1961 committed Oct 8, 2018
1 parent 0c6d68a commit c910e3b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/cmd/ksh93/tests/util/run_test.sh
Expand Up @@ -70,10 +70,10 @@ export BUILD_DIR=$PWD
# our purposes that doesn't matter. It simply means the temp file name will contain the X's on a BSD
# system.
#
export TEST_DIR=$(mktemp -dt ksh.${test_name}.XXXXXXX) ||
export TEST_DIR=$(mktemp -dt ksh.${test_name}.XXXXXX) ||
{ log_error "mktemp -dt failed"; exit 99; }
cd $TEST_DIR || { print -u2 "<E> 'cd $TEST_DIR' failed with status $?"; exit 99; }
log_info "TEST_DIR=$TEST_DIR"
cd $TEST_DIR || { print -u2 "<E> 'cd $TEST_DIR' failed with status $?"; exit 99; }
log_info "TEST_DIR=$TEST_DIR"

#
# Make sure we search for external commands in the temporary test dir, then the test source dir,
Expand Down
5 changes: 4 additions & 1 deletion src/lib/libast/comp/conf.sh
Expand Up @@ -42,7 +42,10 @@ cc=$*

PATH="$MESON_SOURCE_ROOT/scripts:$PATH"

tmpdir=`mktemp -d`
# The use of `mktemp -dt` isn't ideal as it has slightly different meaning on BSD and GNU. But for
# our purposes that doesn't matter. It simply means the temp file name will contain the X's on a BSD
# system. See https://github.com/att/ast/issues/939
tmpdir=$(mktemp -dt ksh.XXXXXX)
tmp=$tmpdir/conf
cd $tmpdir || exit
trap "rm -rf $tmpdir" EXIT
Expand Down

0 comments on commit c910e3b

Please sign in to comment.