X-Recipient: archive-cygwin@delorie.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:to:from:subject:message-id:date:mime-version
	:content-type:content-transfer-encoding; q=dns; s=default; b=QqQ
	XHCHr11hCCsNCVTDdyxNkV3cmMLg56HFhrwdyIK0x7cfvcwwnfnCAXg8ZzzwLwNo
	2LOzFOsKFCalk+wEg5JhrgyLNTxEHVb3twWyYr9lwoIKgLHK/Xai3JORE/bkWDj8
	JUpqYI4VjBFJqSt3HSMx1F7WxHe3Ig9kQN6YcsZ0=
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:to:from:subject:message-id:date:mime-version
	:content-type:content-transfer-encoding; s=default; bh=wFg4QzCzB
	BkWpMWj7Ahm+PsCh5I=; b=KYLl+YtFtr6DBFEgM1FEp15y/KipJnu3HL1UEvqvq
	5qCLLgajNlqoEOWtC0dQ2Tx6RQ0f+1Ntcpn63m+4HsJQzpQVd7Rs1HzXi2hKsjg4
	0r2IMu4Q30NuMZv5iO1prSwqrzdN5eSHLVkN8cHGwZNUXjF30/67kszGkVtudcXy
	VY=
Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe@cygwin.com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin@cygwin.com>
List-Help: <mailto:cygwin-help@cygwin.com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner@cygwin.com
Mail-Followup-To: cygwin@cygwin.com
Delivered-To: mailing list cygwin@cygwin.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=carriage, HX-Envelope-From:sk:michael, struggling, H*r:4.77
X-HELO: atfriesa01.ssi-schaefer.com
To: cygwin@cygwin.com
From: Michael Haubenwallner <michael.haubenwallner@ssi-schaefer.com>
Subject: textmode for stdout, what is "correct" now?
Openpgp: preference=signencrypt
Message-ID: <739ed5ce-6902-d702-e152-65dc2c1da667@ssi-schaefer.com>
Date: Thu, 14 Feb 2019 16:23:21 +0100
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.5.0
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 7bit

Hi,

so I find myself struggling with textmode versus binmode for stdio again.

Running the openssl command (from within the apps/ build directory here) does
yield different results regarding carriage return depending on the version:

$ ./apps/openssl version
OpenSSL 1.0.2p  14 Aug 2018
$ ./apps/openssl x509 -hash -noout -in /etc/pki/tls/cert.pem | xxd
00000000: 6139 3464 3039 6535 0a                   a94d09e5.


$ ./apps/openssl version
OpenSSL 1.1.0j  20 Nov 2018
$ ./apps/openssl x509 -hash -noout -in /etc/pki/tls/cert.pem | xxd
00000000: 6139 3464 3039 6535 0d0a                 a94d09e5..

Some subsequent shell script does create wrong symlink filenames
(with embedded CR) when used with openssl-1.1.x.

The commit that changed this behaviour in openssl-1.1 is:
https://github.com/openssl/openssl/commit/bdd58d98467e9f0f6635c1628e1eae304383afb1

From an openssl developer's point of view, I can understand to set
textmode when the intent is to output some text, and to set
binmode when the intent is to output some binary data.

Question now is: These days, what is the correct way to handle this?

Is it up to openssl to not use textmode at all with Cygwin (what if
used from within some cmd.exe?), or is it up to the shell script to
explicitly drop any carriage return here?

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

