@ page 226 line 8854,8859 section cd objection [gwc cd 2slash]
Problem:
Defect code : 1. Error
In steps 5 and 6 of the processing performed by the cd utility,
two pathnames are concatenated with a slash character in between.
The second pathname is always a relative path, but the first varies.
If the first happens to be "/" the end result will be a pathname
beginning with two slashes, which has an implementation-defined
meaning and might not be resolved in the intended way.
There are two simple ways to fix the problem:
1. Specify the concatenation is done with two slashes instead of
one.
2. Specify that if the first pathname is "/" then it is just
concatenated with the second pathname (without any additional
slash character in between).
However, neither of these is satisfactory, as whichever we
choose there are almost certainly some implementations which
do the concatenation differently and thus would not match
the requirements of the standard as regards whether the final
pathname passed to chdir() exceeds PATH_MAX bytes.
(Probably many implementations do not care about producing
pathnames beginning with two slashes, as they do not treat
them as special.)
The solution I propose allows implementors to choose which way
they do the concatenation.
Action:
After line 8890 add a new paragraph:
Wherever one of the above steps calls for the concatenation of a
pathname, a slash character, and a second pathname, the
implementation may instead perform one of the following
alternative concatenations in order to avoid generating a pathname
beginning with two slash characters. One of the alternative
concatenations shall be performed if the first pathname contains
only a slash character and the implementation does not resolve
pathnames beginning with two slash characters as if they began
with a single slash character.
a. Concatenate the first pathname, two slash characters, and
the second pathname, regardless of the contents of the first
pathname.
b. If the first pathname contains only a slash character,
concatenate a slash character and the second pathname;
otherwise, concatenate the first pathname, a slash character,
and the second pathname.
|