*BSD News Article 47913


Return to BSD News archive

Path: sserve!newshost.anu.edu.au!harbinger.cc.monash.edu.au!yarrina.connect.com.au!warrane.connect.com.au!godzilla.zeta.org.au!not-for-mail
From: bde@zeta.org.au (Bruce Evans)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: "foo is a directory" error
Date: 27 Jul 1995 05:49:59 +1000
Organization: Kralizec Dialup Unix Sydney - +61-2-837-1183, v.32bis v.42bis
Lines: 35
Message-ID: <3v6697$i5r@godzilla.zeta.org.au>
References: <npu48aada8.fsf@enci.ucalgary.ca>
NNTP-Posting-Host: godzilla.zeta.org.au

In article <npu48aada8.fsf@enci.ucalgary.ca>,
Gord Matzigkeit <gord@enci.ucalgary.ca> wrote:
>-----BEGIN PGP SIGNED MESSAGE-----
>
>Hi!
>
>I have one minor nit with FreeBSD-2.0.5-950622-SNAP:
>
>bartok% mkdir hello; touch hello/foo ; /bin/rm -rf hello
>bartok% mkdir hello; touch hello/foo ; /bin/rm -rf hello/
>rm: hello/: Is a directory

A ever funnier example:

	$ rmdir /etc/passwd/
	rmdir: /etc/passwd/: Is a directory

I think this is traditional BSD behaviour.  The POSIX standard doesn't
seem to allow it (pathnames that decribe a directory may have an optional
trailing slash).  I had it fixed in FreeBSD-1.1, but haven't got my
changes working in 2.x.

>(and hello is left behind, though foo has been properly removed)

This is because everything works up to the final step `rmdir("hello/")'.

>This is bad.  It breaks many GNU programs, such as bash's filename
>completion, strip, and any others who like to say "hello/".

Gnu utilities handle the problem by stripping trailing slashes in
some contexts before passing the names to the kernel.  Most of the
FreeBSD utilities don't do this.  Some of the few that did used to
get it wrong by stripping "/" to "".
-- 
Bruce Evans  bde@zeta.org.au