From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 124993 invoked by alias); 16 Feb 2019 08:19:47 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 124982 invoked by uid 89); 16 Feb 2019 08:19:46 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_LOW autolearn=ham version=3.3.2 spammy=dos, H*r:encrypted, H*r:qmail-ldap-1.03, family X-HELO: smtpout.aon.at Received: from smtpout.aon.at (HELO smtpout.aon.at) (195.3.96.89) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 16 Feb 2019 08:19:39 +0000 Received: (qmail 21870 invoked from network); 16 Feb 2019 08:19:35 -0000 Received: from 213-33-25-93.adsl.highway.telekom.at (HELO [10.0.0.10]) ([213.33.25.93]) (envelope-sender ) by smarthub84.res.a1.net (qmail-ldap-1.03) with AES256-SHA encrypted SMTP; 16 Feb 2019 08:19:34 -0000 X-A1Mail-Track-Id: 1550305174:21835:smarthub84:213.33.25.93:1 Subject: Re: textmode for stdout, what is "correct" now? References: <739ed5ce-6902-d702-e152-65dc2c1da667@ssi-schaefer.com> <20190214162002.GA4950@calimero.vinschen.de> <6aa280c2-4769-0772-91d9-c73a3a3d9680@ssi-schaefer.com> <20190215102251.GA2702@calimero.vinschen.de> <20190215124844.GE2702@calimero.vinschen.de> <6d02258d-115d-135c-1404-1b02eec34045@ssi-schaefer.com> <20190215203108.GN2702@calimero.vinschen.de> To: cygwin@cygwin.com From: Michael Haubenwallner Message-ID: Date: Sat, 16 Feb 2019 09:39:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0 MIME-Version: 1.0 In-Reply-To: <20190215203108.GN2702@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-SW-Source: 2019-02/txt/msg00221.txt.bz2 On 2/15/19 9:31 PM, Corinna Vinschen wrote: > On Feb 15 19:07, Michael Haubenwallner wrote: >> On 2/15/19 1:48 PM, Corinna Vinschen wrote: >>> On Feb 15 13:03, Michael Haubenwallner wrote: >>>> On 2/15/19 11:22 AM, Corinna Vinschen wrote: >>>>> On Feb 15 08:56, Michael Haubenwallner wrote: >>>>>> On 2/14/19 5:20 PM, Corinna Vinschen wrote: >>>>>>> On Feb 14 16:23, Michael Haubenwallner wrote: >>>>>>>> Hi, >>>>>>>> [SNIP] >>>>>> Down the line in their BIO module they do use setmode(fd, O_TEXT), >>>>>> which is the one that does introduce the \r, as far as I know. >>>>> >>>>> This one is not so nice. Somebody should tell upstream we only >>>>> want explicit O_BINARY these days, but no explicit O_TEXT. >> >> To me it sounds strange to use the one but not the other: >> >> If we don't want O_TEXT at all, isn't O_BINARY obsolete as well, >> so the advise should be to use neither - just like real *nix? > > No, on text mode mounts O_BINARY makes sure that the result is > actually a binary file. > >> A consequence then might be to deprecate (or even remove) them >> from the public API header files. > > As long as we have text mode mounts, no. Ah... So this feels like a semantic confusion around setmode(O_TEXT): For the fopen() API family, POSIX says that conforming platforms should accept (and eventually ignore) the 'b' character in the mode argument. But note that there is no 't' character specified here. So with the fopen() API family, application developers are able to enable or disable binary mode, but are _not_ able to explicitly enable or disable text mode. Unfortunately, the setmode() API is semantically different, because it does not allow to disable binary mode, but to "enable text mode" instead. So with the setmode() API, when application developers want to disable binary mode, their only option is to "enable text mode". Hence, for Cygwin, setmode("enable text mode") should disable binary mode only, rather than switch to DOS text mode at the same time. /haubi/ -- Problem reports: http://cygwin.com/problems.html FAQ: http://cygwin.com/faq/ Documentation: http://cygwin.com/docs.html Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple