From ab40a941a07d80326aaa051e3c94c88b800cbd7d Mon Sep 17 00:00:00 2001 From: Pádraig Brady
Date: Wed, 28 Oct 2015 13:02:31 +0000 Subject: all: replace most uses of quotearg_colon() with quote() Related to commit v8.24-61-g6796698 this provides more consistent quoting, as quotearg_colon() defaults to "literal" quoting by default, while quote() provides appropriate quoting for diagnostics by default. * gl/modules/randread: Depend on quote module rather than quotearg. * gl/lib/randread.c: Used quote() not quotearg_colon(). * src/: Likewise. * src/shred.c: Likewise. Also avoid unnecessary quoting introducing overhead when wiping names. * cfg.mk: Relax the matching expression to allow "qname" variables as used in shred.c to satisfy the check. * tests/: Adjust accordingly. --- tests/du/files0-from-dir.sh | 4 ++-- tests/du/files0-from.pl | 8 ++++---- tests/du/move-dir-while-traversing.sh | 2 +- tests/misc/shred-passes.sh | 6 +++--- tests/misc/sort-files0-from.pl | 6 +++--- tests/misc/stat-printf.pl | 4 ++-- tests/misc/wc-files0-from.pl | 8 ++++---- 7 files changed, 19 insertions(+), 19 deletions(-) (limited to 'tests') diff --git a/tests/du/files0-from-dir.sh b/tests/du/files0-from-dir.sh index 2f55c4ed6..4d7e90cf5 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 3854059f0..f0177a2d0 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 67bb34580..33db58e44 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 diff --git a/tests/misc/shred-passes.sh b/tests/misc/shred-passes.sh index c19cc7655..ddf788b05 100755 --- a/tests/misc/shred-passes.sh +++ b/tests/misc/shred-passes.sh @@ -28,7 +28,7 @@ shred: 'f': pass 1/3 (random)... shred: 'f': pass 2/3 (random)... shred: 'f': pass 3/3 (random)... shred: 'f': removing -shred: 'f': renamed to '0' +shred: 'f': renamed to 0 shred: 'f': removed" > exp || framework_failure_ shred -v -u f 2>out || fail=1 @@ -40,7 +40,7 @@ compare exp out || fail=1 touch f || framework_failure_ echo "\ shred: 'f': removing -shred: 'f': renamed to '0' +shred: 'f': renamed to 0 shred: 'f': removed" > exp || framework_failure_ shred -v -u f 2>out || fail=1 @@ -73,7 +73,7 @@ shred: 'f': pass 18/20 (eeeeee)... shred: 'f': pass 19/20 (333333)... shred: 'f': pass 20/20 (random)... shred: 'f': removing -shred: 'f': renamed to '0' +shred: 'f': renamed to 0 shred: 'f': removed" > exp || framework_failure_ shred -v -u -n20 --random-source=Us f 2>out || fail=1 diff --git a/tests/misc/sort-files0-from.pl b/tests/misc/sort-files0-from.pl index 63c5bb3e4..6773309d1 100755 --- a/tests/misc/sort-files0-from.pl +++ b/tests/misc/sort-files0-from.pl @@ -55,14 +55,14 @@ my @Tests = # one NUL ['nul-1', '--files0-from=-', '<', {IN=>"\0"}, {EXIT=>2}, - {ERR => "$prog: -:1: invalid zero-length file name\n"}], + {ERR => "$prog: '-':1: invalid zero-length file name\n"}], # two NULs # Note that the behavior here differs from 'wc' in that the # first zero-length file name is treated as fatal, so there # is only one line of diagnostic output. ['nul-2', '--files0-from=-', '<', {IN=>"\0\0"}, {EXIT=>2}, - {ERR => "$prog: -:1: invalid zero-length file name\n"}], + {ERR => "$prog: '-':1: invalid zero-length file name\n"}], # one file name, no NUL ['1', '--files0-from=-', '<', @@ -86,7 +86,7 @@ my @Tests = # should be no output on STDOUT. ['zero-len', '--files0-from=-', '<', {IN=>{f=>"\0g\0"}}, {AUX=>{g=>''}}, - {ERR => "$prog: -:1: invalid zero-length file name\n"}, {EXIT=>2} ], + {ERR => "$prog: '-':1: invalid zero-length file name\n"}, {EXIT=>2} ], ); my $save_temps = $ENV{DEBUG}; diff --git a/tests/misc/stat-printf.pl b/tests/misc/stat-printf.pl index 967eef7d2..cb148b615 100755 --- a/tests/misc/stat-printf.pl +++ b/tests/misc/stat-printf.pl @@ -52,9 +52,9 @@ my @Tests = {ERR=>"$prog: warning: backslash at end of format\n"}], ['err-1', "--printf=%9% .", {EXIT => 1}, - {ERR=>"$prog: %9%: invalid directive\n"}], + {ERR=>"$prog: '%9%': invalid directive\n"}], ['err-2', "--printf=%9 .", {EXIT => 1}, - {ERR=>"$prog: %9: invalid directive\n"}], + {ERR=>"$prog: '%9': invalid directive\n"}], ); my $save_temps = $ENV{DEBUG}; diff --git a/tests/misc/wc-files0-from.pl b/tests/misc/wc-files0-from.pl index cae3fc225..519587be6 100755 --- a/tests/misc/wc-files0-from.pl +++ b/tests/misc/wc-files0-from.pl @@ -53,13 +53,13 @@ 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}, {OUT=>"0 0 0 total\n"}, - {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=-', '<', @@ -83,7 +83,7 @@ my @Tests = ['zero-len', '--files0-from=-', '<', {IN=>{f=>"\0g\0"}}, {AUX=>{g=>''}}, {OUT=>"0 0 0 g\n0 0 0 total\n"}, - {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}; -- cgit v1.2.3-70-g09d2