From owner-freebsd-current Tue Apr 18 01:27:29 1995 Return-Path: current-owner Received: (from majordom@localhost) by freefall.cdrom.com (8.6.10/8.6.6) id BAA23844 for current-outgoing; Tue, 18 Apr 1995 01:27:29 -0700 Received: from godzilla.zeta.org.au (godzilla.zeta.org.au [203.2.228.34]) by freefall.cdrom.com (8.6.10/8.6.6) with ESMTP id BAA23757 for ; Tue, 18 Apr 1995 01:26:51 -0700 Received: (from bde@localhost) by godzilla.zeta.org.au (8.6.9/8.6.9) id SAA11255; Tue, 18 Apr 1995 18:22:22 +1000 Date: Tue, 18 Apr 1995 18:22:22 +1000 From: Bruce Evans Message-Id: <199504180822.SAA11255@godzilla.zeta.org.au> To: freebsd-current@FreeBSD.org, taob@gate.sinica.edu.tw Subject: Re: Behaviour of rm/rmdir Sender: current-owner@FreeBSD.org Precedence: bulk > This is something that has been bothering me for years... dunno >why I suddenly decide to bring it up now. ;-) Why do "rm -r[f]" and >"rmdir" complain about removing an empty directory if you append a >slash to the name? I mean, this looks pretty ridiculous to me: >% du testdir >2371 testdir >% rm -rf testdir/ >rm: testdir/: Is a directory <--- tell me something I don't know... >% rmdir testdir/ >rmdir: testdir/: Is a directory <--- argh!!! > It isn't a big deal to leave off the trailing slash, but filename >completion in tcsh and bash both append it. Is this just a 4.4BSD >thing? I checked around on our IRIX, SunOS, Solaris and AIX machines >and none exhibit this behaviour. BSD/OS 2.0 rm/rmdir behave this way >too. Bug or feature? It is apprently a BSD thing. It was in FreeBSD-1.1.5. I fixed it there, and have updated the changes to FreeBSD-2.1-Development except for one detail that causes an infinite loop for "testdir/" when testdir is a symlink (perhaps to a directory). POSIX requires trailing slashes to work right and the other OS's are probably more POSIXish than FreeBSD. Some versions of `rm' and `rmdir' mask the bug by gratuitously stripping trailing slashes. Bruce