https://bugs.winehq.org/show_bug.cgi?id=37195
--- Comment #2 from Jason Edmeades us@edmeades.me.uk --- All releases... no need for logs, as the sample batch pgm shows the issue.
The issue is simply in programs/cmd/builtins.c, WCMD_if, these lines:
else if (!lstrcmpiW (condition, existW)) { test = (GetFileAttributesW(WCMD_parameter(p, 1+negate, NULL, FALSE, FALSE)) != INVALID_FILE_ATTRIBUTES); WCMD_parameter(p, 2+negate, &command, FALSE, FALSE); }
so we take the parameter to the 'if' and type to find out about it. We probably should do something like (not even compiled!!)
else if (!lstrcmpiW (condition, existW)) { WIN32_FIND_DATAW fd; HANDLE hff; hff = FindFirstFileW(WCMD_parameter(p, 1+negate, NULL, FALSE, FALSE), &fd); test = (hff != INVALID_HANDLE_VALUE) FindClose(hff); WCMD_parameter(p, 2+negate, &command, FALSE, FALSE); }
Feel free to add a test, try this and submit - I dont have Linux to play with at the moment but the problem looks 'obvious'.