public inbox for gentoo-commits@lists.gentoo.org
 help / color / mirror / Atom feed
From: "Michael Haubenwallner" <haubi@gentoo.org>
To: gentoo-commits@lists.gentoo.org
Subject: [gentoo-commits] repo/proj/prefix:master commit in: dev-libs/openssl/files/
Date: Thu, 21 Feb 2019 07:40:38 +0000 (UTC)	[thread overview]
Message-ID: <1550592989.05d897568b21446657001a51660e9a25172474f2.haubi@gentoo> (raw)

commit:     05d897568b21446657001a51660e9a25172474f2
Author:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
AuthorDate: Tue Feb 19 16:16:13 2019 +0000
Commit:     Michael Haubenwallner <haubi <AT> gentoo <DOT> org>
CommitDate: Tue Feb 19 16:16:29 2019 +0000
URL:        https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=05d89756

dev-libs/openssl: update cygwin bin/textmode patch

Package-Manager: Portage-2.3.55.1-prefix, Repoman-2.3.12
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org>

 .../files/openssl-1.1.1a-cygwin-binmode.patch      | 44 +++++++++++++++++-----
 1 file changed, 34 insertions(+), 10 deletions(-)

diff --git a/dev-libs/openssl/files/openssl-1.1.1a-cygwin-binmode.patch b/dev-libs/openssl/files/openssl-1.1.1a-cygwin-binmode.patch
index ce9cc4975c..8e9eacef76 100644
--- a/dev-libs/openssl/files/openssl-1.1.1a-cygwin-binmode.patch
+++ b/dev-libs/openssl/files/openssl-1.1.1a-cygwin-binmode.patch
@@ -2,20 +2,29 @@ For the setmode(O_TEXT), not submitted upstream yet:
 https://cygwin.com/ml/cygwin/2019-02/msg00150.html
 https://cygwin.com/ml/cygwin/2019-02/msg00280.html
 
-For the chmod 644, accepted upstream:
+For the chmod, accepted upstream:
 https://github.com/openssl/openssl/pull/8226
 --- openssl-1.1.1a/crypto/bio/bss_file.c.orig	2019-02-15 19:41:48.605378800 +0100
 +++ openssl-1.1.1a/crypto/bio/bss_file.c	2019-02-15 19:42:53.136709200 +0100
-@@ -254,7 +254,7 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr)
+@@ -253,9 +253,14 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr)
+             }
  #  elif defined(OPENSSL_SYS_WIN32_CYGWIN)
              int fd = fileno((FILE *)ptr);
-             if (num & BIO_FP_TEXT)
+-            if (num & BIO_FP_TEXT)
 -                setmode(fd, O_TEXT);
-+                setmode(fd, 0); /* do not force O_TEXT in Cygwin */
-             else
+-            else
++            if (num & BIO_FP_TEXT) {
++                /* Cygwin prefers text mode with text mounts only,
++                 * so we can force text mode if we do reads only. */
++                if (fcntl(fd, F_GETFL) & O_RDONLY)
++                    setmode(fd, O_TEXT); /* Ignore \r with any read. */
++                else
++                    setmode(fd, 0); /* allow but do not force text mode */
++            } else
                  setmode(fd, O_BINARY);
  #  endif
-@@ -279,11 +279,15 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr)
+         }
+@@ -279,11 +284,21 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr)
              ret = 0;
              break;
          }
@@ -28,13 +37,28 @@ https://github.com/openssl/openssl/pull/8226
 +#  elif defined(OPENSSL_SYS_WIN32_CYGWIN)
 +        if (!(num & BIO_FP_TEXT))
 +            OPENSSL_strlcat(p, "b", sizeof(p));
-+        /* else do not force DOS text mode in Cygwin */
++        else if (!(num & BIO_FP_APPEND) && !(num & BIO_FP_WRITE)) {
++            /* Cygwin prefers text mode with text mounts only,
++             * so we can force text mode if we do reads only.
++             * Unfortunately, the only API to disable binmode
++             * without forcing textmode is setmode(fd, 0). */
++            OPENSSL_strlcat(p, "t", sizeof(p));
++        }
  #  endif
          fp = openssl_fopen(ptr, p);
          if (fp == NULL) {
--- 
-2.19.2
-
+@@ -293,6 +308,11 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr)
+             ret = 0;
+             break;
+         }
++#  if defined(OPENSSL_SYS_WIN32_CYGWIN)
++        if ((num & BIO_FP_TEXT)
++            && ((num & BIO_FP_APPEND) || (num & BIO_FP_WRITE)))
++            setmode(fileno(fp), 0); /* allow but do not force text mode */
++#  endif
+         b->ptr = fp;
+         b->init = 1;
+         BIO_clear_flags(b, BIO_FLAGS_UPLINK); /* we did fopen -> we disengage
 --- openssl-1.1.1a/Configurations/unix-Makefile.tmpl.orig	2019-02-15 19:47:36.464755100 +0100
 +++ openssl-1.1.1a/Configurations/unix-Makefile.tmpl	2019-02-15 19:47:42.605379700 +0100
 @@ -650,7 +650,7 @@


             reply	other threads:[~2019-02-21  7:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-21  7:40 Michael Haubenwallner [this message]
  -- strict thread matches above, loose matches on Subject: below --
2021-01-01 14:46 [gentoo-commits] repo/proj/prefix:master commit in: dev-libs/openssl/files/ Fabian Groffen
2020-12-31 21:53 Fabian Groffen
2020-12-08 23:46 Sam James
2019-02-26  8:24 Michael Haubenwallner
2019-02-18 14:51 Michael Haubenwallner
2016-05-09 15:57 Michael Haubenwallner

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1550592989.05d897568b21446657001a51660e9a25172474f2.haubi@gentoo \
    --to=haubi@gentoo.org \
    --cc=gentoo-commits@lists.gentoo.org \
    --cc=gentoo-dev@lists.gentoo.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox