X-Recipient: archive-cygwin@delorie.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:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; q=dns; s=default; b=e0
	ImYpUPQ7aaEuqzzNoS7inBnEK91AVS4pwfEMmi5Ot/l1aW6KcPTwFLHorg67Pixp
	qSFGeeygw3eKrHEN/mOMdZHENmuh0DoxPDgqW7b8o+fAQr5//Q8pCPyokc60pjYO
	TerXSgCy7jV6i8WY7wmhZcLJ+CBjWJ+Yr5yoF/RHQ=
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:mime-version:in-reply-to:references:date
	:message-id:subject:from:to:content-type; s=default; bh=qOlQ6Q81
	p81/xYVplt/xa7PvMXE=; b=ee5SRahcXz7c13DUVI+0G3HVC7nnbCgIa9ECrM5a
	oqNjaPjfjZwPJlq2gYgN3SLsdowsjb/UIXJuKRUsvpL4vkOo8XoFPnO/A6ShY3O6
	RotvtEQZdwsPnbXRzX2RkpB2JF2JSefnpwYZ32IKuBbV5S0RJqhjbW+XlYxrdYCq
	pvc=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-0.8 required=5.0 tests=AWL,BAYES_05,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=ham version=3.3.2 spammy=exposure, Ken, cygwin-patches, cygwinpatches
X-HELO: mail-lf0-f51.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20130820;        h=x-gm-message-state:mime-version:in-reply-to:references:date         :message-id:subject:from:to:content-type;        bh=UFOtomkKw+aJwKHxMjIMlDWKEDpjFcuuAJG0KU6emfA=;        b=ZQuzLklWQv/+NM1shiHbKcQLTpg279lwJxcJSOdsB/4CbO/2J+VKL+xTCCm0llwgB0         eeCv6DtqSQiloC1BkuJOOgC+mHajcTZYWDpAwYqVXRlp33wcZKn2+CaFKL38s7tpAL7W         IzwLTknoqWUSjXLodQWLo4483L7viNKgeZZyJ1BhB93iodET43ANZ2lMEDsWD8DxaWn5         2w6IOsG8EiN8OjPtOJOdCqADuE8T+1d5SLMeUjPSEx+93KT4f6IRqOpmQS2qAiPCtZSZ         ty9OEaNXNOd34jk8ZkNhv4fxJOHO+PrjoWGFapkkKOnLvliqWfkFA6tSG//OzbwC71zf         QJKg==
X-Gm-Message-State: AG10YOToLPwXe0/AacZE6WPjJuvzXGIMy3NheK7uic3GNrCLgUkgDjZDtO1x7+XnGVpAG2pMGV521+fV0K3f4Q==
MIME-Version: 1.0
X-Received: by 10.25.144.9 with SMTP id s9mr16086229lfd.55.1455209435880; Thu, 11 Feb 2016 08:50:35 -0800 (PST)
In-Reply-To: <20160208181306.GH12975@calimero.vinschen.de>
References: <56AC2C35.9060903@cornell.edu>	<CAO1jNwv+Lza40TnN+woA_R1HpsnEZZvYda2f8A49NE+xvKUCGw@mail.gmail.com>	<CAOYw7ds-N=f+JCn-2rtFqOyahmA_M9mVNwv1CZH6__M-K7ht1A@mail.gmail.com>	<20160208181306.GH12975@calimero.vinschen.de>
Date: Thu, 11 Feb 2016 16:50:35 +0000
Message-ID: <CAOYw7dvLBRFTHPLXX8NDzmhHaLtUvBvArMnoEHnZMrkKw1HOXQ@mail.gmail.com>
Subject: Re: cygwin_conv_path sometimes removes trailing slash
From: Ray Donnelly <mingw.android@gmail.com>
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes

On Mon, Feb 8, 2016 at 6:13 PM, Corinna Vinschen
<corinna-cygwin@cygwin.com> wrote:
> Hi Ray,
>

Hi Corinna,

Sorry for the delay, I've been snowed under with day-job things lately.

> On Jan 31 22:17, Ray Donnelly wrote:
>> On Sun, Jan 31, 2016 at 11:38 AM, Jan Nijtmans <jan.nijtmans@gmail.com> wrote:
>> > 2016-01-30 4:21 GMT+01:00 Ken Brown:
>> >> I'm using cygwin_conv_path to convert Win32 paths to POSIX paths, and I'm
>> >> puzzled by the conversion
>> >>
>> >>   d:/ --> /cygdrive/d
>> >>
>> >> without the trailing slash.  By contrast, we have
>> >>
>> >>   d:/foo/ --> /cygdrive/d/foo/
>> >
>> > This came up before:
>> >    <https://cygwin.com/ml/cygwin/2015-10/msg00048.html>
>> > I had to workaround it in tkimg.
>> >
>> > It's easy to workaround in your program, but - indeed -
>> > that shouldn't be necessary. I too would expect that
>> > when the input contains a slash, the output should too.
>> >
>>
>> I've attached the patch that we use on MSYS2 for this. We found
>> ourselves patching projects all over the open-source landscape
>> otherwise
>
> How many projects require exposure to the conversion from POSIX to Win32
> paths?  This is something which should be used in applications only very
> rarely.  Usually they just feed the POSIX path into functions like open,
> etc., and that's it.
>
>> so fixing it once and for all seems sensible. Note however,
>> a full fix also requires another patch that I posted two years ago [1]
>> that Corinna chose not to apply. In the two years since, we've yet to
>> find any issue with that patch. I will rebase it shortly in-case
>> there's any interest in reconsidering it.
>>
>> [1] https://cygwin.com/ml/cygwin-patches/2014-q1/msg00010.html
>
> Your patches don't work for Ken's case since path_conv::check is never
> called for CCP_WIN_A_TO_POSIX/CCP_WIN_W_TO_POSIX conversion.  I have a
> patch in the loop to fix that.

Great!

>
> I'm not quite sure what your first patch is supposed to accomplish in
> the POSIX->WIN case.  tail == path_copy + 1 means the incoming path is
> "/".  Your patch will result in changing the conversion of
>
>   /  -->  C:\cygwin
>
> to
>
>   /  -->  C:\cygwin\
>
> Is that really desired?  What especially bugs me is that this occurs in
> the very core of the path conversion which isn't only used in places
> exposed to user space.

It is what we needed on MSYS2. When building a "native" GCC, we'd pass
e.g. --sysroot=/ and that'd get expanded to "C:/cygwin" and have say a
sys include dir of "sys/include" appended making
C:/cygwinsys/include". I can't guarantee that *nothing* else will
break because of this change except to offer that anecdotally no msys2
package (i.e. those packages in MSYS2 that are purely POSIX) build or
execution failure was ever determined to be caused by making this
change.

Best regards,

Ray.

>
>
> Thanks,
> Corinna
>
> --
> Corinna Vinschen                  Please, send mails regarding Cygwin to
> Cygwin Maintainer                 cygwin AT cygwin DOT com
> Red Hat

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

