delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2022/06/20/06:23:02

X-Recipient: archive-cygwin AT delorie DOT com
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6E8A93858C51
Authentication-Results: sourceware.org;
dmarc=fail (p=none dis=none) header.from=nifty.ne.jp
Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=nifty.ne.jp
DKIM-Filter: OpenDKIM Filter v2.10.3 conssluserg-01.nifty.com 25KAMOHA027624
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nifty.ne.jp;
s=dec2015msa; t=1655720544;
bh=EtgTMMAXJqyrhwyI14QYUDogz1aJF9z9fmq5Tg7VeEg=;
h=Date:From:To:Subject:In-Reply-To:References:From;
b=Cx8sUhS7lhzc9G2yIruk8i4du73CLd+d3wJz5D1ArH+8KaSF3Vhx68auWEQLVm8It
X9RTJnmiHnVrkeG6Q76i35yf2RCUPogrTt3lguSMWJLdZPdmqCPuAwIGmNtHRtkrKE
N9ZIQzZ3YmwiXXDW+kZgqzPSU6PErU0OzPSsbz6iEKcY8q9UkN1ISXQNHAHt28O89E
oqe+0ESBi20KUC93hwfjYj/NJGOvlrpOXXutkqqg+fHDkj7FRoyn3kQ8r7BrYxY3M7
sl++cXJ+aBqBI9I9Of5ADofo/5tQ84UsOh1F6UrPLCUYlqV/CnMM94/VaDBLEgJ6BV
dSR9LUAQ8RYeA==
X-Nifty-SrcIP: [119.150.44.95]
Date: Mon, 20 Jun 2022 19:22:23 +0900
From: Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>
To: cygwin AT cygwin DOT com
Subject: Re: Bug in Control-d handling?
Message-Id: <20220620192223.2e0a084a7c093939b1c7c8d6@nifty.ne.jp>
In-Reply-To: <20220620175935.924a49feb13156f1a3cf3da4@nifty.ne.jp>
References: <827e2006-2aae-9f7f-9c3f-eef3a7c6e793 AT cornell DOT edu>
<20220620175935 DOT 924a49feb13156f1a3cf3da4 AT nifty DOT ne DOT jp>
X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.30; i686-pc-mingw32)
Mime-Version: 1.0
X-Spam-Status: No, score=-10.6 required=5.0 tests=BAYES_00, DKIM_SIGNED,
DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, NICE_REPLY_A,
RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP,
T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6
X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on
server2.sourceware.org
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.29
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Unsubscribe: <https://cygwin.com/mailman/options/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=unsubscribe>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
Errors-To: cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com
Sender: "Cygwin" <cygwin-bounces+archive-cygwin=delorie DOT com AT cygwin DOT com>

On Mon, 20 Jun 2022 17:59:35 +0900
Takashi Yano wrote:
> Isn't this a bug of newlib? Try following code.
> 
> #include <stdio.h>
> 
> int main()
> {
> 	printf("%d\n", getchar());
> 	printf("%d\n", feof(stdin));
> 	printf("%d\n", getchar());
> 	return 0;
> }
> 
> If you press Ctrl-D at the first getchar(), the second getchar()
> does not return EOF while it does in linux.
> 
> The following patch seems to resolve the issue.
> 
> diff --git a/newlib/libc/stdio/refill.c b/newlib/libc/stdio/refill.c
> index ccedc7af7..843163b7e 100644
> --- a/newlib/libc/stdio/refill.c
> +++ b/newlib/libc/stdio/refill.c
> @@ -47,11 +47,9 @@ __srefill_r (struct _reent * ptr,
>  
>    fp->_r = 0;			/* largely a convenience for callers */
>  
> -#ifndef __CYGWIN__
>    /* SysV does not make this test; take it out for compatibility */
>    if (fp->_flags & __SEOF)
>      return EOF;
> -#endif
>  
>    /* if not already reading, have to be reading and writing */
>    if ((fp->_flags & __SRD) == 0)
> 
> However, I am not sure what this #ifndef __CYGWIN__ is for.

Ah, I confirmed that System V (Solaris 11.4) behaves like that.
Does cygwin aim for System V compatibility???

-- 
Takashi Yano <takashi DOT yano AT nifty DOT ne DOT jp>

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019