The problem is that `select` returns -1 with errno 0, so `perror` says `select: No error`.
Copied from https://github.com/msys2/msys2-runtime/issues/308 as previously website of cygwin is temporary unavailable for me. Original seen in https://github.com/fish-shell/fish-shell/pull/11238/commits/0ad62cea2a9a6606128b182d11b3aac4a62b3b9d in https://github.com/fish-shell/fish-shell/pull/11238 It occurs randomly.  ``` $ fish -c 'ls > /dev/null' select: No error ``` However when using `strace` this occurs more often. The following example uses `strace -f -m syscall,select ./fish -c 'sha256sum fish.exe' &> output.txt`. <details> <summary>Trimmed output</summary> ``` 627 479850 [fish] fish 1628 pselect: pselect (15, 0x7FFD0C690, 0x7FFD0C680, 0x7FFD0C670, 0x0, 0x0) 104 479954 [fish] fish 1628 pselect: to NULL, us -1 770 480724 [fish] fish 1628 select: sel.always_ready 0 3427 484151 [main] fish 1628 write: write(15, 0x7FFFF9E4C, 1) 89 484240 [main] fish 1628 write: 1 = write(15, 0x7FFFF9E4C, 1) 53 484293 [pipesel] fish 1628 peek_pipe: read: pipe:[12884907236], ready for read: avail 1 108 484401 [fish] fish 1628 select_stuff::wait: wait_ret 2, m = 3. verifying 101 484502 [fish] fish 1628 set_bits: me 0xA00046280, testing fd 14 (pipe:[12884907236]) 57 484559 [main] fish 1628 read: read(12, 0x7FFFF5DF8, 16384) nonblocking 155 484714 [fish] fish 1628 set_bits: ready 1 114 484828 [fish] fish 1628 set_bits: me 0xA00045C20, testing fd 12 (pipe:[8589939940]) 117 484945 [fish] fish 1628 set_bits: ready 0 52 484997 [main] fish 1628 read: -1 = read(12, 0x7FFFF5DF8, -1), errno 11 53 485050 [fish] fish 1628 select_stuff::wait: res after verify 0 102 485152 [fish] fish 1628 select_stuff::wait: returning 0 51 485203 [main] fish 1628 close: close(12) 52 485255 [fish] fish 1628 select: sel.wait returns 0 100 485355 [main] fish 1628 fhandler_base::close: closing 'pipe:[8589939940]' handle 0x2F0 49 485404 [main] fish 1628 close: 0 = close(12) 45 485449 [fish] fish 1628 peek_pipe: pipe:[12884907236], already ready for read 52 485501 [main] fish 1628 close: close(13) 51 485552 [fish] fish 1628 set_bits: me 0xA00046280, testing fd 14 (pipe:[12884907236]) 108 485660 [fish] fish 1628 set_bits: ready 1 56 485716 [main] fish 1628 fhandler_base::close: closing 'pipe:[8589939940]' handle 0x2D8 53 485769 [main] fish 1628 close: 0 = close(13) 45 485814 [fish] fish 1628 select_stuff::cleanup: calling cleanup routines 293 486107 [fish] fish 1628 select_stuff::destroy: deleting select records 310 486417 [fish] fish 1628 select_stuff::cleanup: calling cleanup routines 101 486518 [fish] fish 1628 select_stuff::destroy: deleting select records 107 486625 [fish] fish 1628 pselect: -1 = select (15, 0x7FFD0C690, 0x7FFD0C680, 0x7FFD0C670, 0x0), errno 0 select 890 487515 [fish] fish 1628 write: 6 = write(2, 0x100C27640, 6) : 208 487723 [fish] fish 1628 write: 2 = write(2, 0x100C5BA30, 2) No error 206 487929 [fish] fish 1628 write: 8 = write(2, 0x2102D4D35, 8) 197 488126 [fish] fish 1628 write: 1 = write(2, 0x100C5C791, 1) ``` </details> The binary can be compiled using following commands with MSYS2. ``` pacman -S gcc mingw-w64-x86_64-rustup rustup component add rust-src --toolchain nightly-x86_64-pc-windows-gnu cargo +nightly-x86_64-pc-windows-gnu install -Z build-std --target x86_64-pc-cygwin --profile release-with-debug --git https://github.com/fish-shell/fish-shell.git --rev d8e5821 --bin fish ``` Note that [`--rev d8e5821`](https://github.com/fish-shell/fish-shell/commit/d8e5821a3b8f944cb071b98781680f15ba4effd6) is required as workaround is added in https://github.com/fish-shell/fish-shell/commit/4508b5b0db7b012ae2c19f4f7aa9df74ac89ea3c. Commit history is available [here](https://github.com/fish-shell/fish-shell/commits/4508b5b0db7b012ae2c19f4f7aa9df74ac89ea3c/). Code that trigger `perror` is here. https://github.com/fish-shell/fish-shell/blob/d8e5821a3b8f944cb071b98781680f15ba4effd6/src/fd_monitor.rs#L390-L395 ```rust let ret = fds.check_readable(timeout.map(Timeout::Duration).unwrap_or(Timeout::Forever)); if ret < 0 && !matches!(errno().0, libc::EINTR | libc::EBADF) { // Surprising error perror("select"); } ``` -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple