On Tue, Sep 04, 2012 at 01:09:24PM +0200, Jim Meyering wrote: [...] > Here's the revised commit: > > >From 3a9002d3cc63da7110f133b1040d2d2b0aad8305 Mon Sep 17 00:00:00 2001 > From: Jim Meyering <meyer...@redhat.com> > Date: Tue, 4 Sep 2012 11:36:38 +0200 > Subject: [PATCH] fts: reduce two or more trailing slashes to just one, > usually > > * lib/fts.c (fts_open): Upon initialization, if a name ends in two > or more slashes, trim all but the final one. But if a name consists > solely of two slashes, don't modify it. If it consists solely of > three or more slashes, strip all but one. > > This is part of the solution to a minor problem with rm: > it would print a bogus ELOOP diagnostic when failing to remove > the slash-decorated name of a symlink-to-directory: > > $ mkdir d && ln -s d s && env rm -r s/ > rm: cannot remove 's': Too many levels of symbolic links > > With the change below and a trivial don't-trim-trailing-slashes > adjustment to remove.c, it does this: > > $ env rm -r s/ > rm: cannot remove 's/': Not a directory > > Improved by: Eric Blake
JFYI, a side effect of this commit is that find(1) output changed: before$ find /// -prune /// after$ find /// -prune / Found by find/testsuite/find.gnu/name-slash.exp, I'm not sure whether find or its test suite has to be updated. -- ldv
pgpSjHKzObuGW.pgp
Description: PGP signature