diff options
author | Jim Meyering <meyering@redhat.com> | 2012-09-04 14:40:11 +0200 |
---|---|---|
committer | Jim Meyering <meyering@redhat.com> | 2012-09-05 12:10:38 +0200 |
commit | 57dd06703cb89ba53d05af95c11e89a2ca51af5c (patch) | |
tree | ecc69c1fe877140a51d52c0d58fb018071faf107 | |
parent | d5719921a8968f5dc21149020450cca9b3d6c646 (diff) | |
download | coreutils-57dd06703cb89ba53d05af95c11e89a2ca51af5c.tar.xz |
rm: avoid bogus diagnostic for a slash-decorated symlink-to-dir
These commands would evoke an invalid diagnostic:
$ mkdir d && ln -s d s && env rm -r s/
rm: cannot remove 's': Too many levels of symbolic links
remove.c was stripping trailing slashes from "s/" before passing
the name to "rm". But a trailing slash may change the semantics,
and thus should not be stripped.
* src/remove.c (rm_fts): Do not strip trailing slashes.
* tests/rm/v-slash.sh: Adapt to new expected output.
* gnulib: Update to latest, for an improved fts.c that merely
normalizes trailing slashes.
Reported by Paul Eggert in discussion of http://bugs.gnu.org/12339
-rw-r--r-- | NEWS | 4 | ||||
m--------- | gnulib | 0 | ||||
-rw-r--r-- | src/remove.c | 3 | ||||
-rwxr-xr-x | tests/rm/v-slash.sh | 2 |
4 files changed, 5 insertions, 4 deletions
@@ -19,6 +19,10 @@ GNU coreutils NEWS -*- outline -*- than ignoring the -d option and failing with an 'Is a directory' error. [bug introduced in coreutils-8.19, with the addition of --dir (-d)] + rm -r S/ (where S is a symlink-to-directory) no longer gives the invalid + "Too many levels of symbolic links" diagnostic. + [bug introduced in coreutils-8.6] + ** Improvements stat and tail work better with ZFS. stat -f --format=%T now reports the diff --git a/gnulib b/gnulib -Subproject 68f693ff1db33bf24695f0f42c62e7801966fd0 +Subproject 3a9002d3cc63da7110f133b1040d2d2b0aad830 diff --git a/src/remove.c b/src/remove.c index 69faae6de..847a5cc4a 100644 --- a/src/remove.c +++ b/src/remove.c @@ -433,9 +433,6 @@ rm_fts (FTS *fts, FTSENT *ent, struct rm_options const *x) /* Perform checks that can apply only for command-line arguments. */ if (ent->fts_level == FTS_ROOTLEVEL) { - if (strip_trailing_slashes (ent->fts_path)) - ent->fts_pathlen = strlen (ent->fts_path); - /* If the basename of a command line argument is "." or "..", diagnose it and do nothing more with that argument. */ if (dot_or_dotdot (last_component (ent->fts_accpath))) diff --git a/tests/rm/v-slash.sh b/tests/rm/v-slash.sh index 504f4ffb8..ec77bd063 100755 --- a/tests/rm/v-slash.sh +++ b/tests/rm/v-slash.sh @@ -26,7 +26,7 @@ touch a/x || framework_failure_ rm --verbose -r a/// > out || fail=1 cat <<\EOF > exp || fail=1 removed 'a/x' -removed directory: 'a' +removed directory: 'a/' EOF compare exp out || fail=1 |