From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 78340 invoked by alias); 7 Jan 2020 17:00:46 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 77089 invoked by uid 89); 7 Jan 2020 17:00:45 -0000 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 Received: from resqmta-po-07v.sys.comcast.net (HELO resqmta-po-07v.sys.comcast.net) (96.114.154.166) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 07 Jan 2020 17:00:43 +0000 Received: from resomta-po-11v.sys.comcast.net ([96.114.154.235]) by resqmta-po-07v.sys.comcast.net with ESMTP id orqwiKifwVvhKosDiiQ7Y0; Tue, 07 Jan 2020 17:00:42 +0000 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== Received: from [IPv6:::1] ([IPv6:2601:646:8300:b80:f57b:1950:edf0:c808]) by resomta-po-11v.sys.comcast.net with ESMTPSA id osDgiVW7NlImwosDhiXQrF; Tue, 07 Jan 2020 17:00:41 +0000 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@cygwin.com References: <43d42586-514d-476c-6e4b-84b650a827ec@raelity.com> Message-ID: Date: Tue, 07 Jan 2020 17:00:00 -0000 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 X-SW-Source: 2020-01/txt/msg00065.txt.bz2 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