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:from:date
	:message-id:subject:to:content-type:content-transfer-encoding;
	 q=dns; s=default; b=m5aE/DXNHGh/nht7f56QlgKZ88KzFSE681+D6IJGzlN
	oqH329Tx8y61+4sZTEcdcaJtXZgFD/RETMQJJAG1+XD55horVOWyg763AYa1MMjH
	qQtj8Q0e7k+eVkNHEVcXCXK7u9RHi7hZc7vuKqu9QDDd06DcXWilnOekCNCtvVA8
	=
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:from:date
	:message-id:subject:to:content-type:content-transfer-encoding;
	 s=default; bh=i93eSvB27Vgu6yPjqJG8pNukUJY=; b=DLai29USjBHYHh1Pu
	p6jFzbeRD2n0DPKf2OQRxGOh01gOsKLrfQHwo1PLMy7tFS/xVheLZRClog3PrB+/
	doAEN171iT+qGzkdLSQjCopn3PGsIndMAzewYGrQCcJYXIfbSPHtTgadkvI2mavA
	pIzVNZPR0yIndoECf1yN/Bght8=
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=-1.4 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM,SPF_PASS autolearn=no version=3.3.2 spammy=enters, firstly, Hx-languages-length:2269, W
X-HELO: mail-ot0-f169.google.com
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;        d=1e100.net; s=20161025;        h=x-gm-message-state:mime-version:in-reply-to:references:from:date         :message-id:subject:to:content-transfer-encoding;        bh=SWktGcu23jaBREYujpIWrdv08EY44VqhVJtNmx+XeOY=;        b=aMtPnJPjNd+ADz34LSVkKsxia3FhKDJPLhZ2jZXNcb3agiH19raFTbL7dzzDZeomPV         Lo+rXmhpx9EI3gb5BWNFiTrS7qpJIfckGHkWAgWsqn8vwv1QX+qjO8Uop/nzYqrBvSUP         Wkc1T4wg2J87anM81vkU9fezv+dmmSOb+WIbzlXT7VOhp0Y2jVBP9KYa7WjbS7hotHPA         p84BEIzqN3TOgv7aou91Z7DCrS5wOzTsC+jlNbMVYtzF9ZKOASbnaPPZPUfIzywcr9uE         p73gW2qIazpgZnYpy0xb2bJKEUu20JbmgcJQIu0EAMm2dQPT/STiKcAWPeu8ZXhMPvnp         0Jfg==
X-Gm-Message-State: AMke39msxkf9u6aotZiUI07luKQ5lArs2prVDXYAADmRbv9zXWo3l8q2Ns96qNSfcbFMK6K81f8ec4SZwARFfQ==
X-Received: by 10.157.27.70 with SMTP id l64mr5604712otl.92.1486759031265; Fri, 10 Feb 2017 12:37:11 -0800 (PST)
MIME-Version: 1.0
In-Reply-To: <151946397.20170210223617@yandex.ru>
References: <91DCAC3CB99C724EB365BB64677FBE7B139A86@MX204CL04.corp.emc.com> <151946397.20170210223617@yandex.ru>
From: Michael Enright <mike@kmcardiff.com>
Date: Fri, 10 Feb 2017 12:37:10 -0800
Message-ID: <CAOC2fq8qG6xghRuUdRqR3bX4Ndeio-viox6X2hzS7D=dFfYmXQ@mail.gmail.com>
Subject: Re: cygpath
To: cygwin@cygwin.com
Content-Type: text/plain; charset=UTF-8
X-IsSubscribed: yes
Content-Transfer-Encoding: 8bit
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id v1AKbZxa025534

On Fri, Feb 10, 2017 at 11:36 AM, Andrey Repin  wrote:
> Greetings, Gluszczak, Glenn!
>
>> Isn’t this a defect in cygpath?  Looks like memory corruption.
>
>> %%%cygpath -w /usr/non-existent/*
>> C:\cygwin\usr\non-existent\�[W��
>
> Looks more like private character space combined with incorrect terminal setup.

The link to private character space is realllly obscure. Firstly, the
commands that sometimes show failure have a '*' or splat in them. Bash
will try to convert a path with a splat in it to the list of matching
paths, if there are matches. If there aren't, then the argument seen
by the spawned program will contain a splat. Then the cygpath program
has to properly describe the path that contains the splat. The splat
is not a legal character IN A WINDOWS PATH, but a private character
could be and that's how terminal configuration enters in. Cygpath is
giving the string that would be used to represent the path, and that
string will contain a private use character.

In my testing, the environment has no LC variable set to anything, so
the locale mechanisms are presumably doing their default things. All
my attempts with this got a empty box character at first, if the
asterisk went through. That empty box character is presumably some
private use character that is supposed to substitute for an asterisk.
When I switched mintty's configuration to use Consolas, the
previously-run tests output was rerendered by mintty and the 'bad'
character rendered as a box with a question mark inside.

If I enter cygpath -w /usr/bin/* I get output consisting of all the
files in /usr/bin with their paths converted to Windows form. If I
escape the argument so globbing is not done, I get the strange output.

 cygpath -w '/usr/bin/*'
C:\cygwin\bin\

In the above the ticks around the path prevented the path from being
globbed. It might be considered unexpected though, that the path with
an asterisk would be treated as "The user desired to know what the
windows path to a file would be if it's cygwin path ended with an
asterisk". I think the odds of that user story are vanishingly small
compared to the odds of "What would a Windows path to a wildcard look
like that corresponds to this Cygwin wildcard?" But that's a design
problem.

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


