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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; q=dns; s= default; b=CNHzpMy+cr3owpFhzta/4hbXrRBRbCoD6ziD/MPQbb71I+qS8T85t veilt+MZqfoUincUD0rGPGOJaIJk+0uobcrzBNHSxrPh2FCFLMNc80t/O0LzWoRw bo8vOuY9C8jNdBjU+IIoUHzcNanVVBi4Txeo96753mlhdiNqug0u/w= 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:date:from:to:subject:message-id:reply-to :references:mime-version:content-type:in-reply-to; s=default; bh=qt/Sqz30I79Gkd9aMCJVUbbCDbo=; b=HTPtF/12+lfLVoX/SFyweYwNnq0p FsfYhQ30YLP5XNd+p/8IZ7PVedsKJeKrvLsqivJAERqCHoSApHU5jL6R17bGW4L9 /xOZWz4K9uEeXRmgAcWZOY6Sm+z24g/zp+uvGHWPd5TUGZKJZ6TDO5U7RXzIYaZP wRdSvLfn9y1rslo= 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-Virus-Found: No X-Spam-SWARE-Status: No, score=-93.9 required=5.0 tests=BAYES_50,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_PBL,RDNS_DYNAMIC,USER_IN_WHITELIST autolearn=no version=3.3.2 spammy=exposure, WIN, H*R:D*cygwin.com, sk:ccp_win X-HELO: calimero.vinschen.de Date: Mon, 8 Feb 2016 19:13:06 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: cygwin_conv_path sometimes removes trailing slash Message-ID: <20160208181306.GH12975@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <56AC2C35 DOT 9060903 AT cornell DOT edu> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="qM81t570OJUP5TU/" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) --qM81t570OJUP5TU/ Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Ray, On Jan 31 22:17, Ray Donnelly wrote: > On Sun, Jan 31, 2016 at 11:38 AM, Jan Nijtmans w= rote: > > 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: > > > > 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. > > >=20 > 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. >=20 > [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. I'm not quite sure what your first patch is supposed to accomplish in the POSIX->WIN case. tail =3D=3D path_copy + 1 means the incoming path is "/". Your patch will result in changing the conversion of=20 / --> 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. Thanks, Corinna --=20 Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Maintainer cygwin AT cygwin DOT com Red Hat --qM81t570OJUP5TU/ Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJWuNqyAAoJEPU2Bp2uRE+gRBQP/AzacDS3nGxyj7JGhHT2pwU0 H5lufp+/RLT1lowPO+cA4QcNuWrpFDimuXsr9084gEKxZiUTJ8ODIhSei9fivOYc IGYsfv1qlvJuOYuGr7Gh4psUggM5H4/51mzkutohbUmk3HTAy1O/mNxhRYEI1zsh QCuA05NAuV2hH5Jjdo+7XUVjSU9QG8booY8AxHPx55ahde+isuYtoVULIuhenJUi 3JsR9m1tVpeyA/1LgqlLTvk2n57n0+JQyZdtG81KfT/S5/oRB1fD6pwcwFYOkqUa cCPCPf4vkQus2GE0HM3rxt/d68ZzP1tLmewR1PpSYxEdFgDQQghjFmZH1T0wHVfR fkSSCLP/5gYhNDYTHJN5GXF/ptuyGmCPLNkF/1IeLZuRYbcV5avd4S9Ukz3lqsxX L7Tlv6+mEuO6kADs1b+0DJA0DkeW750A0CIgyVH/z6lGLGd4UIi3C9JZd18jTndC 9+8VkrPSvUxpXPSGsA4/Q96TrbxYZqOFkMKTe9fTEru9e7CoPOF7kyjeJIWft0Lh mdQIQVNoPMJCAMg9yWThqfRmodxSOeG4JnecLeajMDv72iI4ckkkeoywi9pUDlHv XHDKOwFtrKrB7PKaOpURFaQDfnG9LRBQ470Z3mEfArqiLzA40xSVJyBVPEEwXcRW zxz05oQkT8Z0Qi2GQb60 =9U5Y -----END PGP SIGNATURE----- --qM81t570OJUP5TU/--