X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:from:to:references:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=prJtcGNYoXmUVuDh oXoV7ROqgV7Ir6OfYAzaQAJzxr8FRKi8fVWPO6e4cMOzUzJjAgH9xvTPzcL79qBs ZJnbmI+GM9I7YUaYqLriF4C4UERzl1erB6Gzwxw372BaLR2CiCZfPDExfFgAlxuy Wxd3PkrEv0aqrkJNvRe7RWC0wbk= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:from:to:references:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=19y4iOBdT8nfYvm1eZ2cxt 2QAmw=; b=AFvkQbM6HoBlz4o4Ro47BQipN+ld+2G88QUcKtN6YnqSFCdz3l+uck xuuWPs6B3huknB7+wUrfkc/eFTlCRZkEGwMOsiwFpBmI33NzrmjCLrzCA9lCcJXO WO4VfrvJF38FC4pa24Hg6Ie1YBTth80ceSzqTWeNdAlKzpUSmOEkY= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.1 spammy=spirit, HContent-Transfer-Encoding:8bit X-HELO: resqmta-po-07v.sys.comcast.net DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=comcastmailservice.net; s=20180828_2048; t=1578416442; bh=4k609I4tMCb7BHuekae5CmGVWMTtKBaZAQHW5sYdeHI=; h=Received:Received:Subject:From:To:Message-ID:Date:MIME-Version: Content-Type; b=SSDLEQJ4N34pIDrq64yHOPynkyh4Kmi1L0gdFeOR2sseesmzFwLz+Hhjrtp+GxbYf ikAKdJ0HSt+kyBE04r35gVWecQR71eqxRMPw+N+/6e5wbK3fQydttuIew/wJeivSUV QEs/LpWYFbt4CbEAM56Gm8E1u9q5HoDnBdOYlq83zFvvwnSZFT8/6lvYCgqL0jK2QJ c5wmvx3dSiW/4WVKSxtJTQOkUZCFQoQE9IzK0ldKdzwdphsRUhPTi7zmuE+suKg9Op VlPRT6ccpgA/6aq5WjMLqErJxGFRGvkZdT5CNdnan6hDh7LOTCf77Q16J0ZJ5dqPmE CIJlPVAuZZOQA== X-Xfinity-VMeta: sc=0.00;st=legit Subject: How to get the drive a file is on (was Re: /bin/pwd, cygpath -wa fail under native symlink) From: Ernie Rael To: cygwin AT cygwin DOT com References: <43d42586-514d-476c-6e4b-84b650a827ec AT raelity DOT com> Message-ID: Date: Tue, 7 Jan 2020 09:00:26 -0800 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.3.1 MIME-Version: 1.0 In-Reply-To: <43d42586-514d-476c-6e4b-84b650a827ec@raelity.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit X-IsSubscribed: yes Note-from-DJ: This may be spam I need to find out the drive on which some files reside. I need to make some links from a tmp dir to the files from a script. So I need to determine where they reside so I can figure out which tmp dir to use. Hard links, not running as administrator. I tried cygpath -wa and /bin/pwd. They fail in some cases as described below. If this is a problem for cygwin, is there a win7 command I can use? -ernie On 12/25/2019 2:05 PM, Ernie Rael wrote: > (CYGWIN_NT-6.1 spirit 3.1.1(0.340/5/3) 2019-12-18 09:28 x86_64 Cygwin, > win7) > > The windows root is C:, cygwin root is on F:. > A native symlink under C: that points into F: gets > an incorrect result from cygpath -wa. > > Notice that when the current directory is the target of the symlink > then the result is ok. But any deeper in the tree fails. To summarize: > >     @ /a/src/jvi-dev/jvi > $ cygpath -wa . > C:\f\src\jvi-dev\jvi <<<<<<< correct >     @ /a/src/jvi-dev/jvi/src > $ cygpath -wa . > C:\a\src\jvi-dev\jvi\src <<<<<<< fail > > === more detail === > >     @ /a/src/jvi-dev > $ ls -l jvi > lrwxrwxrwx 1 erra None 18 Dec 23 15:16 jvi -> /f/src/jvi-dev/jvi > >     @ /a/src/jvi-dev > $ junction jvi > > Junction v1.06 - Windows junction creator and reparse point viewer > Copyright (C) 2000-2010 Mark Russinovich > Sysinternals - www.sysinternals.com > > C:\a\src\jvi-dev\jvi: SYMBOLIC LINK >    Print Name     : C:\f\src\jvi-dev\jvi >    Substitute Name: \??\C:\f\src\jvi-dev\jvi > >     @ /a/src/jvi-dev > $ cygpath -wa jvi > C:\a\src\jvi-dev\jvi > >     @ /a/src/jvi-dev > $ cd jvi > >     @ /a/src/jvi-dev/jvi > $ cygpath -wa . > C:\f\src\jvi-dev\jvi <<<<<<< correct > >     @ /a/src/jvi-dev/jvi > $ cd src > >     @ /a/src/jvi-dev/jvi/src > $ cygpath -wa . > C:\a\src\jvi-dev\jvi\src <<<<<<< fail > > === some possibly relevent stuff from the mount table > > $ mount > F:/cygwin64 on / type ntfs (binary,auto) > C:/f on /f type ntfs (binary,user) > F:/c on /c type ntfs (binary,user) > F: on /cygdrive/f type ntfs (binary,posix=0,user,noumount,auto) > > > -- > Problem reports:       http://cygwin.com/problems.html > FAQ:                   http://cygwin.com/faq/ > Documentation:         http://cygwin.com/docs.html > Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple > > > -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple