newlib-cygwin/winsup/cygwin/fhandler
Takashi Yano c4fb5da278 Cygwin: pty: Avoid client deadlock when pty master stops to read.
Previsouly, the following commands hangs:
  mintty -e timeout 1 dash -c 'yes aaaaaaaaaaaaaaaaaaaaaaaaa | cat'

The mechanism is as follows.

When the child process (timeout) is terminated, mintty seems to stop
reading pty master even if yes or cat still alive.

If the the pipe used to transfer output from pty slave to pty master
is full due to lack of master reader, WriteFile() to the pipe is
blocked. WriteFile() cannot be canceled by cygwin signal, therefore,
pty slave hangs.

This patch avoids hanging by checking pipe space before calling
WriteFile() and prevents writing data more than space.

Addresses: https://cygwin.com/pipermail/cygwin/2024-June/256178.html
Reported-by: jojelino <jojelino@gmail.com>
Signed-off-by: Takashi Yano <takashi.yano@nifty.ne.jp>
2024-07-01 17:45:00 +09:00
..
base.cc Cygwin: posix_getdents: do not clear attached DIR structure at fork(2) 2024-03-01 15:32:39 +01:00
clipboard.cc Cygwin: clipboard: Only SEEK_SET and SEEK_CUR are supported 2023-08-09 16:56:02 +02:00
console.cc Cygwin: console: Add debug print on thread_sync_event creation error 2024-06-30 08:38:11 +09:00
cygdrive.cc
dev.cc
dev_disk.cc Cygwin: /dev/disk: Append '#N' if the same name appears more than once 2023-11-21 19:40:37 +01:00
dev_fd.cc
disk_file.cc Cygwin: fhandler_base::fstat_by_name: improve debug output. 2024-04-04 18:21:13 +02:00
dsp.cc Cygwin: dsp: Fix incorrect openflags when opening multiple /dev/dsp 2024-06-28 19:54:19 +09:00
fifo.cc Cygwin: accommodate gcc -Og option 2024-02-14 14:00:34 +01:00
floppy.cc
mixer.cc Cygwin: mixer: Fix volume control for no WAVECAPS_LRVOLUME device 2024-06-01 15:23:37 +09:00
mqueue.cc Cygwin: get_posix_access: Make mode_t parameter mandatory 2023-02-09 21:58:44 +01:00
netdrive.cc Cygwin: //: fetch only one item per loop 2024-03-27 21:57:32 +01:00
nodevice.cc
null.cc
pipe.cc Cygwin: pipe: Make sure to set read pipe non-blocking for cygwin apps. 2024-03-12 10:17:40 +09:00
proc.cc Cygwin: fhandler_virtual::exists: always set fileid 2024-04-09 17:02:35 +02:00
process.cc Cygwin: fhandler_virtual::exists: always set fileid 2024-04-09 17:02:35 +02:00
process_fd.cc
procnet.cc Cygwin: fhandler_virtual::exists: always set fileid 2024-04-09 17:02:35 +02:00
procsys.cc Cygwin: get_posix_access: Make mode_t parameter mandatory 2023-02-09 21:58:44 +01:00
procsysvipc.cc Cygwin: fhandler_virtual::exists: always set fileid 2024-04-09 17:02:35 +02:00
pty.cc Cygwin: pty: Avoid client deadlock when pty master stops to read. 2024-07-01 17:45:00 +09:00
random.cc
raw.cc
registry.cc Cygwin: get_posix_access: Make mode_t parameter mandatory 2023-02-09 21:58:44 +01:00
serial.cc Cygwin: globals: make __progname an alias of program_invocation_short_name 2024-01-31 20:11:58 +01:00
signalfd.cc
socket.cc
socket_inet.cc
socket_local.cc
socket_unix.cc
tape.cc
termios.cc Cygwin: termios: Refactor the function is_console_app(). 2023-08-28 18:20:57 +09:00
timerfd.cc
virtual.cc Cygwin: fhandler_virtual: move fileid to path_conv member 2024-04-02 14:43:27 +02:00
windows.cc
zero.cc