Subject: Re: Pathnames with trailing /
To: <>
From: David Laight <david@l8s.co.uk>
List: tech-kern
Date: 09/08/2003 09:03:48
> 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?

mkdir fred//

> 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].

You need to understand the distiction between how something should be
parsed, and why you might decide to generate something.
I've no idea where the suggestion that a trailing / should imply you want
a directory came from.

>  >    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.

In that case you have only met one of the two types of implementation.
My guess is that it is a SYSV <-> BSD difference.

> >    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.

It means everywhere that a pathname is used.

> >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

You clearly do not understand the standard correctly...

	David

-- 
David Laight: david@l8s.co.uk