From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from omta002.cacentral1.a.cloudfilter.net (omta002.cacentral1.a.cloudfilter.net [3.97.99.33]) by sourceware.org (Postfix) with ESMTPS id 496B43857BA9 for ; Mon, 20 Jun 2022 19:22:38 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 496B43857BA9 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=SystematicSw.ab.ca Authentication-Results: sourceware.org; spf=none smtp.mailfrom=systematicsw.ab.ca Received: from shw-obgw-4003a.ext.cloudfilter.net ([10.228.9.183]) by cmsmtp with ESMTP id 3MYloyiLfWi4Q3MyLoHgom; Mon, 20 Jun 2022 19:22:05 +0000 Received: from [10.0.0.5] ([184.64.124.72]) by cmsmtp with ESMTP id 3MyqoawEJCg6j3MyroJnpo; Mon, 20 Jun 2022 19:22:37 +0000 X-Authority-Analysis: v=2.4 cv=SMhR6cjH c=1 sm=1 tr=0 ts=62b0c8fd a=oHm12aVswOWz6TMtn9zYKg==:117 a=oHm12aVswOWz6TMtn9zYKg==:17 a=IkcTkHD0fZMA:10 a=94nOnFI1EgyDtX4ev68A:9 a=QEXdDO2ut3YA:10 Message-ID: <3f4a8b91-a53f-201d-45e4-d1f469652b6e@SystematicSw.ab.ca> Date: Mon, 20 Jun 2022 13:22:36 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.10.0 Reply-To: cygwin@cygwin.com Subject: Re: Bug in Control-d handling? Content-Language: en-CA To: cygwin@cygwin.com References: <827e2006-2aae-9f7f-9c3f-eef3a7c6e793@cornell.edu> <20220620175935.924a49feb13156f1a3cf3da4@nifty.ne.jp> <20220620192223.2e0a084a7c093939b1c7c8d6@nifty.ne.jp> From: Brian Inglis Organization: Systematic Software In-Reply-To: <20220620192223.2e0a084a7c093939b1c7c8d6@nifty.ne.jp> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4xfFLyU+xTUlY7De8vbdm1k6i4O74bTvlanKkuhYeEtooCVm4UhTrlbyGbEtKVhG4FfTG89O8PIItH4hqr+GPAj2ecuWBJPNkqxfXzaOq4knIz5LDMLUND xkXKyeV5wodySs7+DI2BlkhG2913qEWvxvgkF/S3WDBrGNEsK2CO61iHU+yB+H23lJ6tP34k7WFpS7Fr8oi2P4yKdAE5K6VyYh4= X-Spam-Status: No, score=-1170.2 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_STATUS, KAM_LAZY_DOMAIN_SECURITY, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, 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@cygwin.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Jun 2022 19:22:40 -0000 On 2022-06-20 04:22, Takashi Yano wrote: > On Mon, 20 Jun 2022 17:59:35 +0900 > Takashi Yano wrote: >> Isn't this a bug of newlib? Try following code. >> >> #include >> >> 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??? The emphasis has shifted over the years from Solaris etc. compatibility when Sparc desktops were ubiquitous (and I switched from DJGPP to Cygwin) to Linux etc. compatibility as PCs displaced RISC boxes. I think ACLs were the last new feature where Solaris was considered vs POSIX. -- Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada This email may be disturbing to some readers as it contains too much technical detail. Reader discretion is advised. [Data in binary units and prefixes, physical quantities in SI.]