public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrey ``Bass'' Shcheglov <andrewbass@gmail.com>
To: cygwin@cygwin.com
Cc: Marco Atzeri <marco.atzeri@gmail.com>
Subject: Re: Escape sequences unprocessed under the "cygwin" terminal
Date: Wed, 12 Oct 2016 18:41:00 -0000	[thread overview]
Message-ID: <57FE25BE.80207@gmail.com> (raw)
In-Reply-To: <14aba7e2-a859-5476-f460-5721e3b9e61d@gmail.com>

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi Marco,

Thank you for your response.

On 12.10.2016 13:32, Marco Atzeri wrote:
> On 12/10/2016 10:36, Andrey ``Bass'' Shcheglov wrote:
>>
>> It works fine under regular Unices, and also under xterm and mintty
>> (in Cygwin), but I'm having trouble running it under the "cygwin"
>> terminal (i. e. bash launched from cmd.exe).
> 
> cmd is not a Cygwin terminal, it is a limited Windows one.
> What is the problem to use mintty ?

There's no problem. I'm just trying to understand the limitations of
cmd.exe (TERM=cygwin). FWIK, bash.exe *can* properly translate ANSI
escape sequences into WinAPI calls. Strangely, the same C program:

> #include <stdio.h>
> 
> int main() {
> 	const char esc = 0x1b;
> 	printf("%c[31;91;1mHello, World!%c[0m\n", esc, esc);
> 	return 0;
> }

behaves correctly with TERM=cygwin when compiled with Cygwin GCC and
linked against cygwin1.dll:

> $ ldd test-ansi-escape.exe
> 	ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7ffeeb450000)
> 	KERNEL32.DLL => /cygdrive/c/Windows/system32/KERNEL32.DLL (0x7ffee92c
0000)
> 	KERNELBASE.dll => /cygdrive/c/Windows/system32/KERNELBASE.dll (0x7ffe
e8700000)
> 	cygwin1.dll => /usr/bin/cygwin1.dll (0x180040000)

and displays garbage like

> ←[31;91;1mHello, World!←[0m

when compiled with MSVC as a native Windows application:

> $ ldd test-ansi-escape.exe
> 	ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x7ffeeb450000)
> 	ntdll.dll => /cygdrive/c/Windows/SYSTEM32/ntdll.dll (0x770a0000)
> 	wow64.dll => /cygdrive/c/Windows/SYSTEM32/wow64.dll (0x76fd0000)
> 	wow64win.dll => /cygdrive/c/Windows/system32/wow64win.dll (0x77020000
)
> 	wow64cpu.dll => /cygdrive/c/Windows/system32/wow64cpu.dll (0x77090000
)
> 	??? => ??? (0x1040000)
> 	KERNEL32.DLL => /cygdrive/c/Windows/SYSTEM32/KERNEL32.DLL (0x76480000
)
> 	??? => ??? (0x1040000)
> 	??? => ??? (0x1040000)
> 	KERNEL32.DLL => /cygdrive/c/Windows/SYSTEM32/KERNEL32.DLL (0x76480000
)
> 	KERNELBASE.dll => /cygdrive/c/Windows/SYSTEM32/KERNELBASE.dll (0x74b4
0000)
> 	MSVCR120D.dll => /cygdrive/c/Windows/SYSTEM32/MSVCR120D.dll (0x62b900
00)

>> Also, if I log in to my Windows box using SSH (i. e. replace the loca
l
>> connection with the remote one, but retain the same |"cygwin|"
>> terminal), again, escape sequences are processed just fine.
> 
> from Unix ? The terminal on that side is able to properly manage
> escape sequence

No, from Windows. I mean, I'm doing "ssh.exe localhost" (the process
hierarchy being cmd.exe -> bash.exe -> ssh.exe -> bash.exe) -- and
everything is working again!

> use mintty.
> It is the recommended one for cygwin

I understand mintty is superior feature-wise compared to cmd.exe, and
xterm is superior to both mintty and cmd.exe -- just like I said, I'm
trying to understand the limitations of cmd.exe (TERM=cygwin).

Regards,
Andrey.
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iEYEARECAAYFAlf+Jb4ACgkQFX2weoTrDGcDjQCeLfk7Nxeg/SGHZEEa2sPuhWli
MrsAn3rGf/9tcTPD1iAFjFMJYHGjR2fC
=cCH2
-----END PGP SIGNATURE-----

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

  reply	other threads:[~2016-10-12 12:00 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-12 10:32 Andrey ``Bass'' Shcheglov
2016-10-12 10:59 ` Marco Atzeri
2016-10-12 18:41   ` Andrey ``Bass'' Shcheglov [this message]
2016-10-12 18:46     ` Thomas Wolff

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=57FE25BE.80207@gmail.com \
    --to=andrewbass@gmail.com \
    --cc=cygwin@cygwin.com \
    --cc=marco.atzeri@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).