*BSD News Article 13284


Return to BSD News archive

Newsgroups: comp.os.386bsd.bugs
Path: sserve!newshost.anu.edu.au!munnari.oz.au!metro!ipso!runxtsa!bde
From: bde@runx.oz.au (Bruce Evans)
Subject: Re: patch for bin/rm/rm.c
Message-ID: <1993Mar24.102446.18876@runx.oz.au>
Organization: RUNX Un*x Timeshare.  Sydney, Australia.
References: <1oligtINN6mj@ftp.UU.NET> <f0Yl6J8@quack.kfu.com>
Date: Wed, 24 Mar 93 10:24:46 GMT
Lines: 24

In article <f0Yl6J8@quack.kfu.com> dfox@quack.kfu.com (David Fox) writes:
>Personally, I've never experienced a problem with 'rm -f'.  OTOH, I noticed
>a problem with 'rmdir directory/' (note the trailing separator).  It told
>me that 'directory/ is a directory'.  If I omit the trailing backslash
>it works fine, of course.  I'm not sure if this is the way it's supposed

I think POSIX requires the path "dir/" to mean the same as "dir" in
directory contexts and "dir/." to mean the same as "dir/".  The following
happens in practice:

                    386BSD-0.1  ISC 3.2.2  Linux-0.99pl6  Minix-1.6.25
                    ----------  ---------  -------------  ------------
rmdir("dir/")       EISDIR      works      ENOENT         works
rmdir("dir/.")      EINVAL      EINVAL     EPERM          works

>to work.  Note that I'm using bash, and filename completion on a directory
>name appends the backslash, and it's slightly inconvenient to have to redo
>the command without the trailing backslash.

gnu rmdir removes the trailing (forward) slash.  This is a misfeature.
Only the file system should have to know _all_ the rules about
pathnames.
-- 
Bruce Evans  bde@runx.oz.au