DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 53ED4k351013576
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 53ED4k351013576
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=JHmFvTIo
X-Recipient: archive-cygwin@delorie.com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 814273858294
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
	s=default; t=1744635884;
	bh=smAey4Hsi9txhuIbwhI8i4BA9R0qvH+QS2WEjS4mFnk=;
	h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe:
	 List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:
	 From;
	b=JHmFvTIo1h2FyWkAQH5Qak7xhlPufVWJfILSUnq6tiqqn9PuKpp2PEzWIZTYoeScL
	 I1l8D/qxXiTD7EifLhMPJ+IpuzSrahXJYIDzfZNVOVaVaq8eQ9P/73rzU5/i0EM814
	 ft5PmTplm0uHE6oKu9/ql+wFtH7CcJDIGl0kUifM=
X-Original-To: cygwin@cygwin.com
Delivered-To: cygwin@cygwin.com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org D2D513858C54
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org D2D513858C54
ARC-Seal: i=2; a=rsa-sha256; d=sourceware.org; s=key; t=1744635804; cv=pass;
 b=n6WiltB1bfYhRYj8q0rSozhPZn2aKlngB1qM8HoyjRKTe7ps5FzIC7LRdLFJJ0bHEYmJpVjLfs3sUhmOlnoWDbxSXb80u93qHQ9YY9Vi8tjSghaORMv+p9zt98PdIT+PZaovM0/OHkusnYnhzXTo5kbY/Hz7BhvG6H7F/cibv98=
ARC-Message-Signature: i=2; a=rsa-sha256; d=sourceware.org; s=key;
 t=1744635804; c=relaxed/simple;
 bh=0qzCWOIVPVZ7cBWsmzGKdB/FxxHSXq7x9sDvLkaZSRo=;
 h=DKIM-Signature:DKIM-Signature:From:To:Subject:Date:Message-ID:
 MIME-Version;
 b=GRIdDR02yBjtcqn+cf9TRFYaK1aHeptj6tzFbHywuw2Z9qGFNdJBt+7eFIbURSO2S7BS6zOR+BPuIty7wE5fmaYr7Hzn9c3Iu3WHWUH4GbtMwgKmh6J71Dz5lRCKPO+Kf8hdzbvk72BZvSw2tTKDGzL41GctEzmiDwyWFdruMJc=
ARC-Authentication-Results: i=2; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D2D513858C54
ARC-Seal: i=1; a=rsa-sha256; t=1744635797; cv=none;
 d=strato.com; s=strato-dkim-0002;
 b=hkebMaey379yo0JTF1jQbeFqpvFrMZochFZPTgVPRwQDNbOH6bhhwsbHrgZSropxxA
 sgQ0jMJZZwxV0Ys4qn+VHEyQlyq1KYkI672vYYVzlbqLUBG/KRwbYOiQ8ZTmVbN5A1kz
 1qoNNknND2S22kPiv3Oij1SNuUUXEp9tiHZfb7oMpNGNgeldSh+w/durRj8bf8CSCJJ8
 qBKx03Bo71o6sVGkfIQNVv0YslzfO5mXbmd58hj4xklS+j5Rc16JxUCRyQYfA9QMl5AM
 e4NfxuthZ5D13yZEH1SsxC/97z9R7RylHaPZ+UUNB74Sz612JzzR2W470K+ce/p7F2fc
 BW8Q==
ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; t=1744635797;
 s=strato-dkim-0002; d=strato.com;
 h=References:In-Reply-To:Message-ID:Date:Subject:To:From:Cc:Date:From:
 Subject:Sender;
 bh=KhovDROJTLYuFs1MCqE3c9BmeKF0qnuYIfHEvSo0FJ4=;
 b=J9ClASkGCa5MQPABHEDnYJn/sLO+PlqkxHVsH3HuAKIx6OJxmo9ceZeFKKPpBuVsJd
 l1dfAfSrjVNruBVcSkBUPbt5ElxHC+sgaYzqEAZpV+lCkXK/5M/DCK9XdLCEg5wSrIua
 y7JNhgetsZKX9lRea2F3XoJjLibf0FSxGq6i0CUcssqipoPm91lN6ifo4Z9yBlbfFd5K
 hJlBdodN8qMvqWjeXVeQ4Si8/IC8AhxLyddYuDRGZg/AUaKaMlbb1niMKogX+4b39w1p
 VszZo/hVJHC5WK4BtmBE7PwT8Ash31Y7qX2OJmUV+JN5k5pFr8UbnYbcfHg/JLwpesBR
 KZag==
ARC-Authentication-Results: i=1; strato.com;
    arc=none;
    dkim=none
X-RZG-CLASS-ID: mo00
X-RZG-AUTH: ":Ln4Re0+Ic/6oZXR1YgKryK8brlshOcZlLnY4jECd2hdUURIbZgL8PX2QiTuZ3cdB8X/nqjyeQWgTykym9krgJRUloeYKsg4="
To: cygwin@cygwin.com, Takashi Yano <takashi.yano@nifty.ne.jp>
Subject: Re: /dev/null regression in Cygwin 3.6.1
Date: Mon, 14 Apr 2025 15:03:16 +0200
Message-ID: <19390375.kOAnuia59f@nimes>
Organization: GNU
In-Reply-To: <10514352.ICPdZLu4VQ@nimes>
References: <10514352.ICPdZLu4VQ@nimes>
MIME-Version: 1.0
X-BeenThere: cygwin@cygwin.com
X-Mailman-Version: 2.1.30
Precedence: list
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-request@cygwin.com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
 <mailto:cygwin-request@cygwin.com?subject=subscribe>
From: Bruno Haible via Cygwin <cygwin@cygwin.com>
Reply-To: Bruno Haible <bruno@clisp.org>
Content-Type: text/plain; charset="us-ascii"
Content-Transfer-Encoding: 7bit
Errors-To: cygwin-bounces~archive-cygwin=delorie.com@cygwin.com
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie.com@cygwin.com>

Here's a smaller reproducer.

============================ foo.c ============================
#include <stdio.h>
#include <windows.h>
#include <io.h>

int main ()
{
  HANDLE h = (HANDLE) _get_osfhandle (0);
  fprintf (stderr, "h = 0x%08x\n", h);
  fprintf (stderr, "FileType is CHAR ? %d\n", GetFileType (h) == FILE_TYPE_CHAR);
  int ret = WaitForSingleObject (h, 0);
  if (ret == WAIT_OBJECT_0)
    fprintf (stderr, "WaitForSingleObject -> WAIT_OBJECT_0\n");
  else if (ret == WAIT_TIMEOUT)
    fprintf (stderr, "WaitForSingleObject -> WAIT_TIMEOUT\n");
  else if (ret == WAIT_ABANDONED)
    fprintf (stderr, "WaitForSingleObject -> WAIT_ABANDONED\n");
  else if (ret == WAIT_FAILED)
    fprintf (stderr, "WaitForSingleObject -> WAIT_FAILED\n");
}
===============================================================
Compile this file as a native Windows program (mingw for example).
Then, in a Cygwin shell window, do
$ ./a < /dev/null

Result in 3.4.6:

h = 0x000001e8
FileType is CHAR ? 1
WaitForSingleObject -> WAIT_OBJECT_0

Result in 3.6.1:

h = 0x00000358
FileType is CHAR ? 1
WaitForSingleObject -> WAIT_TIMEOUT

> Looking through the commits between 3.6.0 and 3.6.1, the most likely culprit
> is commit d750786e7de013b58e2968eeb6a7fd59dcc535c9 .

Especially since this commit modified select.cc, removing a comment
  /* TODO: Buffer really full or non-Cygwin reader? */
and here we are exactly in that case: a non-Cygwin process reading from
Cygwin's /dev/null.

Takashi Yano, can you please look at it and restore the previous behaviour?

Bruno




-- 
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
