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 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 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 Subject: Re: Symlink issue? To: cygwin AT cygwin DOT com References: <4438dd5c-3575-4c4a-2ca5-869c2c6e9373 AT cornell DOT edu> <2effc267-c2c7-f2e9-e01b-5490f5f37e9e AT towo DOT 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-Language: en-CA 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 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: , Reply-To: cygwin AT cygwin DOT com 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 17M0tfYH017702 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.] -- 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