Hello, I seem to have found a bug in Cygwin's fflush implementation, where fflush(NULL) is unexpectedly flushing stdin.
Working through https://cygwin.com/snapshots/ with the STC below, this behaviour does not appear in the 2017-03-08 snapshot, and 2017-03-10 is the first snapshot in which this does appear, with thanks to Ramsay Jones on the Git mailing list for initially pointing me at the change coming in some time between 2.7.0 and 2.8.0. With thanks to Jeff King on the Git mailing list, here's a simple test case: $ cat a.c #include <stdio.h> int main(void) { char buf[256]; while (fgets(buf, sizeof(buf), stdin)) { fprintf(stdout, "got: %s", buf); fflush(NULL); } return 0; } $ gcc a.c $ seq 10 | ./a.exe got: 1 Compare this to the expected output, which I see on my handy CentOS 6 box: $ seq 10 | ./a.out got: 1 got: 2 got: 3 got: 4 got: 5 got: 6 got: 7 got: 8 got: 9 got: 10 By my reading of Cygwin's fflush(3p), the stdin stream should be unaffected by a fflush(NULL), as it is neither an output stream, an update stream, nor a file capable of seeking. I originally noticed this behaviour due to it causing a failure in one of the Git test scripts. Cheers, Adam -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple