Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98726 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 67612 invoked from network); 3 Apr 2017 16:49:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Apr 2017 16:49:29 -0000 Authentication-Results: pb1.pair.com header.from=php@fleshgrinder.com; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=php@fleshgrinder.com; spf=permerror; sender-id=unknown Received-SPF: error (pb1.pair.com: domain fleshgrinder.com from 77.244.243.86 cause and error) X-PHP-List-Original-Sender: php@fleshgrinder.com X-Host-Fingerprint: 77.244.243.86 mx105.easyname.com Received: from [77.244.243.86] ([77.244.243.86:46174] helo=mx105.easyname.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 34/55-28750-21D72E85 for ; Mon, 03 Apr 2017 12:49:27 -0400 Received: from cable-81-173-132-37.netcologne.de ([81.173.132.37] helo=[192.168.178.20]) by mx.easyname.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.84_2) (envelope-from ) id 1cv5AL-0004Hn-NY; Mon, 03 Apr 2017 16:49:19 +0000 Reply-To: internals@lists.php.net References: <187eb0be-90b9-f7cd-b8bd-888915429796@fleshgrinder.com> To: Rowan Collins , internals@lists.php.net Message-ID: <02e90e99-a9ab-4884-1a39-2cb6b7ef9283@fleshgrinder.com> Date: Mon, 3 Apr 2017 18:48:51 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Xi5IKcBFQNx47PM13n0NOtuQo2Jf0a2LU" X-DNSBL-PBLSPAMHAUS: YES Subject: Re: [PHP-DEV] Directory separators on Windows From: php@fleshgrinder.com (Fleshgrinder) --Xi5IKcBFQNx47PM13n0NOtuQo2Jf0a2LU Content-Type: multipart/mixed; boundary="p9Jwp5WHHkIqEQPGLd1i1q8NpuOIJWJ9C"; protected-headers="v1" From: Fleshgrinder Reply-To: internals@lists.php.net To: Rowan Collins , internals@lists.php.net Message-ID: <02e90e99-a9ab-4884-1a39-2cb6b7ef9283@fleshgrinder.com> Subject: Re: [PHP-DEV] Directory separators on Windows References: <187eb0be-90b9-f7cd-b8bd-888915429796@fleshgrinder.com> In-Reply-To: --p9Jwp5WHHkIqEQPGLd1i1q8NpuOIJWJ9C Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 4/2/2017 8:28 PM, Rowan Collins wrote: > On 02/04/2017 09:09, Fleshgrinder wrote: >> Your strategy works in these examples, but the example I gave was >> different. Imagine that we have `/a/b/../c` which we would normalize t= o >> `/a/c`. However, the `b` component is actually a symbolic link to `x/y= `. >> Hence, the real version of the path is `/a/x/c` and not `/a/c` as we >> would have normalized it to. >=20 > Both strategies are equally valid, as long as you know which is in use.= > There are many common tools outside PHP which use both approaches, and > situations where you might actually want the string-based approach, eve= n > if filesystem access is available. >=20 > See for instance this discussion of pwd: > http://unix.stackexchange.com/q/331208/70530 In summary, POSIX specifie= s > "-L" (logical) which uses $PWD as set by the shell as you navigate, and= > "-P" (physical) which resolves backwards through the ".." links in the > file system. >=20 > The same is true for other operations - for instance, the below demo in= > bash shows one interpretation in "ls" and the other in "cd". >=20 >=20 > /tmp/demo$ ls -lR > .: > drwxr-xr-x 2 vagrant vagrant 4096 Apr 2 18:21 foo > drwxr-xr-x 3 vagrant vagrant 4096 Apr 2 18:05 other >=20 > ./foo: > lrwxrwxrwx 1 vagrant vagrant 21 Apr 2 18:21 bar -> /tmp/demo/other/thi= ng >=20 > ./other: > drwxr-xr-x 2 vagrant vagrant 4096 Apr 2 18:06 thing >=20 > /tmp/demo$ ls foo/bar/.. > thing >=20 > /tmp/demo$ cd foo/bar/.. > /tmp/demo/foo$ ls > bar >=20 > Regards, >=20 I get your point, and I have to agree here. `normalize_path`/`Path::normalize` would be the counterpart to `realpath`/`Path::canonicalize`. =F0=9F=91=8D --=20 Richard "Fleshgrinder" Fussenegger --p9Jwp5WHHkIqEQPGLd1i1q8NpuOIJWJ9C-- --Xi5IKcBFQNx47PM13n0NOtuQo2Jf0a2LU Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJY4n0JAAoJEOKkKcqFPVVr3nEQAKmqXWsZPeBSwVZi23fEgsx3 w5G+waxsuTLH3w3FCtjvGnVGu3suj9f2a5Q7k2MZK6KlxX/bRTtcrEukjWzCApGR R5BhP9LwiHtk5D6J3+ieKz2FKi9MOjmJvc+4Z02x+Nj3SGAomYRw0UPw5O4WR/UV puPcvyFDPhGkDkhGiyv81QmF0TVgmaCpJ86M7cKUcvhRmaaLJ/gooQGovNin+npz uAbspfdKVQyr8gvkL3qRfDSEV55uqZrvY5dIi5OuH1ChsXWrWtEQCm2/EVRy+Di+ DFFgeCqpqQc+8JLLfF1bPx+Ve0108yVmL6F4Vamhc0RPqorpIDI70iwp+9dXiooJ gMuoIe3DAuLd9H97GF3hs7Z3QvRguXyprx9lceF3fpBzp7QdGRAO9si75E2nlb40 oSED7lzFHmiiAGC+4FquezNoNaDs8auJUPGW9cL5nxZVVp1crzJCsmpfl3PsrW8R YnFuYbaGX9jiPM7ycPTTHA8jegWxWqWCE5c8ohg8QIQgedq5VjRaYFZU2zkIsRcO Sd8nK7fBtWM24QB7CUY2gG3RCtujzdvhRho9kzMRZNJSBP0P/zpEkzu1ykMui+Cl 5VnZUTSJD31NWJYWQIIhvdzFV5kIDA7PrHxpJMrSyjzPwICuHCBcUoXBDQBs4Qu8 nGkzz8jJftR+vBBlfWds =dnbz -----END PGP SIGNATURE----- --Xi5IKcBFQNx47PM13n0NOtuQo2Jf0a2LU--