summaryrefslogtreecommitdiff
path: root/tests/du
diff options
context:
space:
mode:
authorPádraig Brady <P@draigBrady.com>2015-11-01 18:53:26 +0000
committerPádraig Brady <P@draigBrady.com>2015-11-04 23:30:14 +0000
commit08e8fd7e38f2dae7c69c54eb22d508b6517e66e5 (patch)
tree63d021e305cd93bea445f9484fe8b3446dda2c3d /tests/du
parent1e8f9afac53a628dbc64e62bea53eb2da29c47fa (diff)
downloadcoreutils-08e8fd7e38f2dae7c69c54eb22d508b6517e66e5.tar.xz
all: avoid quoting file names when possible
Quote file names using the "shell-escape" or "shell-escape-always" methods, which quote as appropriate for most shells, and better support copy and paste of presented names. The "always" variant is used when the file name is embedded in an error message with surrounding spaces. * cfg.mk (sc_error_shell_quotes): A new syntax check rule to suggest quotef() where appropriate. (sc_error_shell_always_quotes): Likewise for quoteaf(). * src/system.h (quotef): A new define to apply shell quoting when needed. I.E. when shell character or ':' is present. (quoteaf): Likewise, but always quote. * src/*.c: Use quotef() and quoteaf() rather than quote() where appropriate. * tests/: Adjust accordingly.
Diffstat (limited to 'tests/du')
-rwxr-xr-xtests/du/files0-from-dir.sh4
-rwxr-xr-xtests/du/files0-from.pl8
-rwxr-xr-xtests/du/move-dir-while-traversing.sh2
3 files changed, 7 insertions, 7 deletions
diff --git a/tests/du/files0-from-dir.sh b/tests/du/files0-from-dir.sh
index 4d7e90cf5..67b9f6231 100755
--- a/tests/du/files0-from-dir.sh
+++ b/tests/du/files0-from-dir.sh
@@ -29,10 +29,10 @@ cat dir > /dev/null && skip_ "cat dir/ succeeds"
for prog in du wc; do
$prog --files0-from=dir > /dev/null 2>err && fail=1
- printf "$prog: 'dir':\n" > exp || fail=1
+ printf "$prog: dir:\n" > exp || fail=1
# The diagnostic string is usually "Is a directory" (ENOTDIR),
# but accept a different string or errno value.
- sed "s/'dir':.*/'dir':/" err > k; mv k err
+ sed "s/dir:.*/dir:/" err > k; mv k err
compare exp err || fail=1
done
diff --git a/tests/du/files0-from.pl b/tests/du/files0-from.pl
index f0177a2d0..3854059f0 100755
--- a/tests/du/files0-from.pl
+++ b/tests/du/files0-from.pl
@@ -53,12 +53,12 @@ my @Tests =
# one NUL
['nul-1', '--files0-from=-', '<', {IN=>"\0"}, {EXIT=>1},
- {ERR => "$prog: '-':1: invalid zero-length file name\n"}],
+ {ERR => "$prog: -:1: invalid zero-length file name\n"}],
# two NULs
['nul-2', '--files0-from=-', '<', {IN=>"\0\0"}, {EXIT=>1},
- {ERR => "$prog: '-':1: invalid zero-length file name\n"
- . "$prog: '-':2: invalid zero-length file name\n"}],
+ {ERR => "$prog: -:1: invalid zero-length file name\n"
+ . "$prog: -:2: invalid zero-length file name\n"}],
# one file name, no NUL
['1', '--files0-from=-', '<',
@@ -84,7 +84,7 @@ my @Tests =
['zero-len', '--files0-from=-', '<',
{IN=>{f=>"\0g\0"}}, {AUX=>{g=>''}},
{OUT=>"0\tg\n"}, {OUT_SUBST=>'s/^\d+/0/'},
- {ERR => "$prog: '-':1: invalid zero-length file name\n"}, {EXIT=>1} ],
+ {ERR => "$prog: -:1: invalid zero-length file name\n"}, {EXIT=>1} ],
);
my $save_temps = $ENV{DEBUG};
diff --git a/tests/du/move-dir-while-traversing.sh b/tests/du/move-dir-while-traversing.sh
index 33db58e44..67bb34580 100755
--- a/tests/du/move-dir-while-traversing.sh
+++ b/tests/du/move-dir-while-traversing.sh
@@ -92,7 +92,7 @@ du -a $t d2 2> err
test $? = 1 || fail=1
# check for the new diagnostic
-printf "du: fts_read failed: '$t/3/a/b': No such file or directory\n" > exp \
+printf "du: fts_read failed: $t/3/a/b: No such file or directory\n" > exp \
|| fail=1
compare exp err || fail=1