Re: Linux / Unix difference
| From: | Johannes Schlüter | Date: | Thu, 23 Jul 2009 16:27:09 +0000 |
| Subject: | Re: Linux / Unix difference | ||
| References: | 1 2 3 4 5 | Groups: | php.qa |
| Request: | Send a blank email to php-qa+get-65246@lists.php.net to get a copy of this message | ||
Hi,
On Thu, 2009-07-23 at 16:49 +0100, Derick Rethans wrote:
> No no... We've gone to great length to make things behave the same on
> every platform. Not only between Unices, but also with the Windows port.
> It is absolutely adamant that PHP works the same on every platform and
> is *not* OS dependent in how things work.
I don't think it worth going that deep into abstraction, we are talking
about an edge-case with a trailing / here and talking about paths we're
already in an area where it's hard to wrap every detail away.
If we want to got that route the only relevant standard is POSIx which
includes these two definitions which are relevant:
3.169 Filename
A name consisting of 1 to {NAME_MAX} bytes used to name a file.
The characters composing the name may be selected from the set of
all character values excluding the slash character and the null
byte. The filenames dot and dot-dot have special meaning. A
filename is sometimes referred to as a "pathname component".
3.266 Pathname
A character string that is used to identify a file. In the
context of IEEE Std 1003.1-2001, a pathname consists of, at most,
{PATH_MAX} bytes, including the terminating null byte. It has an
optional beginning slash, followed by zero or more filenames
separated by slashes. A pathname may optionally contain one or more
trailing slashes. Multiple successive slashes are considered to be
the same as one slash.
So what we call "filename" is a "Pathname" by these definitions and
explicitly allows slashes in the end. So the proper fix would be on
Linux systems to drop all trailing slashes during file operations, but
not when working with something which might be a directory, as then it
here might be a difference between /foo/ and /foo, as /foo might be a
symlink to a directory ... oh and then we have a difference in case the
file is used by a library not using stream wrappers ....
Do you really want to got that way and open that can of worms just for
abstraction of an edge case? - I'd concentrate on issues with real-life
impact.
johannes