On Fri Jul 18 13:34:59 2025 +0000, eric pouech wrote:
thanks for the small repro yes, look like native `find` bails out when some std handles are invalid (tried with a large file to search into, and it returns immediately). I tend to agree that if could avoid to redirect find's input; that would be nice one option that we could consider is to pass as stdin the handle to a file filled with '\n' and check at the end of test if file position hasn't changed (that would detect rogue read operations that should be set inside the tests) and giving test writer some insight of what happens). hoping that find doesn't actually read from it.
you'd hope so, but that'd be too easy, wouldn't it ```c #include <windows.h> #include <stdio.h>
int main(int argc, char** argv) { SECURITY_ATTRIBUTES sa = { sizeof(sa), 0, TRUE }; STARTUPINFOA si = { sizeof(si) }; PROCESS_INFORMATION pi; HANDLE random_file = CreateFileA("C:\Windows\win.ini", GENERIC_READ, FILE_SHARE_WRITE|FILE_SHARE_READ, &sa, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); DWORD dummy; SetFilePointer(random_file, 1, NULL, FILE_BEGIN); si.dwFlags = STARTF_USESTDHANDLES; si.hStdInput = random_file; si.hStdOutput = GetStdHandle(STD_OUTPUT_HANDLE); si.hStdError = GetStdHandle(STD_OUTPUT_HANDLE); CreateProcessA(NULL, "find.exe "aaa" file-that-doesnt-exist.txt", NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi); WaitForSingleObject(pi.hProcess, INFINITE); printf("fp=%lu\n", SetFilePointer(random_file, 0, NULL, FILE_CURRENT)); return 0; } ``` wine - fp=1 of course native - fp=92
oh well, twas worth trying, would've been an improvement if it worked