delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2009/11/08/00:36:06

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4AF65892.1080802@cygwin.com>
Date: Sun, 08 Nov 2009 00:35:14 -0500
From: "Larry Hall (Cygwin)" <reply-to-list-only-lh AT cygwin DOT com>
Reply-To: cygwin AT cygwin DOT com
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.8.1.21) Gecko/20090320 Remi/2.0.0.21-1.fc8.remi Lightning/0.9 Thunderbird/2.0.0.21 Mnenhy/0.7.5.0
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: 1.7] Can you have multipe cygdrive path prefixes active at once
References: <26227605 DOT post AT talk DOT nabble DOT com> <26227607 DOT post AT talk DOT nabble DOT com> <4AF3C9FE DOT 806 AT bopp DOT net> <26230853 DOT post AT talk DOT nabble DOT com> <4AF495B0 DOT 7090607 AT bopp DOT net> <786EBDA1AC46254B813E200779E7AD36617A63 AT srv1163ex1 DOT flightsafety DOT com> <4AF4A495 DOT 3060108 AT bopp DOT net> <4AF4AB61 DOT 5040704 AT cygwin DOT com> <4AF4AE6A DOT 8000701 AT bopp DOT net>
In-Reply-To: <4AF4AE6A.8000701@bopp.net>
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

On 11/06/2009 06:16 PM, Jeremy Bopp wrote:
> Larry Hall (Cygwin) wrote:
>> On 11/06/2009 05:35 PM, Jeremy Bopp wrote:
>>> Thrall, Bryan wrote:
>>>> Jeremy Bopp wrote on Friday, November 06, 2009 3:31 PM:
>>>>> Well, it's a bit of a hack, but you could try something like the
>>>> following:
>>>>> $ dirname $(cygpath -u C:/)
>>>>>
>>>>> This assumes that there is always a C: drive and converts the path to
>>>>> the root of that drive into a POSIX path which will include the
>>>> cygdrive
>>>>> prefix.  Then dirname is used to effectively chop off the drive letter
>>>>> leaving you with the cygdrive prefix.
>>>>
>>>> Actually:
>>>>
>>>> $ ls /cygdrive
>>>> c  e  f  h  j  p  t  z
>>>> $ cygpath -u x:/
>>>> /cygdrive/x
>>>>
>>>> Seems like you aren't assuming the drive exists :)
>>>
>>> That's pretty sweet, but that feature seems to be fairly fortuitous
>>> rather than by design.  Maybe someone could speak on this point with
>>> more authority.
>>
>> If you need to know what the cygdrive prefix is, you're much better off
>> asking 'mount' directly.  I know it's a little more parsing but getting it
>> directly rather than trying back doors is far more reliable.
>
> The concern posed by the instigator of this thread is that it can't be
> known from the output of "mount -p" whether or not the spaces which
> follow the listed cygdrive prefix are part of the prefix or padding for
> the outputted columns.  It should be pretty rare that someone
> intentionally uses trailing spaces in their cygdrive prefix, but I can
> understand the desire for robustness.
>
> I suppose parsing the output of "mount -m" could yield a definitive
> result, but there the risk is that the output could change subtly and
> break simple parsing.

Yeah, that's one way.  Still some parsing going on there but I agree that's
better and is certainly more direct.  I was going to suggest skipping all that
and instead just using "mount -m >somefile; mount -c /foo; script;
cp somefile /etc/fstab; mount -a" but that doesn't seem to work for me right
now.  Perhaps you're better off abandoning work-arounds and instead just
submitting a patch to 'mount' that provides a solution that's easy to work with.

-- 
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
216 Dalton Rd.                          (508) 893-9889 - FAX
Holliston, MA 01746

_____________________________________________________________________

A: Yes.
 > Q: Are you sure?
 >> A: Because it reverses the logical flow of conversation.
 >>> Q: Why is top posting annoying in email?

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019