]> git.ipfire.org Git - thirdparty/coreutils.git/commitdiff
maint: clean up some test issues identified with shellcheck
authorPádraig Brady <P@draigBrady.com>
Sat, 10 Jan 2015 21:12:38 +0000 (21:12 +0000)
committerPádraig Brady <P@draigBrady.com>
Sat, 10 Jan 2015 21:18:33 +0000 (21:18 +0000)
* tests/cp/cp-a-selinux.sh: Comment why unused variables are assigned.
Fix misspellings noticed while adjusting.
* tests/cp/fiemap-perf.sh: Fix quoting.
* tests/misc/shuf.sh: Avoid useless use of cat.
* tests/misc/printf-surprise.sh: Likewise.

tests/cp/cp-a-selinux.sh
tests/cp/fiemap-perf.sh
tests/misc/printf-surprise.sh
tests/misc/shuf.sh

index 1426582e008724a194f79bbb4d4495026726085d..2ecbd238685156ca34dbbfc199f433ec47086ea2 100755 (executable)
@@ -64,7 +64,7 @@ get_selinux_type() { ls -Zd "$1" | sed -n 's/.*:\(.*_t\):.*/\1/p'; }
 # Also make a dir with our known context
 mkdir c_d || framework_failure_
 chcon $ctx c_d || framework_failure_
-# Get the type of this known context for file and dir
+# Get the type of this known context for file and dir for tracing
 old_type_f=$(get_selinux_type c)
 old_type_d=$(get_selinux_type c_d)
 # Setup copies for manipulation with restorecon
@@ -80,7 +80,7 @@ if restorecon Z1 Z1_d 2>/dev/null; then
   cpZ_type_f=$(get_selinux_type Z2)
   test "$cpZ_type_f" = "$new_type_f" || fail=1
 
-  # Ensuze -Z overrides -a and that dirs are handled too
+  # Ensure -Z overrides -a and that dirs are handled too
   cp -aZ c Z3 || fail=1
   cp -aZ c_d Z3_d || fail=1
   cpaZ_type_f=$(get_selinux_type Z3)
@@ -197,7 +197,7 @@ for no_g_cmd in '' 'rm -f g'; do
   cp -a --context="$ctx" ../f g || fail=1
 done
 
-# Mutually exlusive options
+# Mutually exclusive options
 cp -Z --preserve=context ../f g && fail=1
 cp --preserve=context -Z ../f g && fail=1
 cp --preserve=context --context="$ctx" ../f g && fail=1
index 0f18b45b0ebf04f12b0d3602a5ade0175ba0c837..5517ad0cc4cc0fb1666212da3478118e3fc62060 100755 (executable)
@@ -35,7 +35,7 @@ timeout 10 truncate -s1T f ||
 
 # Disable this test on old BTRFS (e.g. Fedora 14)
 # which reports (unwritten) extents for holes.
-filefrag f || skip_ 'the 'filefrag' utility is missing'
+filefrag f || skip_ "the 'filefrag' utility is missing"
 filefrag f | grep -F ': 0 extents found' > /dev/null ||
   skip_ 'this file system reports extents for holes'
 
index d8d967d85a5e7569352d9959e9d52e41982e3165..0af64482dbb6777c7da3bc971e730472d6821fed 100755 (executable)
@@ -63,7 +63,7 @@ exit=$?
 # Map this longer, and rarer, diagnostic to the common one.
 # printf: cannot perform formatted output: Cannot allocate memory" \
 sed 's/cannot perform .*/write error/' err-msg > k && mv k err-msg
-err_msg=$(cat err-msg|tr '\n' :)
+err_msg=$(tr '\n' : < err-msg)
 
 # By some bug, on Solaris 11 (5.11 snv_86), err_msg ends up
 # containing '1> fifo:printf: write error:'.  Recognize that, too.
index 34f422507d8a77ea77d96c75ba20ba8f792b230d..c7db14f604e061169777ee8e578f68976e696f1f 100755 (executable)
@@ -125,7 +125,7 @@ test "$c" = "0 1 2 3 4 5 6 7 8 9" ||
 
 # check --repeat with non-zero low value
 shuf --rep -i222-233 -n2000 > exp || framework_failure_
-c=$(cat exp | sort -nu | paste -s -d ' ') || framework_failure_
+c=$(sort -nu exp | paste -s -d ' ') || framework_failure_
 test "$c" = "222 223 224 225 226 227 228 229 230 231 232 233" ||
  { fail=1; echo "--repeat produced bad output with non-zero low">&2 ; }