summaryrefslogtreecommitdiff
path: root/tests/rm/empty-name
diff options
context:
space:
mode:
authorJim Meyering <meyering@redhat.com>2009-12-01 12:02:11 +0100
committerJim Meyering <meyering@redhat.com>2009-12-01 14:38:39 +0100
commit0dc1f4c6f377f5613ecbf8747014babc9814ebda (patch)
treef65bf1baabc7bf0c7dfaf904d7332b14a6af0089 /tests/rm/empty-name
parentcb775df09e79fc8cb5608bbc4a2ca8b621a4f771 (diff)
downloadcoreutils-0dc1f4c6f377f5613ecbf8747014babc9814ebda.tar.xz
rm: fix empty-name bug introduced with conversion to use fts
While "rm ''" would properly fail, "rm F1 '' F2" would fail to remove F1 and F2, due to the empty string argument. This bug was introduced on 2009-07-12, via commit 4f73ecaf, "rm: rewrite to use fts". * gnulib: Update to latest, for fixed fts.c. * NEWS (Bug fixes): Describe it. * tests/rm/empty-name: Adjust for changed diagnostic. (mk_file): Define, copied from misc/ls-misc. (empty-name-2): New test, for today's fix. * lib/xfts.c (xfts_open): Reflect the change in fts_open, now that it no longer fails immediately when one argument is the empty string. Assert that the bit flags were not the cause of failure. * po/POTFILES.in: Remove xfts.c. * THANKS: Update. Reported by Ladislav Hagara.
Diffstat (limited to 'tests/rm/empty-name')
-rwxr-xr-xtests/rm/empty-name18
1 files changed, 17 insertions, 1 deletions
diff --git a/tests/rm/empty-name b/tests/rm/empty-name
index 08cc8e339..27f76d0ae 100755
--- a/tests/rm/empty-name
+++ b/tests/rm/empty-name
@@ -29,12 +29,28 @@ use strict;
my $prog = 'rm';
+# FIXME: copied from misc/ls-misc; factor into Coreutils.pm?
+sub mk_file(@)
+{
+ foreach my $f (@_)
+ {
+ open (F, '>', $f) && close F
+ or die "creating $f: $!\n";
+ }
+}
+
my @Tests =
(
# test-name options input expected-output
#
['empty-name-1', "''", {EXIT => 1},
- {ERR => "$prog: invalid argument: `'\n"}],
+ {ERR => "$prog: cannot remove `': No such file or directory\n"}],
+
+ ['empty-name-2', "a '' b", {EXIT => 1},
+ {ERR => "$prog: cannot remove `': No such file or directory\n"},
+ {PRE => sub { mk_file qw(a b) }},
+ {POST => sub {-f 'a' || -f 'b' and die "a or b remain\n" }},
+ ],
);
my $save_temps = $ENV{SAVE_TEMPS};