diff options
author | Jim Meyering <meyering@redhat.com> | 2012-01-07 20:55:10 +0100 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-01-09 21:50:08 +0100 |
commit | ae2b0d2ddca458eb282bb0458987e75e1875a659 (patch) | |
tree | de928bfafb577a20963be45b4b6d97488c0b5e24 /tests/rm/fail-eperm | |
parent | dd0e4c5621ca2fa9255aef4eee0e7cf41cd335d2 (diff) | |
download | coreutils-ae2b0d2ddca458eb282bb0458987e75e1875a659.tar.xz |
tests: more automated quote adjustment
Relax initial regexp to match more instances, but add a
filter to avoid some invalid conversions. Run this:
git grep -l "\`[^']*'" tests | xargs perl -pi -e '$q=q"'\''";' \
-e '$q="$q\\$q$q"; /(= ?\`|\`expr|\`echo|\Q$q\E)/ and next;' \
-e ' s/\`([^'\''"]*?'\'')/'\''$1/g'
The last disjunct in the above (...) filter is to exempt
any line that contains this string: '\''
With quoting like that, converting a ` to ' is likely to cause trouble,
so we'll handle those manually. Here are three examples where
the exemption is required:
*': `link-to-dir/'\'': hard link not allowed for directory'*) ;;
printf 'creating file `%s'\''\n' $f
'mv: inter-device move failed: `%s'\'' to `%s'\'';'\
Diffstat (limited to 'tests/rm/fail-eperm')
-rwxr-xr-x | tests/rm/fail-eperm | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/tests/rm/fail-eperm b/tests/rm/fail-eperm index 0b3e6dc3e..b51cdc77c 100755 --- a/tests/rm/fail-eperm +++ b/tests/rm/fail-eperm @@ -85,7 +85,7 @@ foreach my $dir (@dir_list) # expected exit code and diagnostic. my $cmd = "$rm -f -- $target_file"; open RM, "$cmd 2>&1 |" - or die "$ME: cannot execute `$cmd'\n"; + or die "$ME: cannot execute '$cmd'\n"; my $line = <RM>; @@ -99,27 +99,27 @@ foreach my $dir (@dir_list) if ($rc == 0) { next if ! -e $target_file; - die "$ME: unexpected exit status from `$cmd';\n" + die "$ME: unexpected exit status from '$cmd';\n" . " got 0, expected 1\n"; } if (0x80 < $rc) { my $status = $rc >> 8; $status == 1 - or die "$ME: unexpected exit status from `$cmd';\n" + or die "$ME: unexpected exit status from '$cmd';\n" . " got $status, expected 1\n"; } else { # Terminated by a signal. my $sig_num = $rc & 0x7F; - die "$ME: command `$cmd' died with signal $sig_num\n"; + die "$ME: command '$cmd' died with signal $sig_num\n"; } - my $exp = "rm: cannot remove `$target_file':"; + my $exp = "rm: cannot remove '$target_file':"; $line - or die "$ME: no output from `$cmd';\n" - . "expected something like `$exp ...'\n"; + or die "$ME: no output from '$cmd';\n" + . "expected something like '$exp ...'\n"; # Transform the actual diagnostic so that it starts with "rm:". # Depending on your system, it might be "rm:" already, or @@ -128,7 +128,7 @@ foreach my $dir (@dir_list) my $regex = quotemeta $exp; $line =~ /^$regex/ - or die "$ME: unexpected diagnostic from `$cmd';\n" + or die "$ME: unexpected diagnostic from '$cmd';\n" . " got $line" . " expected $exp ...\n"; |