From 056d6de78fcf11a0f404f25faf8cecc9f9ee9c1c Mon Sep 17 00:00:00 2001 From: Pádraig Brady Date: Wed, 5 Mar 2014 18:41:16 +0000 Subject: tests: avoid the :> construct which can hide errors On most shells `:>file || framework_failure_` will not evaluate the framework_failure_ even if there was an error writing the file. shells which do evaluate the failure are ksh 93u+ and bash 4.2, while shells wich don't include bash 4.3, solaris, freebsd, dash. Furthermore this construct is problematic on Solaris 10 sh, which will try to optimize away a `:' command in a loop after the first iteration, even if it is redirected. * tests/cp/link-deref.sh: Remove the leading colon on redirections. * tests/cp/reflink-perm.sh: Likewise. * tests/id/zero.sh: Likewise. * tests/install/install-C.sh: Likewise. * tests/misc/env.sh: Likewise. * tests/misc/md5sum-bsd.sh: Likewise. * tests/misc/runcon-no-reorder.sh: Likewise. * tests/mv/partition-perm.sh: Likewise. * tests/rm/r-root.sh: Likewise. * tests/split/l-chunk.sh: Likewise. * tests/split/line-bytes.sh: Likewise. * tests/tail-2/inotify-rotate.sh: Likewise. * tests/tail-2/retry.sh: Likewise. * tests/tail-2/symlink.sh: Likewise. * tests/tail-2/wait.sh: Likewise. * tests/touch/read-only.sh: Likewise. + cfg.mk (sc_prohibit_colon_redirection): A new syntax check to avoid further instances of this creeping in. --- tests/cp/link-deref.sh | 2 +- tests/cp/reflink-perm.sh | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'tests/cp') diff --git a/tests/cp/link-deref.sh b/tests/cp/link-deref.sh index 73c86a889..1b6665898 100755 --- a/tests/cp/link-deref.sh +++ b/tests/cp/link-deref.sh @@ -31,7 +31,7 @@ if grep '^#define HAVE_LINKAT 1' "$CONFIG_HEADER" > /dev/null \ fi mkdir dir || framework_failure_ -: > file || framework_failure_ +> file || framework_failure_ ln -s dir dirlink || framework_failure_ ln -s file filelink || framework_failure_ ln -s nowhere danglink || framework_failure_ diff --git a/tests/cp/reflink-perm.sh b/tests/cp/reflink-perm.sh index 06500657b..52f83fce1 100755 --- a/tests/cp/reflink-perm.sh +++ b/tests/cp/reflink-perm.sh @@ -20,8 +20,8 @@ print_ver_ cp -: > time_check -: > file +> time_check +> file ts='2009-08-28 19:00' touch -d "$ts" file || framework_failure_ test time_check -nt file || skip_ "The system clock is wrong" -- cgit v1.2.3-54-g00ecf