X-Recipient: archive-cygwin AT delorie DOT com X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 019303857C40 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=towo.net Authentication-Results: sourceware.org; spf=none smtp.mailfrom=towo.net Subject: Re: Symlink issue? To: cygwin AT cygwin DOT com References: <4438dd5c-3575-4c4a-2ca5-869c2c6e9373 AT cornell DOT edu> From: Thomas Wolff Message-ID: <2effc267-c2c7-f2e9-e01b-5490f5f37e9e@towo.net> Date: Sun, 22 Aug 2021 02:40:59 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.13.0 MIME-Version: 1.0 In-Reply-To: <4438dd5c-3575-4c4a-2ca5-869c2c6e9373@cornell.edu> X-Provags-ID: V03:K1:8HeI3BnXGwfnpsLnYX+7Q4TlF9mIc8emV2CHLtMD2Angx3HyqsW tO00Rt1rrcg8D4v0qo+ElPIRkDd1UEJzGe+iao6EodI0VScicCR9UgKXUJg2dscqrRmdqbc ro2fkftcUXuOPpLzFSvD/VS6XdPj9suk3ZS86Ya7GvD3F1pcxOx6wUU1XbggZPfMoQaiI8W uhrdoClIxBYG6tjmkalGg== X-UI-Out-Filterresults: notjunk:1;V03:K0:yBoVJCkvGnc=:ng76rt+Q+wwUlmwhXg3pB2 R7blhjPQkB63QTH3T6PuiE6zp/UgbpcMCWZGFTQOWTiOOBduZ6I2BY0g9BQpTUqQXdp8XhU6F djuSYkshZ+t1hQwcLT6BtcuEtzfiCBtchtd5+1DFyfrdLTRcQlbP+yj5wMxt5GS/aAZjSVoHO T3Dad1bGfS2Rof0JGhYkLXc4mSnDiTiPViDNZ7RAOnbf7fKT4NDP5kXZlaDufxY9AGhNTljfv XjBGsdrlKIrhiZm+mzvvcDD4lfJPYfBrglWakUnLe1vwxTuJanQ0cSi1Dx7SicijxY5xflisJ LrzAt9fA0lwpZdo1Ginw6DfX4+aLLm52l62Hi4NexziKDhDMDzqmrx/3+K0LLzfrmSwaNAWVL 9J2T9Vle1M9GjurD0rtX+3DBcaK+RQPqye6Y8YgVzkdlLiNvGm8+5vckx+9l9+ueRRP3vQWnI 0vOY+pVM2gU/HsDxuCjB9CyY7ptV4KCQqSphbfYcveMo6uVSkq6Vp+Pk2OXNPtRNk4kD2R/1D quKlwpM40J1YLHv3eFJ7pGB5CKb4ZCWRLGv4D98etOZGAFWhCwDtBiRCaMZeYeWNFTpGnwTP6 GdR96fOGbHrfFOjnIVMSSHwRvC4Ecx0JYNZNSQlFIzHagSTfZ4V0PW9ZhPU7IV2fJOhHyQqVa 07dnr2rxu6mlv13Qd+Mf2g1UbHQAOb+KatfLWhnVN3eJ0xBhjtSAmxu12KqiKG1sNFwsdVdxS rLaiL8zOeZf2076FznS1mjaeqcNSixJE/SCZewoT1Lez2EnRabDbhCncUw4ByZff49RvfKl4d 9+i+ZwsZR0KrJY+vxCknFnN1zmsbZRFRfRAchCQ/0P/FR20D1dKw4qOXRiPIKaIrv5tMeWT X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8"; Format="flowed" Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 17M0fHjt015005 Am 21.08.2021 um 23:59 schrieb Ken Brown via Cygwin: > On 8/21/2021 4:15 PM, Lavrentiev, Anton (NIH/NLM/NCBI) [C] via Cygwin > wrote: >> Hi, >> >> Please consider the following Cygwin session: >> >> $ cd ~ >> $ pwd >> /home/user >> $ touch file >> $ ls file >> file >> $ cygpath -w ~ >> C:\cygwin64\home\user >> $ mkdir /cygdrive/g/cygwin/dir >> $ ln -s /cygdrive/g/cygwin/dir ./dir >> $ ls -l dir >> ... dir -> /cygdrive/g/cygwin/dir/ >> $ cd dir >> $ pwd >> /home/user/dir >> $ cygpath -w `pwd` >> G:\cygwin\dir >> $ ls -l ../fil  (this expands to ../file but when Enter is hit): >> ls: cannot access '../file': No such file or directory >> >> so basically "file" is not accessible with the relative dot-dot link, >> even though somehow readline (bash completion) can figure it out and >> suggest >> the correct completion. >> >> Is this a Cygwin bug? > > I don't think so.  I see identical behavior on Linux (using /tmp/dir > instead of /cygdrive/g/cygwin/dir). > > Pathname resolution proceeds from left to right, with symlinks > expanded as they are encountered.  See "Pathname resolution" in > > https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap04.html > > When the CWD is /home/user/dir, the resolution of ../file goes like this: > > ../file = /home/user/dir/../file >         = /cygdrive/g/cygwin/dir/../file >         = /cygdrive/g/cygwin/file, > > which doesn't exist. > > I don't know why bash completion suggests something different.  My > guess (and it's only a guess) is that bash completion takes a shortcut > for performance reasons. The symlink/.. confusion is a dreadful trap since Unix times. Unfortunately, bash completion does not consider path resolution, so if any, it's a bash completion bug. Thomas > > Ken > -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple