bug-fileutils
[Top][All Lists]
Advanced

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

Re: fileutils: inconsistent behaviour stripping / from end of filenames


From: Edward Avis
Subject: Re: fileutils: inconsistent behaviour stripping / from end of filenames
Date: Wed, 12 Sep 2001 12:15:17 +0100 (BST)

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Wed, 12 Sep 2001, Jim Meyering wrote:

['rm a/' works even when a is not a directory]

>Fixing this is on my short list -- and I even have a patch from
>Paul Eggert that makes everything more consistent (and in this case,
>more POSIX compliant).  The problem is that the changes will have some
>undesirable side effects:  if you use a shell with file name completion
>that appends trailing slashes (and doesn't later remove them), you will
>find that commands like this one will fail:
>
>  rm -r /some/long-directory-name-obtained-via-completion/

Ah, that wasn't what I meant.  In my opinion it's okay to allow trailing
slashes on directory names, since shells, ls -F and many other programs
customarily append a slash to a directory name.  I just feel that the
trailing slashes shouldn't be accepted on something that isn't a
directory.

If POSIX mandates that rm should choke on trailing slashes after a
directory name, then POSIX is stupid and this behaviour should be
reserved for when POSIXLY_CORRECT is set.

>If you're lucky enough to use zsh, you don't have to worry about that,
>since its AUTO_REMOVE_SLASH option arranges to remove a completion-added
>trailing slash when necessary.  But users of other shells (notably,
>bash) don't have such an option.
>
>I've requested twice that such a feature be added to bash.

I don't think this is the answer.  How does bash know when to remove the
slash and when to keep it?  It would be very disconcerting for bash to
complete characters and then remove them again without asking.

Besides, even if bash could be changed like this, you still have the
users of other shells (for example, older versions of bash) who would
get annoyed if rm suddenly started being fussy about 'rm -r dir/'.
There is an established convention that shell completion adds the slash,
and that programs do not complain about it: this convention may not be
filtered through committees and published on dead trees, but it's no
less important for that.  So whatever POSIX says, I believe that GNU
utilities should be tolerant and not start nitpicking over trailing
slashes on directory names.  I'm sure that most users would agree.

No, all I wanted was to file a bug report saying that this
slash-stripping behaviour, while helpful for removing directories, looks
a bit funny when it happens on regular files.

- -- 
Ed Avis <address@hidden>
Finger for PGP key
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iD8DBQE7n0PHIMp73jhGogoRAnnTAJ9FPzR27Y/OotBkv5fRYtbZOK+G3QCfXyby
jrxA4lvzvYNalDLbsfuKy8w=
=fOv/
-----END PGP SIGNATURE-----




reply via email to

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