From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) by sourceware.org (Postfix) with ESMTPS id 541A63857C40 for ; Sun, 22 Aug 2021 00:55:14 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 541A63857C40 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=systematicsw.ab.ca Received: from shw-obgw-4002a.ext.cloudfilter.net ([10.228.9.250]) by cmsmtp with ESMTP id HJinm4J8U4bInHblZmEM2x; Sun, 22 Aug 2021 00:55:13 +0000 Received: from [192.168.1.105] ([68.147.0.90]) by cmsmtp with ESMTP id HblZmktrrB9dPHblZmJhzk; Sun, 22 Aug 2021 00:55:13 +0000 X-Authority-Analysis: v=2.4 cv=Ac10o1bG c=1 sm=1 tr=0 ts=6121a071 a=T+ovY1NZ+FAi/xYICV7Bgg==:117 a=T+ovY1NZ+FAi/xYICV7Bgg==:17 a=IkcTkHD0fZMA:10 a=uZvujYp8AAAA:8 a=uYT-Tk0qkVT609LjNaIA:9 a=QEXdDO2ut3YA:10 a=-MPXFloOhxUA:10 a=SLzB8X_8jTLwj6mN0q5r:22 Reply-To: cygwin@cygwin.com Subject: Re: Symlink issue? To: cygwin@cygwin.com References: <4438dd5c-3575-4c4a-2ca5-869c2c6e9373@cornell.edu> <2effc267-c2c7-f2e9-e01b-5490f5f37e9e@towo.net> From: Brian Inglis Organization: Systematic Software Message-ID: <4eb95271-5340-65a3-fb78-3e35271878b3@SystematicSw.ab.ca> Date: Sat, 21 Aug 2021 18:55:13 -0600 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: <2effc267-c2c7-f2e9-e01b-5490f5f37e9e@towo.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-CA Content-Transfer-Encoding: 8bit X-CMAE-Envelope: MS4xfGVhPlReCrXHQFcP9W2ww0InmgEGbq/ZKpsoGawdSO7hNIpqMDvi2H2LbWH++/j0Q63U8AN1Tb+tkPJswxEtUEwwIy/fHpiHXHCg5wSrE1HxSRe9ijSd hSkEHOMyb6tSAFWdR4Bq6smWsncwymZJCLbHVCp2LAVEjYXgWn8G6V3o94JJsdHmZ6y4Rg68Y2rwIIqlfYTvkdM5ZdWWQNToFYc= X-Spam-Status: No, score=-1160.1 required=5.0 tests=BAYES_00, BODY_8BITS, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=no 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@cygwin.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: , X-List-Received-Date: Sun, 22 Aug 2021 00:55:24 -0000 On 2021-08-21 18:40, Thomas Wolff wrote: > > > 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. Try using cd -P (via alias?) which may resolve physically if it works. Otherwise enjoy the quirks of cd via symlinks and .. resolution after. -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. [Data in binary units and prefixes, physical quantities in SI.]