Subject: Re: Pathnames with trailing /
To: David Laight <david@l8s.co.uk>
From: Kamal R Prasad <kamalrpr@in.ibm.com>
List: tech-kern
Date: 09/08/2003 12:45:12
David Laight <david@l8s.co.uk>
Sent by: tech-kern-owner@NetBSD.org
09/01/2003 08:20 PM
 
        To:     tech-kern@NetBSD.org
        cc: 
        Subject:        Pathnames with trailing /

 

http://www.opengroup.org/onlinepubs/007904975/xrat/xbd_chap04.html#tag_01_04_11

says:


>    Pathnames that end with one or more trailing slash characters must 
refer
>    to directory paths.  Previous versions of IEEE Std 1003.1-2001 were 
not
>    specific about the distinction between trailing slashes on files and
>    directories, and both were permitted.

How can a pathname have more than one trailing slash? Either you have a 
trailing slash to imply you are referring to a directory *only* or none to 
imply that it can be a filename [or a pathname].

 >    Two types of implementation have been prevalent; those that ignored
 >   trailing slash characters on all pathnames regardless, and those that
 >   permitted them only on existing directories.

The implementations I know of -equate foo/ with foo and vice-versa.

>    IEEE Std 1003.1-2001 requires that a pathname with a trailing slash
>    character be treated as if it had a trailing "/." everywhere.

where else besides at the end of the pathname? that is the only location 
that matters.

>This actually means that both mkdir("xxx/") and system("mkdir xxx/")
>should always fail.

If I understand correctly, both of these should succeed and do an mkdir 
xxx

regards
-kamal