https://bugs.winehq.org/show_bug.cgi?id=48891
--- Comment #17 from Damjan Jovanovic damjan.jov@gmail.com --- Created attachment 67113 --> https://bugs.winehq.org/attachment.cgi?id=67113 Hack to disable create_symlink() access checks in wineserver
It's definitely (1) from my prior analysis, NtCreateSymbolicLink() previously failed, then causing NtOpenSymbolicLink() to fail on that link, causing 0 to get returned to the parent process due to a lack of error checking in Cygwin (which should return -1 and set errno).
The reason NtCreateSymbolicLink() fails is that wineserver returns STATUS_ACCESS_DENIED, and the reason that it does that is that the access rights checks between symlink_map_access() and check_object_access() go wrong somewhere. I haven't figured that out yet.
However the attached hack works around that for now, by disabling access checks for symbolic links. It successfully gets fork() to return the right PID to the parent instead of 0, and gets the shell (bash, dash) to remain open after running its first command and able to run many more commands :-).