From: Koichi Murase <myoga.murase@gmail.com>
To: cygwin@cygwin.com
Subject: Cygwin 3.3.0: The programs compiled with "-mwindows" cannot read more than one byte from noncanonical mode TTY
Date: Thu, 23 Jan 2020 10:49:00 -0000 [thread overview]
Message-ID: <CAFLRLk_ScCTNBfqR63MNuqDRWc36DGQJXAwoLVK1Zd-JrUycXw@mail.gmail.com> (raw)
In-Reply-To: <20200121114747.d685f0be18276ee1d5002854@nifty.ne.jp>
[-- Attachment #1: Type: text/plain, Size: 1264 bytes --]
2020年1月21日(火) 10:47 Takashi Yano <takashi.yano@nifty.ne.jp>:
> Thanks for the report. I could reproduce the problem under LANG=ja_JP.UTF-8.
> I have almost caught the culprit. Please wait for a while.
Thank you for the patch fixing the problem. I cherry-picked the patch
and tried it, but there is another problem.
Description:
The programs compiled with "-mwindows" cannot read more than one
character from PTY in a non-canonical mode in . There was no
problem before the patch "Cygwin: pty: Fix reopening slave in
push_to_pcon_screenbuffer().".
Repeat-By:
1. Open Cygwin Terminal (mintty)
2. Compile the attached program with the following commands.
$ g++ -o minimal2-con.exe minimal2.cpp
$ g++ -mwindows -o minimal2-win.exe minimal2.cpp
3. The expected behavior can be checked with `minimal2-con'. After
executing the command, please type some five characters. The
string `[RECV]' will be printed five times, and then the program
will exit.
$ ./minimal2-con
[RECV][RECV][RECV][RECV][RECV]
$
4. However, with the compile option "-mwindows", we can only see one
`[RECV]', and the program will hang.
$ ./minimal2-win
[RECV]
Best,
Koichi
[-- Attachment #2: minimal2.cpp --]
[-- Type: text/x-c-code, Size: 740 bytes --]
#include <unistd.h>
#include <termios.h>
int main() {
struct termios oldTermios;
tcgetattr(STDIN_FILENO, &oldTermios);
struct termios termios = oldTermios;
termios.c_lflag &= ~(ECHO | ICANON | IEXTEN | ISIG);
termios.c_iflag &= ~(BRKINT | ICRNL | INPCK | ISTRIP | IXON);
termios.c_cflag &= ~(CSIZE | PARENB);
termios.c_cflag |= CS8;
termios.c_oflag &= ~(OPOST);
termios.c_cc[VMIN] = 1;
termios.c_cc[VTIME] = 0;
tcsetattr(STDIN_FILENO, TCSAFLUSH, &termios);
for (int i = 0; i < 5; i++) {
char c;
int const nread = read(STDIN_FILENO, &c, 1);
write(STDOUT_FILENO, nread > 0 ? "[RECV]" : "[FAIL]", 6);
}
tcsetattr(STDIN_FILENO, TCSAFLUSH, &oldTermios);
write(STDOUT_FILENO, "\n", 1);
return 0;
}
[-- Attachment #3: Type: text/plain, Size: 219 bytes --]
--
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
next prev parent reply other threads:[~2020-01-23 10:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-20 6:13 Cygwin 3.1.2: Every call of exec(2) in the session starts to create a console window after some TTY outputs from programs compiled with "-mwindows" Koichi Murase
2020-01-20 7:17 ` Marco Atzeri
2020-01-21 2:31 ` Koichi Murase
2020-01-21 2:47 ` Takashi Yano
2020-01-23 10:49 ` Koichi Murase [this message]
2020-01-23 11:33 ` Cygwin 3.3.0: The programs compiled with "-mwindows" cannot read more than one byte from noncanonical mode TTY Takashi Yano
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=CAFLRLk_ScCTNBfqR63MNuqDRWc36DGQJXAwoLVK1Zd-JrUycXw@mail.gmail.com \
--to=myoga.murase@gmail.com \
--cc=cygwin@cygwin.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).