X-Recipient: archive-cygwin AT delorie DOT com DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:references:from:to:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; q=dns; s=default; b=wGXTcE4pOMDBCqMG 5tCNxzM1MK6FwHllDL8KcYxox5xWyKVzlypqBYEDqokikwlurwPSA2sjJTzrx7Au lSUI3ucH8OvwcFBPDw/NKXgg5e7QsKS+elHdNSue292F7avwFPC4cg9zgBgb0XIB ezFFpv8d+hHykfiUnZsyJf0fl2o= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id :list-unsubscribe:list-subscribe:list-archive:list-post :list-help:sender:subject:references:from:to:message-id:date :mime-version:in-reply-to:content-type :content-transfer-encoding; s=default; bh=OjxKTTPdBKbXOow4vdQ3Ki IM5jw=; b=sf0hrcwaV/1qszayqtnH5k6Oukz60ynSDXBPditDI6xedQ8qzo/41k CQz+c06ftwY5KiC8dC4CTSggfcPeHsVSKwrpBMUWi07HPKXUL/1p20oAdLoArdQA G0iXis/UL3vNweEONe2n3d+CDLBPZ0HX2+d2PX4waJdOQ0v4/oaNg= Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_PASS autolearn=ham version=3.3.2 spammy=traditionally, HX-Envelope-From:sk:michael, restoring X-HELO: atfriesa01.ssi-schaefer.com Subject: Re: textmode for stdout, what is "correct" now? References: <20190214162002 DOT GA4950 AT calimero DOT vinschen DOT de> <6aa280c2-4769-0772-91d9-c73a3a3d9680 AT ssi-schaefer DOT com> <20190215102251 DOT GA2702 AT calimero DOT vinschen DOT de> <20190215124844 DOT GE2702 AT calimero DOT vinschen DOT de> <6d02258d-115d-135c-1404-1b02eec34045 AT ssi-schaefer DOT com> <20190215203108 DOT GN2702 AT calimero DOT vinschen DOT de> <20190216093855 DOT GR2702 AT calimero DOT vinschen DOT de> <863f060b-9c2f-1c78-30e8-c1486d567f74 AT ssi-schaefer DOT com> <20190216174313 DOT GG4256 AT calimero DOT vinschen DOT de> From: Michael Haubenwallner To: cygwin AT cygwin DOT com Openpgp: preference=signencrypt Message-ID: <380fcd6e-cbe1-ebe4-c13f-a8d911c148ac@ssi-schaefer.com> Date: Mon, 18 Feb 2019 10:40:45 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.1 MIME-Version: 1.0 In-Reply-To: <20190216174313.GG4256@calimero.vinschen.de> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 2/16/19 6:43 PM, Corinna Vinschen wrote: > On Feb 16 18:13, Michael Haubenwallner wrote: >> On 2/16/19 10:38 AM, Corinna Vinschen wrote: >>> setmode(fd, O_BINARY) works on Cygwin. >> >> Well... true. >> >> What I'm trying to say is that restoring the *default* mode is currently >> broken, because traditionally the default mode simply is called "text >> mode" - which is enough for DOS only systems, but confusing in Cygwin. >> >> As for Cygwin the default mode is more complex, we may want to call it >> something like the "Cygwin text mode" instead. Consequently, the mode >> that does force \r should be called the "DOS text mode". >> >> Whether the "Cygwin text mode" is with or without \r depends on some >> other property like the text mount. >> >> However, after setting the "binary mode", libraries like openssl BIO >> want to be able to restore the "non-binary mode" - whatever name it >> may have. So they use the only available API: setmode(fd, O_TEXT). >> And IMO they're right to expect the "Cygwin text mode" on Cygwin. >> >> If they really need the "DOS text mode", they either should handle the >> \r in binary mode - or we provide some new setmode(fd, O_DOSTEXT) API. >> >> In hope to be more clear now, >> /haubi/ > > I really miss the problem you're trying to solve here. Why should an > application setting O_BINARY explicitely revert this decision on the > same file descriptor? That doesn't make sense. Well, it's not necessarily about really switching binary mode on and off, it's more about avoiding breakage when applications try to intuitively follow the original API, even if that actually causes the call to setmode(fd, O_TEXT) to be redundant. OTOH, this question also would apply to native Win32 applications, so why do people call setmode(fd, O_TEXT) with any DOS based platform at all? IMO, unfortunately we're not in a position to modify the intention of the original API. And finally, I do want to stop discussions like this one with application developers like openssl, as soon as we can argue like: "Cygwin does not use \r internally, but does support text mode mounts, so we had to invent the Cygwin text mode, which may or may not use \r. Hence you get the Cygwin text mode with O_TEXT, and if you really are in some 'unix2dos' position, please use the new O_DOSTEXT mode instead." However, agreed this does not seem to be trivial to implement. Yet I will look into it when there is a chance for a patches to be accepted. Thanks! /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