Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98724 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 703 invoked from network); 2 Apr 2017 18:28:59 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Apr 2017 18:28:59 -0000 Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.128.174 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 209.85.128.174 mail-wr0-f174.google.com Received: from [209.85.128.174] ([209.85.128.174:36858] helo=mail-wr0-f174.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id B1/29-02743-AE241E85 for ; Sun, 02 Apr 2017 14:28:58 -0400 Received: by mail-wr0-f174.google.com with SMTP id w11so139712927wrc.3 for ; Sun, 02 Apr 2017 11:28:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=5rCNtK+6slGK+APwrjzr32pa0t8P7wC0hb7Nms/dEFc=; b=QmPpnm/TuLJhvN5pSnWRgCCxDAS6nH4OoMsNNKysQ0LsnALLLtROj/D+6IgoyEE9mo daILz5/5pMTg37IUDtW1MTj/1hMPIIIXjUBCsOwstZu6WUIa3wnHwDKFMdLVhI9MhfjD cQ4y5x7T1K118ZqqPwLQThlx0mTOiAdqu7+pUVy6t2gxBHw2aI9ML8PZgBNIlTParzyP xn3I4Haxsas8fzKjpL//ojafNSDhEC6MV6imsTnBpvI+M1PJgeMPD+Rm4vF0IS0/lX9k Cr+DH/FfC79BR6A4+zAcqDQqrBvNXFFIglqofIVL+H9RI4cZo0x7Oph3uLXeoQoKDiE7 MGuQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=5rCNtK+6slGK+APwrjzr32pa0t8P7wC0hb7Nms/dEFc=; b=IVVGuNmxG/B90LOYXg6aST/15O28N4TRhy/ZaKsw3mFBTDfacX/iYQAftjYnLGv3c6 CF2unZp0uzAY1WJR2KmL9VM11bkcsqrvfxGlWwtlmqBfB+BtchL0ca6A6Tk1JQkNiW2w KjbKjkjHQKCeQGAJ+SBNNnHyWUqOY/K68uZFLVpVIF9rO7tQDOjAGBgnekxP/RqzIgHR dGR7MTSs1FiE53yD0re9uBuWFkJIKWL5DAde7uEsYMEV9oLSbLGv+vQH1MSnvfwhscAz lksOAV01gUZywt7IHpSKX6THCs2rw8lh6PwWk0HbAJfxxRpadi4TclSfR1aPwqH1zyg6 FiYw== X-Gm-Message-State: AFeK/H3WKoUVppwlbIrCd7zSQ5+50TMwPthBqEnMLA8e/yFUT1/vd1nretLfvjDVk3PyiA== X-Received: by 10.28.66.74 with SMTP id p71mr6601040wma.131.1491157735340; Sun, 02 Apr 2017 11:28:55 -0700 (PDT) Received: from ?IPv6:2a00:23c4:4bd2:6e00:c92d:4f40:64cc:b7e4? ([2a00:23c4:4bd2:6e00:c92d:4f40:64cc:b7e4]) by smtp.googlemail.com with ESMTPSA id y190sm11134512wmy.15.2017.04.02.11.28.53 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 02 Apr 2017 11:28:54 -0700 (PDT) To: internals@lists.php.net References: <187eb0be-90b9-f7cd-b8bd-888915429796@fleshgrinder.com> Message-ID: Date: Sun, 2 Apr 2017 19:28:48 +0100 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: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Directory separators on Windows From: rowan.collins@gmail.com (Rowan Collins) 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 to > `/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. 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, even if filesystem access is available. See for instance this discussion of pwd: http://unix.stackexchange.com/q/331208/70530 In summary, POSIX specifies "-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. The same is true for other operations - for instance, the below demo in bash shows one interpretation in "ls" and the other in "cd". /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 ./foo: lrwxrwxrwx 1 vagrant vagrant 21 Apr 2 18:21 bar -> /tmp/demo/other/thing ./other: drwxr-xr-x 2 vagrant vagrant 4096 Apr 2 18:06 thing /tmp/demo$ ls foo/bar/.. thing /tmp/demo$ cd foo/bar/.. /tmp/demo/foo$ ls bar Regards, -- Rowan Collins [IMSoP]