1
0
mirror of git://git.sv.gnu.org/coreutils.git synced 2026-02-14 19:32:10 +02:00

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.
This commit is contained in:
Pádraig Brady
2014-03-05 18:41:16 +00:00
parent 5dce6bdfaf
commit 056d6de78f
17 changed files with 33 additions and 26 deletions

View File

@@ -71,7 +71,7 @@ DEBUGGING=
test "$DEBUGGING" && test "$VERBOSE" && set +x
for ELIDE_EMPTY in '' '-e'; do
for IO_BLKSIZE in 1 2 5 10 80 100; do
: > out
> out
test "$DEBUGGING" && printf "\n---io-blk-size=$IO_BLKSIZE $ELIDE_EMPTY\n"
for N in 6 8 12 15 22; do
rm -f x*
@@ -119,15 +119,15 @@ test "$DEBUGGING" && test "$VERBOSE" && set -x
# Check extraction of particular chunks
: > out
> out
printf '1\n12345\n' > exp
split -n l/13/15 in > out
compare exp out || fail=1
: > out
> out
printf '' > exp
split -n l/14/15 in > out
compare exp out || fail=1
: > out
> out
printf '1\n12345\n1\n' > exp
split -n l/15/15 in > out
compare exp out || fail=1

View File

@@ -63,8 +63,8 @@ cat <<\EOF > no_eol_splits_exp
EOF
for b in $(seq 10); do
: > splits
: > no_eol_splits
> splits
> no_eol_splits
for s in $(seq 11); do
rm x??
split ---io=$b -C$s in || fail=1