newlib-cygwin/winsup/cygwin
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
..
DevDocs Cygwin: testsuite: Add x86_64 code to "dynamically load cygwin" test 2022-08-29 17:53:48 +01:00
fhandler Cygwin: pty: Avoid client deadlock when pty master stops to read. 2024-07-01 17:45:00 +09:00
include Cygwin: FS_IOC_[GS]ETFLAGS: handle pinned and unpinned attributes 2024-03-08 21:54:58 +01:00
lib Cygwin: drop __stdcall usage 2022-08-04 20:54:09 +02:00
libc Cygwin: strptime: fix am/pm handling 2024-02-21 19:54:20 +01:00
linux-locale-helpers Cygwin: replace all `fgrep' with `grep -F' 2024-01-18 10:53:25 +01:00
local_includes Cygwin: dsp: Fix incorrect openflags when opening multiple /dev/dsp 2024-06-28 19:54:19 +09:00
math Cygwin: fix return value of ilogbl(NaN) 2023-04-18 13:43:06 +02:00
mm Cygwin: cygheap: compute bucket instead of looping over it 2024-03-01 22:35:22 +01:00
regex Cygwin: regex: fix faulty check for valid range expression 2023-03-20 12:58:03 +01:00
release Cygwin: pty: Avoid client deadlock when pty master stops to read. 2024-07-01 17:45:00 +09:00
scripts Cygwin: globals: make __progname an alias of program_invocation_short_name 2024-01-31 20:11:58 +01:00
sec Cygwin: (mostly) drop NT4 and Samba < 3.0 support 2024-03-20 12:31:50 +01:00
tzcode Cygwin: move EXPORT_ALIAS expressions to end of source 2024-03-07 21:50:07 +01:00
x86_64 Cygwin: x86_64: import swab.S from NetBSD 2022-12-20 10:19:23 +01:00
Makefile.am Cygwin: Add /dev/disk/by-id symlinks 2023-11-05 17:01:43 +01:00
advapi32.cc Cygwin: drop all usages of WINAPI 2022-08-04 22:13:59 +02:00
aio.cc Cygwin: fix build failure due to redefinition of __restrict in sys/cdefs.h 2023-08-07 16:04:32 +02:00
assert.cc
autoload.cc Cygwin: mixer: Fix volume control for no WAVECAPS_LRVOLUME device 2024-06-01 15:23:37 +09:00
automode.c
binmode.c
clock.cc Cygwin: drop wincap::has_precise_system_time 2022-12-04 14:01:41 +01:00
config.h.in
create_posix_thread.cc Cygwin: add memory_layout.h 2022-10-28 16:26:53 +02:00
crt0.c Cygwin: drop 32 bit considerations in crt0 code 2022-05-16 18:17:06 +02:00
ctype.cc Cygwin: fully support KOI8-T codeset 2023-02-25 16:12:51 +01:00
cxx.cc
cygthread.cc Cygwin: drop all usages of WINAPI 2022-08-04 22:13:59 +02:00
cygtls.cc Cygwin: tls_pathbuf: Use Windows heap 2022-08-23 12:09:44 +02:00
cygwait.cc
cygwin.din Cygwin: timespec_get: implement C11 function 2024-02-16 20:44:31 +01:00
cygwin.ldif
cygwin.sc.in Cygwin: drop objcopy .gnu_debuglink juggle 2022-10-28 16:26:53 +02:00
cygxdr.cc
dcrt0.cc Cygwin: globify: read full 32 bit character 2024-04-09 22:30:03 +02:00
debug.cc Cygwin: debugging: convert muto to SRWLOCK 2022-08-22 14:38:49 +02:00
devices.cc Cygwin: console: Fix a bug that 64th console cannot be handled. 2024-02-16 04:06:01 +09:00
devices.in Cygwin: console: Fix a bug that 64th console cannot be handled. 2024-02-16 04:06:01 +09:00
dir.cc Cygwin: opendir(3): move ENOTDIR check into main function 2024-03-20 12:34:51 +01:00
dlfcn.cc Cygwin: remove miscellaneous 32-bit code 2022-05-29 17:54:32 -04:00
dll_init.cc Cygwin: redefine how to recognize forkee state 2024-01-29 13:33:05 +01:00
dtable.cc Cygwin: Add /dev/disk/by-id symlinks 2023-11-05 17:01:43 +01:00
environ.cc Cygwin: reorder list of CYGWIN env var options alphabetically again 2024-02-03 19:54:50 +01:00
errno.cc Cygwin: set ENOSHARE and ECASECLASH _sys_errlist[] entries to empty 2024-02-28 09:59:07 +01:00
exceptions.cc Cygwin: suppress a warning generated with w32api >= 12.0.0 2024-06-16 15:30:34 +01:00
exec.cc Cygwin: move EXPORT_ALIAS expressions to end of source 2024-03-07 21:50:07 +01:00
external.cc Cygwin: CW_CMDLINE_ALLOC: fix a pontentially undefined return value 2024-02-01 13:34:52 +01:00
fcntl.cc Cygwin: simplify some function names 2022-05-29 17:45:52 -04:00
fenv.c
flock.cc Cygwin: flock: drop checking for artificial console handles 2022-12-04 14:01:41 +01:00
fork.cc Cygwin: redefine how to recognize forkee state 2024-01-29 13:33:05 +01:00
forkable.cc Cygwin: unlink_nt: declare in winsup.h 2023-09-08 22:34:52 +02:00
gcrt0.c Revert "sys/types.h: Don't include sys/_stdint.h" 2022-05-04 15:08:44 +02:00
glob.cc Revert "Cygwin: glob: perform ignore_case_with_glob on input" 2024-03-18 11:10:13 +01:00
glob_pattern_p.cc
globals.cc Cygwin: Do not show Error dialogs by default 2024-02-03 19:54:50 +01:00
gmon.c
grp.cc Cygwin: getgrent: don't skip SAM-only builtin-accounts 2024-03-11 12:46:50 +01:00
hookapi.cc Cygwin: Fix previous attempt to drop i386 targets from hookapi 2022-07-28 16:38:01 +02:00
init.cc Cygwin: drop all usages of WINAPI 2022-08-04 22:13:59 +02:00
ioctl.cc
ipc.cc Cygwin: simplify some function names 2022-05-29 17:45:52 -04:00
kernel32.cc Cygwin: cygwin_GetCommandLineW/A: don't rely on __argv[0] content 2024-01-31 20:11:58 +01:00
ldap.cc Cygwin: drop all usages of WINAPI 2022-08-04 22:13:59 +02:00
libstdcxx_wrapper.cc Cygwin: remove miscellaneous 32-bit code 2022-05-29 17:54:32 -04:00
loadavg.cc
lsearch.cc
mcount.c
miscfuncs.cc Cygwin: rename CygwinCreateThread to create_posix_thread 2022-08-10 18:06:28 +02:00
mktemp.cc Cygwin: simplify some function names 2022-05-29 17:45:52 -04:00
mount.cc Cygwin: check remote drives for being SSDs as well 2024-01-08 11:45:13 +01:00
msg.cc
net.cc Cygwin: net: Make if_nametoindex, etc. consistent with if_nameindex. 2024-02-03 23:47:44 +09:00
netdb.cc
nfs.cc
nlsfuncs.cc Cygwin: locales: drop unused has_modifier macro 2023-04-24 22:41:41 +02:00
ntea.cc Cygwin: use new XATTR_{NAME,SIZE}_MAX instead of MAX_EA_{NAME,VALUE}_LEN 2023-06-16 21:44:41 +02:00
passwd.cc Cygwin: getgrent/getpwent: avoid local enumeration on DCs 2024-02-20 23:55:51 +01:00
path.cc Cygwin: FILE_OPEN_NO_RECALL is incompatible with FILE_DIRECTORY_FILE 2024-04-04 18:21:13 +02:00
pinfo.cc Cygwin: implement setproctitle 2024-01-31 20:11:58 +01:00
poll.cc Cygwin: poll: Fix a bug on inquiring same fd with different events. 2022-06-27 10:54:24 +09:00
posix_ipc.cc Cygwin: move POSIX semaphore API functions to posix_ipc.cc 2022-08-10 18:11:57 +02:00
posix_timer.cc Cygwin: posix_timer: fix formatting 2022-08-22 14:53:30 +02:00
profil.c Cygwin: drop all usages of WINAPI 2022-08-04 22:13:59 +02:00
pseudo-reloc.cc Cygwin: drop macro and code for CYGWIN_VERSION_USE_PSEUDO_RELOC_IN_DLL 2022-08-03 16:01:29 +02:00
quotactl.cc
random.cc Cygwin: move EXPORT_ALIAS expressions to end of source 2024-03-07 21:50:07 +01:00
registry.cc
resource.cc Cygwin: fix a few comments mentioning Windows 7 or 8 2022-12-04 14:01:41 +01:00
scandir.cc
sched.cc Cygwin: move EXPORT_ALIAS expressions to end of source 2024-03-07 21:50:07 +01:00
select.cc Cygwin: dsp: Improve response time of select()/poll(). 2023-09-07 17:36:04 +09:00
sem.cc
setlsapwd.cc
shm.cc Cygwin: shm: Convert muto into SRWLOCK and avoid overlocking 2022-08-22 14:28:11 +02:00
signal.cc Cygwin: remove regparm.h 2022-05-29 17:45:52 -04:00
sigproc.cc Cygwin: /proc/<PID>/status: avoid crash computing signal info 2023-01-10 11:48:02 +01:00
smallprint.cc Cygwin: smallprint.cc: Drop HEAP_ZERO_MEMORY 2022-08-22 17:58:53 +02:00
spawn.cc Cygwin: pipe: Make sure to set read pipe non-blocking for cygwin apps. 2024-03-12 10:17:40 +09:00
strace.cc Cygwin: globals: make __progname an alias of program_invocation_short_name 2024-01-31 20:11:58 +01:00
strfuncs.cc Cygwin: cXXrtomb, mbrtcXX: use function-specific internal state 2023-08-15 22:34:29 +02:00
strsep.cc
strsig.cc Cygwin: signals: drop accidental spaces from real-time signal names 2023-03-15 21:44:52 +01:00
sync.cc
syscalls.cc Cygwin: move EXPORT_ALIAS expressions to end of source 2024-03-07 21:50:07 +01:00
sysconf.cc Cygwin: execve: drop argument size limit 2023-08-29 14:17:04 +02:00
syslog.cc
termios.cc Cygwin: drop macro and code for CYGWIN_VERSION_DLL_IS_OLD_TERMIOS 2022-08-03 15:35:29 +02:00
textmode.c
textreadmode.c
thread.cc Cygwin: pthread: Fix a race issue introduced by the commit 2c5433e5da 2024-06-02 23:18:29 +09:00
timerfd.cc Cygwin: drop all usages of WINAPI 2022-08-04 22:13:59 +02:00
times.cc Cygwin: move EXPORT_ALIAS expressions to end of source 2024-03-07 21:50:07 +01:00
tls_pbuf.cc Cygwin: tls_pathbuf: Use Windows heap 2022-08-23 12:09:44 +02:00
tty.cc Cygwin: accommodate gcc -Og option 2024-02-14 14:00:34 +01:00
uinfo.cc Cygwin: (mostly) drop NT4 and Samba < 3.0 support 2024-03-20 12:31:50 +01:00
uname.cc Cygwin: uname: fix building in non-git source dir 2022-12-07 22:22:38 +01:00
wait.cc
wincap.cc wincap.cc: set wincap member has_user_shstk true for 2004+ 2023-06-20 10:06:56 +02:00
window.cc Cygwin: drop all usages of WINAPI 2022-08-04 22:13:59 +02:00
winf.cc
winver.rc