delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2019/02/22/10:54:23

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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; q=dns; s=
default; b=Gul80zw5YMv3QA2mCHgpiFixa3hUaZZN2EcC0SYGDrKOfmtKOCcPB
Sh31zhRf2oVbWBSmKE7I6rpUy0zZBIq97FcOijDMY3Zh2/tJXbrG2p3NMJPSVLOc
HTwmk+IocKbHyH2OMMSXibI9GYJzKUiTkxnRWr7i/nKqVoh9u7O5lI=
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:date:from:to:subject:message-id:reply-to
:references:mime-version:content-type:in-reply-to; s=default;
bh=KjeK0N814AwCbsm0LjHCqJWOTcE=; b=X5EAp4NwcPBh+uDAfkD00FP+z8TZ
bJjt3hPjpykc3gv+vS+fiVHdfTtS+nOl6g+S0YuMDCTuqiH6ih9rRVCfYcxk2Qj/
0rW8aw/CPgephmwQUCCOlRJgH8/WKyjke/fYgT6oxFen2120v/Wp7ZuBU05IgtC4
SGGw8gkgHQkz0nU=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
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=-100.9 required=5.0 tests=BAYES_00,GOOD_FROM_CORINNA_CYGWIN,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 spammy=border, Hx-languages-length:1691, connect, H*F:D*cygwin.com
X-HELO: mout.kundenserver.de
Date: Fri, 22 Feb 2019 16:54:07 +0100
From: Corinna Vinschen <corinna-cygwin AT cygwin DOT com>
To: cygwin AT cygwin DOT com
Subject: Re: A little improvement for setmode(fd, 0)?
Message-ID: <20190222155407.GR4256@calimero.vinschen.de>
Reply-To: cygwin AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
References: <5801c977-ad17-6f6e-39db-ad44d202c172 AT ssi-schaefer DOT com>
MIME-Version: 1.0
In-Reply-To: <5801c977-ad17-6f6e-39db-ad44d202c172@ssi-schaefer.com>
User-Agent: Mutt/1.10.1 (2018-07-13)

--lFRK9w0o3gensELN
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: quoted-printable

On Feb 22 16:43, Michael Haubenwallner wrote:
> Hi Corinna,
>=20
> sorry to be annoying, but I'm still not completely happy with the
> setmode(fd, 0) API yet:
>=20
> Using setmode(fd, 0), beyond "I am aware that not everything is binary",
> an application's point of view when ported to Cygwin is something like:
> "For this (maybe bidirectional) file descriptor, wherever the user does
> connect it to (stream, binary mounted fs, text mounted fs, ...), I do
> *not need* to transfer binary content.  That is, to stay as POSIXy as
> possible, for line breaks I do not want to handle any \r in my text."
>=20
> Hence, read() should not deliver the \r when reading any line break, and
> write(\n) should add the \r only when the target does require that (like
> the file on a text mounted fs).
>=20
> As there is no clean way to ignore \r for reads without forcing \r for
> writes,

This isn't true.  Just link your application with -ltextreadmode

Why is that not sufficient?



> right now a complete-as-possible patch for openssl may look like:
> https://gitweb.gentoo.org/repo/proj/prefix.git/tree/dev-libs/openssl/file=
s/openssl-1.1.1a-cygwin-binmode.patch?id=3D05d897568b21446657001a51660e9a25=
172474f2

My patch has already gone upstream.  It just does not enforce
text mode on write, ever.

> But there still is the difference between readonly and read+write.

O_RDWR is a special case.  In general you never want to have different
read and write modes on the same file, otherwise you're bound to schred
the file to pieces.

Therefore, let's stick to O_BINARY mode by default, and use O_TEXT
only in border case.


Corinna

--=20
Corinna Vinschen
Cygwin Maintainer

--lFRK9w0o3gensELN
Content-Type: application/pgp-signature; name="signature.asc"

-----BEGIN PGP SIGNATURE-----

iQIzBAEBCAAdFiEEoVYPmneWZnwT6kwF9TYGna5ET6AFAlxwGx8ACgkQ9TYGna5E
T6BoSA//TjosCb+VPm8OTkrYZbidVi+uLJHnQyRlB3U9bydFPmElXRl/wdbG+6fN
vPXx5atybESeHDeETb+AydZZtKbmUJXFxMg19qIGIP1rk1q49ADRJCp9Fh7xOFxN
hewOlCoeP6z0fl/C2BV+qkZo4pjuYgYRQZ5PLC+B9u2twphT76kHwLwmIGYbXjX/
b53BXkd3gLQ6UX47K+mHxJgvoIAgMO22gJgUSH9NIaJmtvtsr5vbwZGBgEq5/Lxs
7KF3GSwhIZmf2hHI6iS3AFA46Nfx6a4p66zVUaSCHadvvJhxVN1uOlT0HhqCAdUO
OOnSMNQY9FfXdRE4iUjrNexo7rrNZcufBtGcf3sGRgVHJhirpJCvOKxryjvwX4FW
f/fdPe2k244e8ApJCTH5+xsAqBB4oxn14sSq160sW4OqnzdyDiJaVHVEW+dq003q
4CLtJlKvp6NG29Bmlh2/+vR632E8ozAwMQZvablgMs6j7MGN0+ly1n0fbF4YspMq
Kiq0lHOg4eGP6CQTmETH7AUjviTDfnFaLdAcxB0JxXTpT84/WOEQDGibFf06akrV
HCGaE+/2MM6stbERSXW4szrpHrtlsGRVWpv9GFb5g+ItXi5r5nmb7Km4eME5/pt5
bJCgAjvJXLCpWG4OrnvseclBHY0anUQ/I/odpM76cZ2QdLCjofg=
=fg3c
-----END PGP SIGNATURE-----

--lFRK9w0o3gensELN--

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019