Keith Thompson <
Keith.S.T...@gmail.com>:
>Helmut Waitzmann <
nn.th...@xoxy.net> writes:
>[...]
>> If "" (the empty pathname) ever should be a valid pathname, I would
>> vote for it to be the root directory, not the current working
>> directory.
>[...]
>
>But then it would be in effect an absolute pathname even though it
>doesn't start with a '/' character.
Yes, but if viewed from a different direction that is not a problem:
The common rule to decide whether a pathname is an absolute or a
relative one is as follows:
If the first character of a pathname is a slash, the pathname is an
absolute one, else a relative one.
But one could imagine a different rule:
If the first character of a pathname is a character other than a
slash, the pathname is a relative one, else an absolute one.
If the following rule is added to restrict each of the two rules
above, then the two rule sets are equivalent: If the pathname is
the empty path, then it is an invalid pathname.
I think, the fact that absolute pathnames start with a slash, is
only by coincidence. The real cause of this coincidence can be
imagined as follows:
The (hidden) leading pathname component of the root directory is the
empty component. The empty pathname is set to be an invalid
pathname.
The consequence of this is, that the root directory cannot be named
without a trailing slash.
Every pathname denoting a directory can be named with a trailing
slash, and that trailing slash does not hurt in any way.
The only difference where a trailing slash after a non‐empty
pathname makes a difference, is the case, where that pathname
denotes a symbolic link that refers to a directory.
But as the root directory will never be a symbolic link, forbidding
the empty pathname will cause no harm.
=> Absolute pathnames, i. e. pathnames starting with the root
directory, always begin with an empty pathname component followed by
a slash, which is textually the same as beginning with a slash.
>I can see that causing more problems.
>
Maybe that's the reason why the empty pathname has been defined to
be an invalid pathname.