Sam Edge
Fri Feb 10 23:50:00 GMT 2017

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:
> FAQ:         
> Documentation:
> Unsubscribe info:
Sorry, did anyone actually read Andrey's post?

(Hint: Read

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

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:
Unsubscribe info:

More information about the Cygwin mailing list