From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 75160 invoked by alias); 10 Feb 2017 23:50:58 -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 75144 invoked by uid 89); 10 Feb 2017 23:50:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=2.9 required=5.0 tests=BAYES_50,KAM_COUK,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=Sam, H*F:U*cygwin, H*r:sk:smtp-ou, ascii X-HELO: smtp-out-2.tiscali.co.uk Received: from smtp-out-2.tiscali.co.uk (HELO smtp-out-2.tiscali.co.uk) (62.24.135.130) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 10 Feb 2017 23:50:48 +0000 Received: from [192.168.15.105] ([88.108.225.212]) by smtp.talktalk.net with SMTP id cKxhcqjHoTrRicKxhcBjvT; Fri, 10 Feb 2017 23:50:46 +0000 Subject: Re: cygpath To: cygwin@cygwin.com References: <91DCAC3CB99C724EB365BB64677FBE7B139A86@MX204CL04.corp.emc.com> <151946397.20170210223617@yandex.ru> <91DCAC3CB99C724EB365BB64677FBE7B139AF9@MX204CL04.corp.emc.com> From: Sam Edge Reply-To: cygwin@cygwin.com Message-ID: Date: Fri, 10 Feb 2017 23:50:00 -0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfGs+3LOuAAZpKJVniH8INIDMHw+pFcRgjh9s+JOtvobjI7KVuqYztHQkxPd/m1PyxzE4N7NkNU9/8+mlpFAreiy6Sp1B4kVait3zFqs+fCZxR8hexu5A MI3GyFcp8ZUPpbs4Mji1XhvYXeCl6IVFRzJqYLwEtvwGIrVU7S2WxqCdps3LY9bFmhtbgkWKCQAFwQ== X-IsSubscribed: yes X-SW-Source: 2017-02/txt/msg00147.txt.bz2 On 10/02/2017 23:17, Eliot Moss wrote: > On 2/10/2017 3:03 PM, Gluszczak, Glenn wrote: >> * is a legal character for ls but perhaps not cygpath? I don't know. >> No files or directories are using * in the name. >> >> Not sure about incorrect terminal settings as I never touched any. >> It shows up in mintty and ssh equally. The characters that appear vary. >> >> Some non-existent paths do *not* produce the gibberish. >> >> %%%cygpath -w /aaa/bbb/* >> C:\cygwin\aaa\bbb\ > > Yes, but I found something interesting when I did this: > > echo "$(cygpath -w /usr/non-existent/*)" > mytemp > > od -c mytemp > > revealed that there is a three-byte sequence after the > output of > > C:\cygwin\usr\non-existent\ > > and before the newline added by echo. I guess it's > some representation of * that does not show up on the > terminal, but it did strike me as a little strange ... > > Regards - EM > > -- > 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 > > Sorry, did anyone actually read Andrey's post? (Hint: Read https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-specialchars again.) The three byte sequence is the UTF-8 representation of U+F02A i.e. ASCII for '*' but in the private use area of Unicode. This is how the Cygwin DLL stores ASCII characters in pathnames that are forbidden in Windows but that are valid in POSIX. The directory entry write functions convert them to private area and the read functions convert them back to Unicode. The cygpath utility therefore does exactly the same on the assumption that the result is going to be passed to Windows programs that are going to manipulate the directory entry in some way - open the file for example. That they display incorrectly is an inevitable side effect of this work-around. Generally, all you need to do is accept the Copenhagen interpretation in your scripts and just calculate. ;-) The only thing you need to be careful of is that if you really mean to pass the glob to your Windows app, you leave it out of the string passed to cygpath e.g. cygstart some-exe "$(cygpath -w "some-posix-path/")"\* instead of cygstart some-exe "$(cygpath -w "some-posix-path/*")" -- Sam Edge -- 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