textmode for stdout, what is "correct" now?
Corinna Vinschen
corinna-cygwin@cygwin.com
Fri Feb 15 12:49:00 GMT 2019
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.
>
> Is this correct even for situations where the cygwin1.dll is used
> outside the Cygwin distribution, like git-bash, MSYS or similar,
This is OpenSSL, not the Cygwin DLL.
> where cygwin-based executables eventually are used from within some
> CMD or PowerShell script? Or should they use unix2dos/dos2unix then?
Only if the \r is really required. Typically it isn't.
> OTOH, would it make sense to ignore the O_TEXT flag in cygwin1.dll?
That's an interesting idea. The O_TEXT flag is already ignored in a lot
of cases, e.g. for pipes. Only when opening files does it have an
effect, mostly. I'm not sure we should really switch it off. Maybe we
can consider a CYGWIN env var setting at one point.
> >> The backtrace in openssl-1.1.1a in this use case is:
> >> [...]
> >>>> Question now is: These days, what is the correct way to handle this?
> >
> > Telling upstream not to use O_TEXT on Cygwin in the first place, I think.
>
> I can do that, but if I were an upstream developer I would ask questions
> like above...
I sent a patch upstream and questions got asked. But this is not
a native openssl lib, this is *Cygwin's* openssl lib, and it should
behave like a Cygwin lib.
> > For scripting, d2u should help.
>
> Plus, to be portable: type d2u >/dev/null 2>&1 || d2u() { cat; }
For portability, use `dos2unix'. It's packed with most (all?) Linux
distros.
Corinna
--
Corinna Vinschen
Cygwin Maintainer
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://cygwin.com/pipermail/cygwin/attachments/20190215/c1bb04b3/attachment.sig>
More information about the Cygwin
mailing list