[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: rm anomaly on symlinks with fileutils 4.1.9

From: Bob Proulx
Subject: Re: rm anomaly on symlinks with fileutils 4.1.9
Date: Wed, 8 Jan 2003 23:31:18 -0700
User-agent: Mutt/1.4i

Jonas Pasche <address@hidden> [2003-01-09 03:40:13 +0100]:
> This is what happens (remember, "testdir2" is a symbolic link to
> "testdir1", which contains a file, "testfile"):
> # rm -i testdir2/
> rm: remove directory `testdir2/'? y
> rm: cannot remove directory `testdir2/': Is a directory

Those messages are confusing.

> It doesn't ask to delete the file "testfile" (fileutils 4.1.9 ask), and
> it actually doesn't delete anything.

Since the trailing slash is required to push through the symlink, I
think at least partially this is the expected behavior.  This comes up
every now and again and usually it is suggested to try configuring the
shell not to put slashes on the end, or to look at the mv
--strip-trailing-slashes option.  I agree that neither of those is
particularly satisifying and just mention them in passing.

Since the standards require the behavior that trailing slashes push
through symlinks I am not sure what could be done about it.  Also, a
lot of people, myself included, find that behavior of dereferencing
symlinks when using a trailing slash as the as the one that makes the
most sense.  If you put a trailing slash on it then you are pushing
through the symlink.  A slash with nothing after is the same as a '.'
and therefore "path/" is "path/.", right?

Trailing slashes were never a problem until shells started doing
autocompletion.  At that time a conflict emerged.  Sigh.

> Second case:
> # rm -rf testdir2/
> rm: cannot remove `testdir2/': Not a directory
> Nothing gets deleted, even not the testdir2 symlink.

That is an interesting case.  I think some improvement could happen

> The following things can be identified as errors; they're at least
> irritating and/or not consistent with the fileutils 4.1 (latest stable):
> * "rm -i testdir2/" doesn't identify testdir2 as a symlink, but as a
> directory (which it actually isn't)

Actually it is.  The trailing slash pushes through the symlink and
this is effectively the same as this command.

  rm -i testdir2/.

What should happen in this case?

> * "rm -i testdir2/" results in "cannot remove directory" both under
> fileutils 4.1.9 and coreutils 4.5.4. Amazingly, under fileutils 4.1.9 it
> says: "Not a directory", while under coreutils 4.5.4 it says: "Is a
> directory" when used with "-i", and "Not a directory" when used with
> "-rf". At least this is definitely inconsistent within the latest
> coreutils.
> * The message "rm: cannot remove directory `testdir2/': Is a directory"
> is a contradiction in terms.
> * The commands "rm -i testdir2/" and "rm -rf testdir2/" end up in
> different results when compared to fileutils 4.1.

I think some of that is unintentional or it would show up in the NEWS.


Attachment: pgp2oTBSIqBHj.pgp
Description: PGP signature

reply via email to

[Prev in Thread] Current Thread [Next in Thread]