WSL icon indicating copy to clipboard operation
WSL copied to clipboard

zero-length read() should return immediately

Open ericeil opened this issue 10 years ago • 2 comments

tested on rs_preview build 14905.

Run the following C++ program:

#include <unistd.h>

int main(void)
{
  int fds[2];
  pipe(fds);

  char buf[0];
  read(fds[0], buf, 0);

  return 0;
}

On "real" Linux, this returns immediately. On Windows, it hangs indefinitely.

Found this by running the .NET Core System.IO.Pipes tests; we have a test case that expects a zero-length read from an empty pipe to return immediately.

ericeil avatar Aug 23 '16 21:08 ericeil

@ericeil - Thanks for reporting the issue and providing simple repro steps. I have logged a bug internally to track it.

sunilmut avatar Aug 24 '16 19:08 sunilmut

Looks like @sunilmut's fix went out a few releases ago here. Marking this one as fixed and closing.

russalex avatar Nov 16 '16 22:11 russalex