1 |
commit: 05d897568b21446657001a51660e9a25172474f2 |
2 |
Author: Michael Haubenwallner <haubi <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 19 16:16:13 2019 +0000 |
4 |
Commit: Michael Haubenwallner <haubi <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 19 16:16:29 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/proj/prefix.git/commit/?id=05d89756 |
7 |
|
8 |
dev-libs/openssl: update cygwin bin/textmode patch |
9 |
|
10 |
Package-Manager: Portage-2.3.55.1-prefix, Repoman-2.3.12 |
11 |
Signed-off-by: Michael Haubenwallner <haubi <AT> gentoo.org> |
12 |
|
13 |
.../files/openssl-1.1.1a-cygwin-binmode.patch | 44 +++++++++++++++++----- |
14 |
1 file changed, 34 insertions(+), 10 deletions(-) |
15 |
|
16 |
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 |
17 |
index ce9cc4975c..8e9eacef76 100644 |
18 |
--- a/dev-libs/openssl/files/openssl-1.1.1a-cygwin-binmode.patch |
19 |
+++ b/dev-libs/openssl/files/openssl-1.1.1a-cygwin-binmode.patch |
20 |
@@ -2,20 +2,29 @@ For the setmode(O_TEXT), not submitted upstream yet: |
21 |
https://cygwin.com/ml/cygwin/2019-02/msg00150.html |
22 |
https://cygwin.com/ml/cygwin/2019-02/msg00280.html |
23 |
|
24 |
-For the chmod 644, accepted upstream: |
25 |
+For the chmod, accepted upstream: |
26 |
https://github.com/openssl/openssl/pull/8226 |
27 |
--- openssl-1.1.1a/crypto/bio/bss_file.c.orig 2019-02-15 19:41:48.605378800 +0100 |
28 |
+++ openssl-1.1.1a/crypto/bio/bss_file.c 2019-02-15 19:42:53.136709200 +0100 |
29 |
-@@ -254,7 +254,7 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) |
30 |
+@@ -253,9 +253,14 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) |
31 |
+ } |
32 |
# elif defined(OPENSSL_SYS_WIN32_CYGWIN) |
33 |
int fd = fileno((FILE *)ptr); |
34 |
- if (num & BIO_FP_TEXT) |
35 |
+- if (num & BIO_FP_TEXT) |
36 |
- setmode(fd, O_TEXT); |
37 |
-+ setmode(fd, 0); /* do not force O_TEXT in Cygwin */ |
38 |
- else |
39 |
+- else |
40 |
++ if (num & BIO_FP_TEXT) { |
41 |
++ /* Cygwin prefers text mode with text mounts only, |
42 |
++ * so we can force text mode if we do reads only. */ |
43 |
++ if (fcntl(fd, F_GETFL) & O_RDONLY) |
44 |
++ setmode(fd, O_TEXT); /* Ignore \r with any read. */ |
45 |
++ else |
46 |
++ setmode(fd, 0); /* allow but do not force text mode */ |
47 |
++ } else |
48 |
setmode(fd, O_BINARY); |
49 |
# endif |
50 |
-@@ -279,11 +279,15 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) |
51 |
+ } |
52 |
+@@ -279,11 +284,21 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) |
53 |
ret = 0; |
54 |
break; |
55 |
} |
56 |
@@ -28,13 +37,28 @@ https://github.com/openssl/openssl/pull/8226 |
57 |
+# elif defined(OPENSSL_SYS_WIN32_CYGWIN) |
58 |
+ if (!(num & BIO_FP_TEXT)) |
59 |
+ OPENSSL_strlcat(p, "b", sizeof(p)); |
60 |
-+ /* else do not force DOS text mode in Cygwin */ |
61 |
++ else if (!(num & BIO_FP_APPEND) && !(num & BIO_FP_WRITE)) { |
62 |
++ /* Cygwin prefers text mode with text mounts only, |
63 |
++ * so we can force text mode if we do reads only. |
64 |
++ * Unfortunately, the only API to disable binmode |
65 |
++ * without forcing textmode is setmode(fd, 0). */ |
66 |
++ OPENSSL_strlcat(p, "t", sizeof(p)); |
67 |
++ } |
68 |
# endif |
69 |
fp = openssl_fopen(ptr, p); |
70 |
if (fp == NULL) { |
71 |
--- |
72 |
-2.19.2 |
73 |
- |
74 |
+@@ -293,6 +308,11 @@ static long file_ctrl(BIO *b, int cmd, long num, void *ptr) |
75 |
+ ret = 0; |
76 |
+ break; |
77 |
+ } |
78 |
++# if defined(OPENSSL_SYS_WIN32_CYGWIN) |
79 |
++ if ((num & BIO_FP_TEXT) |
80 |
++ && ((num & BIO_FP_APPEND) || (num & BIO_FP_WRITE))) |
81 |
++ setmode(fileno(fp), 0); /* allow but do not force text mode */ |
82 |
++# endif |
83 |
+ b->ptr = fp; |
84 |
+ b->init = 1; |
85 |
+ BIO_clear_flags(b, BIO_FLAGS_UPLINK); /* we did fopen -> we disengage |
86 |
--- openssl-1.1.1a/Configurations/unix-Makefile.tmpl.orig 2019-02-15 19:47:36.464755100 +0100 |
87 |
+++ openssl-1.1.1a/Configurations/unix-Makefile.tmpl 2019-02-15 19:47:42.605379700 +0100 |
88 |
@@ -650,7 +650,7 @@ |