in_vc_files='^tests/' \
$(_sc_search_regexp)
+# Ensure that env vars are not passed through returns_ as
+# that was seen to fail on FreeBSD /bin/sh at least
+sc_prohibit_env_returns:
+ @prohibit='=[^ ]* returns_ ' \
+ halt='Passing env vars to returns_ is non portable' \
+ in_vc_files='^tests/' \
+ $(_sc_search_regexp)
+
# The mode part of a setfacl -m option argument must be three bytes long.
# I.e., an argument of user:bin:rw or user:bin:r will make Solaris 10's
# setfacl reject it with: "Unrecognized character found in mode field".
# Split the input, and force fwrite() failure -
# the 'csplit' command should fail with exit code 1
# (checked with 'returns_ 1 ... || fail=1')
-seq 10 \
- | LD_PRELOAD=$LD_PRELOAD:./k.so returns_ 1 csplit - 1 4 2>out \
- || fail=1
+seq 10 |
+(export LD_PRELOAD=$LD_PRELOAD:./k.so
+ returns_ 1 csplit - 1 4 2>out) || fail=1
test -e preloaded || skip_ 'LD_PRELOAD interception failed'
# Make sure it fails with exit status of 125 when given too few arguments,
# except that POSIX requires 127 in this case.
returns_ 125 nohup >/dev/null 2>&1 || fail=1
-POSIXLY_CORRECT=1 returns_ 127 nohup >/dev/null 2>&1 || fail=1
+export POSIXLY_CORRECT=1
+returns_ 127 nohup >/dev/null 2>&1 || fail=1
+unset POSIXLY_CORRECT
Exit $fail
compare exp out || fail=1
# Exit status reflects missing variable, but remaining arguments processed.
-ENV_TEST1=a returns_ 1 env -- printenv ENV_TEST2 ENV_TEST1 > out || fail=1
-ENV_TEST1=a returns_ 1 env -- printenv ENV_TEST1 ENV_TEST2 >> out || fail=1
+export ENV_TEST1=a
+returns_ 1 env -- printenv ENV_TEST2 ENV_TEST1 > out || fail=1
+returns_ 1 env -- printenv ENV_TEST1 ENV_TEST2 >> out || fail=1
+unset ENV_TEST1
cat <<EOF > exp || framework_failure_
a
a
export READDIR_PARTIAL
for READDIR_PARTIAL in '' '1'; do
rm -f preloaded
- (LD_PRELOAD=$LD_PRELOAD:./k.so returns_ 1 rm -Rf dir 2>>err) || fail=1
+ (export LD_PRELOAD=$LD_PRELOAD:./k.so
+ returns_ 1 rm -Rf dir 2>>err) || fail=1
test -f preloaded ||
skip_ "internal test failure: maybe LD_PRELOAD doesn't work?"
done