diff options
author | Pádraig Brady <P@draigBrady.com> | 2014-03-05 18:41:16 +0000 |
---|---|---|
committer | Pádraig Brady <P@draigBrady.com> | 2014-03-05 19:02:20 +0000 |
commit | 056d6de78fcf11a0f404f25faf8cecc9f9ee9c1c (patch) | |
tree | cd5235d3fd1e8b0142c543541675dd66f26c3d91 /tests/misc | |
parent | 5dce6bdfafc930dfd17d5d16aea7d1add3472066 (diff) | |
download | coreutils-056d6de78fcf11a0f404f25faf8cecc9f9ee9c1c.tar.xz |
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.
Diffstat (limited to 'tests/misc')
-rwxr-xr-x | tests/misc/env.sh | 2 | ||||
-rwxr-xr-x | tests/misc/md5sum-bsd.sh | 2 | ||||
-rwxr-xr-x | tests/misc/runcon-no-reorder.sh | 2 |
3 files changed, 3 insertions, 3 deletions
diff --git a/tests/misc/env.sh b/tests/misc/env.sh index 0987f7fea..877a5e35e 100755 --- a/tests/misc/env.sh +++ b/tests/misc/env.sh @@ -62,7 +62,7 @@ fi ENV_TEST1=a export ENV_TEST1 -: >out || framework_failure_ +>out || framework_failure_ env ENV_TEST2= > all || fail=1 grep '^ENV_TEST' all | LC_ALL=C sort >> out || framework_failure_ env -u ENV_TEST1 ENV_TEST3=c > all || fail=1 diff --git a/tests/misc/md5sum-bsd.sh b/tests/misc/md5sum-bsd.sh index 77f0a59cb..f73e06225 100755 --- a/tests/misc/md5sum-bsd.sh +++ b/tests/misc/md5sum-bsd.sh @@ -70,7 +70,7 @@ nl=' tab=' ' rm check.md5 for i in 'a\b' 'a\' "a${nl}b" "a${tab}b"; do - :> "$i" + > "$i" md5sum --tag "$i" >> check.md5 done md5sum --strict -c check.md5 || fail=1 diff --git a/tests/misc/runcon-no-reorder.sh b/tests/misc/runcon-no-reorder.sh index 7338ad5fb..ca8ad5b35 100755 --- a/tests/misc/runcon-no-reorder.sh +++ b/tests/misc/runcon-no-reorder.sh @@ -27,7 +27,7 @@ echo "$diag" > exp || framework_failure_ # On such a system it fails with the above diagnostic, which is fine. # Before the no-reorder change, it would have failed with a diagnostic # about -j being an invalid option. -runcon $(id -Z) true -j 2> out && : > exp +runcon $(id -Z) true -j 2> out && > exp # When run on a system with no /selinux/context (i.e., in a chroot), # it chcon fails with this: "runcon: invalid context: \ |