From 055b08ff7853c7c9ab791643047b1b163a227013 Mon Sep 17 00:00:00 2001 From: Pádraig Brady
Date: Tue, 22 Nov 2016 01:23:22 +0000 Subject: tests: fix false fails due to passing env vars to returns_ On BSD /bin/sh it was seen that unexported env vars passed to returns_() would not be propagated to the wrapped command. * cfg.mk (sc_prohibit_env_returns): Add a syntax check to disallow. * tests/misc/csplit-io-err.sh: Rearrange to export vars in a subshell. * tests/rm/rm-readdir-fail.sh: Likewise. * tests/misc/nohup.sh: Export and unset vars around returns_. * tests/misc/printenv.sh: Likewise. Reported by Assaf Gordon --- cfg.mk | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'cfg.mk') diff --git a/cfg.mk b/cfg.mk index 5d42bf14e..9e4f8a31a 100644 --- a/cfg.mk +++ b/cfg.mk @@ -510,6 +510,14 @@ sc_prohibit_and_fail_1: 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". -- cgit v1.2.3-70-g09d2