DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 53E9DrL8941458 Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 53E9DrL8941458 Authentication-Results: delorie.com; dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=nVWUe8qQ X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 827C83858401 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1744622031; bh=+bvIJddhE4122w/lFJA3MrldiUYezQMvWkXrrRsXHWQ=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=nVWUe8qQpAbz/cidTzxXJ6n+TcGcxR756ibIqkagTBXYaqNYr1XeaOUhyqZgN4OtB nJZxeGYQ/fQdhKI52Vyait5CmTvLiFDDQRkMWLG9bmUvLmgPC2x4d2qk8ddaOLeE7b CDgKmiU7z1Ng8aHwmALU0ch7X9vrV8ewaKvBEr20= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 5DAED385840F ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 5DAED385840F ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744621960; cv=none; b=pLw7VNIBvN6vDhx16lguVWei7J2LpG8W7rijdio1s10wgtkVFYOe1syTWH0Hq4t4aaQu9ElZZo/pVHHpZka+MFNKQ5fRflU+7U2WVE6A/RqgarASfKJj64DunqEZn7RrbW8BxGliH3d8Cep8wdiZeA4+84+GzzkwTsN+G7fyk0w= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1744621960; c=relaxed/simple; bh=7QtnAdm0zQ6W8AETtTYCfobHeUKgVpYLayvbrwvrDWY=; h=Date:From:To:Subject:Message-Id:Mime-Version:DKIM-Signature; b=VT/9uB3WO1xqGu1y+c+8OY7awO76RIegJT5GvJSZiRU7E5TRtoU3uaI5+r+l5WQkPHLJjmP7KiErWNsynERM2BwG19PnSYSbW9YtvQqkUowg1uBh9kMNELZxW62WgjZwQchJK5Z00aPJWN9Rfb2SlUl6xADAm/Vxd3EkOs3b2kM= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5DAED385840F Date: Mon, 14 Apr 2025 18:12:35 +0900 To: cygwin AT cygwin DOT com Subject: Re: /dev/null regression in Cygwin 3.6.1 Message-Id: <20250414181235.ec84c66f2bec856c0b4a9f44@nifty.ne.jp> In-Reply-To: <10514352.ICPdZLu4VQ@nimes> References: <10514352 DOT ICPdZLu4VQ AT nimes> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32) Mime-Version: 1.0 X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Takashi Yano via Cygwin Reply-To: Takashi Yano Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Hi Bruno, On Sat, 12 Apr 2025 15:21:12 +0200 Bruno Haible wrote: > Hi, > > In Gnulib, we have a unit test that compiles the program below as a > native Windows program (either with mingw or with MSVC), that exercises > the Gnulib select() function > > > Then it does (in a Cygwin shell): > > rm -f t-select-in.tmp > ./test-select-fd.exe r 0 t-select-in.tmp < /dev/null > cat t-select-in.tmp > > Up to Cygwin 3.6.0, the contents of the file t-select-in.tmp was "1", > like on most other OSes, indicating that the program can read() from > file descriptor 0. > > In Cygwin 3.6.1, the contents of the file t-select-in.tmp is "0", > indicating that read()ing from file descriptor 0 would block. > This is a regression. > > Looking through the commits between 3.6.0 and 3.6.1, the most likely culprit > is commit d750786e7de013b58e2968eeb6a7fd59dcc535c9 . > > Bruno > > > =============================== test-select-fd.c =============================== > #include > > #include > #include > #include > > int > main (int argc, char *argv[]) > { > if (argc == 4) > { > char mode = argv[1][0]; > > if (mode == 'r' || mode == 'w') > { > int fd = atoi (argv[2]); > > if (fd >= 0) > { > const char *result_file_name = argv[3]; > FILE *result_file = fopen (result_file_name, "wb"); > > if (result_file != NULL) > { > fd_set fds; > struct timeval timeout; > int ret; > > FD_ZERO (&fds); > FD_SET (fd, &fds); > timeout.tv_sec = 0; > timeout.tv_usec = 10000; > ret = (mode == 'r' > ? select (fd + 1, &fds, NULL, NULL, &timeout) > : select (fd + 1, NULL, &fds, NULL, &timeout)); > if (ret < 0) > { > perror ("select failed"); > exit (1); > } > if ((ret == 0) != ! FD_ISSET (fd, &fds)) > { > fprintf (stderr, "incorrect return value\n"); > exit (1); > } > fprintf (result_file, "%d\n", ret); > exit (0); > } > } > } > } > fprintf (stderr, "Usage: test-select-fd mode fd result-file-name\n"); > exit (1); > } > ================================================================================ Thanks for the report. I tryied to compile your testcase as mingw binary, but config.h and sys/select.h are missing from mingw. Could you plsese let us know how to compile it? -- Takashi Yano -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple