Thanks for very the detailed bug report.  This should be fixed in
the latest snapshot (when it becomes available).

The plethora of details and your actual honest-to-god test case helped
a great deal in tracking down this problem.  If every bug report was
like this one, then fixing bugs would almost be a pleasure rather than
a chore.

Thanks again,
cgf

On Mon, Oct 01, 2001 at 11:06:52PM +0900, Shun-ichi GOTO wrote:
>Hi, cygwin users/developers
>
>## I'm not ML member, please add Cc: [EMAIL PROTECTED] for this thread.
>
>I'm using latest snapshot and encounted to problem around select() for
>PIPE input.
>
>The problem is:
>  select() onto PIPE input returns immediately as "something exist"
>  on command prompt (cmd.exe) and 4nt.
>
>Try attached test program "pipe-select.c" and examine following two
>case with some version of DLLs.
>
>(1)  pipe-select
>
>(2)  cat - | pipe-select
>
>With good DLL, (1) waits keyboard input by select() and wait...
>When I hit any key, program goes read() and until EOL is start. And repeat.
>(2) waits pipe input by select() and wait.
>When I enter some chars and ENTER, then program goes read().
>Both are good behavior.
>
>With bad DLL, (1) is same to good DLL. But (2) goes read() immediately
>although no data is available in PIPE. 
>
>This problem means asyncronous reading using select() is not work if
>some input handle is PIPE. For example, OpenSSH executed from NTEmacs is
>not work. On this case, ssh.exe goes reading from stdin (PIPE) although
>PIPE is empty and blocks processing input from network.
>
>Described above is phenomena on non cygwin shell (cmd.exe and 4nt.exe).
>On bash, it seems working good. But once hit CTRL-C to stop select(), 
>it hangs. Program cannot terminate select'ing. 
>It's another problem.
>
>
>I checked tests above on command prompt and 4nt.exe on Windows XP and
>Windows 2000 with some cygwin1.dll (ver 1.3.3, snap-20010925,
>snap-20010927, snap-20010929, snap-20011001) and get results bellow.
>
>cygwin1.dll    result
>-----------------------
>1.3.3          good
>snap-20010925  BAD
>snap-20010927  BAD
>snap-20010929  good
>snap-20011001  BAD
>
>
>
>/* pipe-select.c -- test pipe input select()'ing bug. */
>
>#include <stdio.h>
>#include <sys/types.h>
>#include <sys/select.h>
>
>int
>main(int argc, char **argv)
>{
>    int ret;
>    fd_set ifds;
>    
>    if ( isatty(0) ) {
>       puts("stdin is tty");
>    } else {
>       puts("stdin is NOT tty");
>    }
>
>    FD_ZERO(&ifds);
>    FD_SET(0, &ifds);
>    printf("selecting..."); fflush(stdout);
>    ret = select( 1, &ifds, NULL, NULL, NULL);
>    printf("ret=%d, ifds=0x%x\n", ret, *(long*)&ifds);
>    if ( FD_ISSET(0,&ifds) ) {
>       char c;;
>       printf("reading: ");fflush(stdout);
>       read(0, &c, 1);
>       printf("=> '%c'\n", c);
>    }
>    return 0;
>}
>// Local Variables:
>// compile-command: "gcc pipe-select.c -o pipe-select"
>// End:
>
>
>--- Regards,
> Shun-ichi Goto  <[EMAIL PROTECTED]>
>   R&D Group, TAIYO Corp., Tokyo, JAPAN

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/

Reply via email to