Commit 9d0d6e1
Cygwin: pipe: Restore blocking mode of read pipe on close()/raw_read()
If a cygwin app is executed from a non-cygwin app and the cygwin
app exits, the read pipe remains in the non-blocking mode because
of the commit fc691d0. Due to this behaviour, the non-cygwin
app cannot read the pipe correctly after that. Similarly, if a
non-cygwin app is executed from a cygwin app and the non-cygwin
app exits, the read pipe remains in the blocking mode. With this
patch, the blocking mode of the read pipe is stored into a variable
was_blocking_read_pipe on set_pipe_non_blocking() when the cygwin
app starts and restored on close(). In addition, the pipe mode is
set to non-blocking mode in raw_read() if the mode is blocking
mode by referring the variable is_blocking_read_pipe as well.
is_blocking_read_pipe is a member of fhandler_pipe class and is set
by set_pipe_non_blocking(), so if other process sets the pipe mode
to blocking mode, the current process cannot know the pipe is
blocking mode. Therefore, is_blocking_read_pipe is also set on the
signal __SIGNONCYGCHLD, which is sent to the process group when
non-cygwin app is started.
Backported-from: c7fe29f (Cygwin: pipe: Restore blocking mode of read pipe on close()/raw_read(), 2024-09-06)
Addresses: git-for-windows/git#5115
Fixes: fc691d0 ("Cygwin: pipe: Make sure to set read pipe non-blocking for cygwin apps.");
Reported-by: isaacag, Johannes Schindelin <[email protected]>
Reviewed-by: Corinna Vinschen <[email protected]>, Ken Brown <[email protected]>
Signed-off-by: Takashi Yano <[email protected]>
Signed-off-by: Johannes Schindelin <[email protected]>1 parent 8854bb4 commit 9d0d6e1
File tree
3 files changed
+45
-8
lines changed- winsup/cygwin
- fhandler
- local_includes
3 files changed
+45
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
57 | 67 | | |
58 | 68 | | |
59 | 69 | | |
| |||
62 | 72 | | |
63 | 73 | | |
64 | 74 | | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
65 | 80 | | |
66 | 81 | | |
67 | 82 | | |
| |||
95 | 110 | | |
96 | 111 | | |
97 | 112 | | |
| 113 | + | |
| 114 | + | |
98 | 115 | | |
99 | 116 | | |
100 | 117 | | |
| |||
289 | 306 | | |
290 | 307 | | |
291 | 308 | | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
292 | 312 | | |
293 | 313 | | |
294 | 314 | | |
| |||
721 | 741 | | |
722 | 742 | | |
723 | 743 | | |
| 744 | + | |
| 745 | + | |
724 | 746 | | |
725 | 747 | | |
726 | 748 | | |
| |||
1377 | 1399 | | |
1378 | 1400 | | |
1379 | 1401 | | |
| 1402 | + | |
1380 | 1403 | | |
1381 | 1404 | | |
1382 | 1405 | | |
| |||
1402 | 1425 | | |
1403 | 1426 | | |
1404 | 1427 | | |
| 1428 | + | |
| 1429 | + | |
| 1430 | + | |
| 1431 | + | |
| 1432 | + | |
| 1433 | + | |
| 1434 | + | |
| 1435 | + | |
| 1436 | + | |
| 1437 | + | |
| 1438 | + | |
| 1439 | + | |
| 1440 | + | |
| 1441 | + | |
| 1442 | + | |
| 1443 | + | |
| 1444 | + | |
| 1445 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1197 | 1197 | | |
1198 | 1198 | | |
1199 | 1199 | | |
| 1200 | + | |
| 1201 | + | |
1200 | 1202 | | |
1201 | 1203 | | |
1202 | 1204 | | |
| |||
1287 | 1289 | | |
1288 | 1290 | | |
1289 | 1291 | | |
| 1292 | + | |
1290 | 1293 | | |
1291 | 1294 | | |
1292 | 1295 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1475 | 1475 | | |
1476 | 1476 | | |
1477 | 1477 | | |
1478 | | - | |
1479 | | - | |
1480 | | - | |
1481 | | - | |
1482 | | - | |
1483 | | - | |
1484 | | - | |
1485 | | - | |
| 1478 | + | |
1486 | 1479 | | |
1487 | 1480 | | |
1488 | 1481 | | |
| |||
0 commit comments