threads / discuss / 52652

Facing error in git-imap-send while compiling Git

Subject: Facing error in git-imap-send while compiling Git

## tl;dr

14 messages between Jan 16, 2020 and Feb 15, 2020.

replies: 13people: 4as markdown or json

Nirmal Khedkar· Jan 16, 2020, 19:20 UTC · lore

Hey! I've been facing this error everytime I run the Makefile: ----- LINK git-imap-send imap-send.o: In function `verify_hostname': /git/imap-send.c:252: undefined reference to `sk_num' /git/imap-send.c:254: undefined reference to `sk_value' /git/imap-send.c:260: undefined reference to `sk_pop_free' /git/imap-send.c:260: undefined reference to `sk_pop_free' imap-send.o: In function `ssl_socket_connect': /git/imap-send.c:287: undefined reference to `SSL_library_init' /git/imap-send.c:288: undefined reference to `SSL_load_error_strings' /git/imap-send.c:290: undefined reference to `SSLv23_method' collect2: error: ld returned 1 exit status

Makefile:2454: recipe for target 'git-imap-send' failed make: *** [git-imap-send] Error 1 -----

I'm unaware of git imap-send and what it does. I've not done any changes in the above-mentioned files. And now because of this error, I really cant test any changes I've made. It'd be helpful if I could get some guidance on this.

Thanks! Regards, Nirmal Khedkar

Junio C Hamano· Jan 16, 2020, 22:51 UTC · re: Nirmal Khedkar · lore

Re: Facing error in git-imap-send while compiling Git

Nirmal Khedkar <nirmalhk7@gmail.com> writes:
Show 6 quoted lines
> Hey!
> I've been facing this error everytime I run the Makefile:
> -----
> LINK git-imap-send
> imap-send.o: In function `verify_hostname':
> /git/imap-send.c:252: undefined reference to `sk_num'
Perhaps the thread
  https://lore.kernel.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com/
may help?
Nirmal Khedkar· Jan 17, 2020, 12:42 UTC · re: Junio C Hamano · lore

Re: Facing error in git-imap-send while compiling Git

On Fri, Jan 17, 2020 at 4:21 AM Junio C Hamano <gitster@pobox.com> wrote:
Show 15 quoted lines
>
> Nirmal Khedkar <nirmalhk7@gmail.com> writes:
>
> > Hey!
> > I've been facing this error everytime I run the Makefile:
> > -----
> > LINK git-imap-send
> > imap-send.o: In function `verify_hostname':
> > /git/imap-send.c:252: undefined reference to `sk_num'
>
> Perhaps the thread
>
>   https://lore.kernel.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com
>
> may help?

It did, to the extent that I now know why I'm facing these errors out of the blue.

I'm not quite sure as to what am I supposed to do right now, should I wait for Liam's patch to be merged, or should I implement his fixes locally or should I just downgrade my openssl?

Liam's PR (#516 on GitGitGadget [1]) haven't yet passed all build checks and I guess its still a work in progress. Nevertheless I've tried implementing his fixes to imap-send.c, and the make still fails. Am I missing something here?

Thanks! Regards, Nirmal Khedkar

[1] https://github.com/gitgitgadget/git/pull/516
Johannes Schindelin· Jan 17, 2020, 13:35 UTC · re: Nirmal Khedkar · lore

Re: Facing error in git-imap-send while compiling Git

Hi Nirmal,
On Fri, 17 Jan 2020, Nirmal Khedkar wrote:
Show 28 quoted lines
> On Fri, Jan 17, 2020 at 4:21 AM Junio C Hamano <gitster@pobox.com> wrote:
> >
> > Nirmal Khedkar <nirmalhk7@gmail.com> writes:
> >
> > > Hey!
> > > I've been facing this error everytime I run the Makefile:
> > > -----
> > > LINK git-imap-send
> > > imap-send.o: In function `verify_hostname':
> > > /git/imap-send.c:252: undefined reference to `sk_num'
> >
> > Perhaps the thread
> >
> >   https://lore.kernel.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com
> >
> > may help?
>
> It did, to the extent that I now know why I'm facing these errors out
> of the blue.
>
> I'm  not quite sure as to what am I supposed to do right now, should I
> wait for Liam's patch to be merged,  or should I implement his fixes
> locally or should I just downgrade my openssl?
>
> Liam's PR (#516 on GitGitGadget [1]) haven't yet passed all build
> checks and I guess its still a work in progress. Nevertheless I've
> tried implementing his fixes to imap-send.c, and the make still fails.
> Am I missing something here?

Speaking for myself, I am still waiting for https://public-inbox.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com/ to be addressed adequately. I think this is the main blocker.

You could be that person who addresses this, as already 10 days went past without even so much as an acknowledgement of Junio's suggestion. Maybe you can make it work, and submit a fixed patch (You could take authorship and add a footer "Original-patch-by: Liam Huang <liamhuang0205@gmail.com>" because it is most likely a total rewrite of Liam's patch).

Ciao, Johannes

Nirmal Khedkar· Jan 20, 2020, 19:12 UTC · re: Johannes Schindelin · lore

Re: Facing error in git-imap-send while compiling Git

Hey Johannes!

On Fri, Jan 17, 2020 at 7:05 PM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 46 quoted lines
>
> Hi Nirmal,
>
> On Fri, 17 Jan 2020, Nirmal Khedkar wrote:
>
> > On Fri, Jan 17, 2020 at 4:21 AM Junio C Hamano <gitster@pobox.com> wrote:
> > >
> > > Nirmal Khedkar <nirmalhk7@gmail.com> writes:
> > >
> > > > Hey!
> > > > I've been facing this error everytime I run the Makefile:
> > > > -----
> > > > LINK git-imap-send
> > > > imap-send.o: In function `verify_hostname':
> > > > /git/imap-send.c:252: undefined reference to `sk_num'
> > >
> > > Perhaps the thread
> > >
> > >   https://lore.kernel.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com
> > >
> > > may help?
> >
> > It did, to the extent that I now know why I'm facing these errors out
> > of the blue.
> >
> > I'm  not quite sure as to what am I supposed to do right now, should I
> > wait for Liam's patch to be merged,  or should I implement his fixes
> > locally or should I just downgrade my openssl?
> >
> > Liam's PR (#516 on GitGitGadget [1]) haven't yet passed all build
> > checks and I guess its still a work in progress. Nevertheless I've
> > tried implementing his fixes to imap-send.c, and the make still fails.
> > Am I missing something here?
>
> Speaking for myself, I am still waiting for
> https://public-inbox.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com/
> to be addressed adequately. I think this is the main blocker.
>
> You could be that person who addresses this, as already 10 days went past
> without even so much as an acknowledgement of Junio's suggestion. Maybe
> you can make it work, and submit a fixed patch (You could take authorship
> and add a footer "Original-patch-by: Liam Huang <liamhuang0205@gmail.com>"
> because it is most likely a total rewrite of Liam's patch).
>
> Ciao,
> Johannes

The OpenSSL version on my system is 1.1.1. I've tried implementing Junio's suggestions, and it just doesn't work. It gives me the same error as it gave me earlier. Here's the error: ----- LINK git-imap-send imap-send.o: In function `verify_hostname': /git/imap-send.c:252: undefined reference to `sk_num' /git/imap-send.c:254: undefined reference to `sk_value' /git/imap-send.c:260: undefined reference to `sk_pop_free' /git/imap-send.c:260: undefined reference to `sk_pop_free' imap-send.o: In function `ssl_socket_connect': /git/imap-send.c:287: undefined reference to `SSL_library_init' /git/imap-send.c:288: undefined reference to `SSL_load_error_strings' /git/imap-send.c:290: undefined reference to `SSLv23_method' collect2: error: ld returned 1 exit status

Makefile:2454: recipe for target 'git-imap-send' failed make: *** [git-imap-send] Error 1 -----

From my limited understanding of OpenSSL API's, I reckon all these errors might be because of the errors around 'SSL_library_init' and 'SSL_load_error_strings'. Both these functions are called before 'verify_hostname' is ever called.

StackOverflow suggested ([1]) to add tags during compilation, but I dont think that'd work here. What should I do? Would love it if you could guide me out.

Thanks! Regards, Nirmal Khedkar https://nirmalhk7.github.io

[1] https://stackoverflow.com/questions/5593284/undefined-reference-to-ssl-library-init-and-ssl-load-error-strings
Johannes Schindelin· Jan 20, 2020, 21:35 UTC · re: Nirmal Khedkar · lore

Re: Facing error in git-imap-send while compiling Git

Hi,
On Tue, 21 Jan 2020, Nirmal Khedkar wrote:
Show 49 quoted lines
> On Fri, Jan 17, 2020 at 7:05 PM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > On Fri, 17 Jan 2020, Nirmal Khedkar wrote:
> >
> > > On Fri, Jan 17, 2020 at 4:21 AM Junio C Hamano <gitster@pobox.com> wrote:
> > > >
> > > > Nirmal Khedkar <nirmalhk7@gmail.com> writes:
> > > >
> > > > > Hey!
> > > > > I've been facing this error everytime I run the Makefile:
> > > > > -----
> > > > > LINK git-imap-send
> > > > > imap-send.o: In function `verify_hostname':
> > > > > /git/imap-send.c:252: undefined reference to `sk_num'
> > > >
> > > > Perhaps the thread
> > > >
> > > >   https://lore.kernel.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com
> > > >
> > > > may help?
> > >
> > > It did, to the extent that I now know why I'm facing these errors out
> > > of the blue.
> > >
> > > I'm  not quite sure as to what am I supposed to do right now, should I
> > > wait for Liam's patch to be merged,  or should I implement his fixes
> > > locally or should I just downgrade my openssl?
> > >
> > > Liam's PR (#516 on GitGitGadget [1]) haven't yet passed all build
> > > checks and I guess its still a work in progress. Nevertheless I've
> > > tried implementing his fixes to imap-send.c, and the make still fails.
> > > Am I missing something here?
> >
> > Speaking for myself, I am still waiting for
> > https://public-inbox.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com/
> > to be addressed adequately. I think this is the main blocker.
> >
> > You could be that person who addresses this, as already 10 days went past
> > without even so much as an acknowledgement of Junio's suggestion. Maybe
> > you can make it work, and submit a fixed patch (You could take authorship
> > and add a footer "Original-patch-by: Liam Huang <liamhuang0205@gmail.com>"
> > because it is most likely a total rewrite of Liam's patch).
> >
> > Ciao,
> > Johannes
>
> The OpenSSL version on my system is 1.1.1. I've tried implementing
> Junio's suggestions, and it just doesn't work.
Does the code otherwise compile cleanly with `make DEVELOPER=1`?
Show 18 quoted lines
> It gives me the same
> error as it gave me earlier. Here's the error:
> -----
> LINK git-imap-send
> imap-send.o: In function `verify_hostname':
> /git/imap-send.c:252: undefined reference to `sk_num'
> /git/imap-send.c:254: undefined reference to `sk_value'
> /git/imap-send.c:260: undefined reference to `sk_pop_free'
> /git/imap-send.c:260: undefined reference to `sk_pop_free'
> imap-send.o: In function `ssl_socket_connect':
> /git/imap-send.c:287: undefined reference to `SSL_library_init'
> /git/imap-send.c:288: undefined reference to `SSL_load_error_strings'
> /git/imap-send.c:290: undefined reference to `SSLv23_method'
> collect2: error: ld returned 1 exit status
>
> Makefile:2454: recipe for target 'git-imap-send' failed
> make: *** [git-imap-send] Error 1
> -----

Those are linker errors, meaning that the symbols were not found in the libraries.

If you build with `make V=1 DEVELOPER=1` you should see that `git-imap-send` links in OpenSSL via -lssl (and/or -lcrypto). Is this the case for you?

Ciao, Johannes

Show 18 quoted lines
>
> From my limited understanding of OpenSSL API's, I reckon all these
> errors might be because of the errors around 'SSL_library_init' and
> 'SSL_load_error_strings'. Both these functions are called before
> 'verify_hostname' is ever called.
>
> StackOverflow suggested ([1]) to add tags during compilation, but I
> dont think that'd work here.
> What should I do? Would love it if you could guide me out.
>
>
> Thanks!
> Regards,
> Nirmal Khedkar
> https://nirmalhk7.github.io
>
> [1] https://stackoverflow.com/questions/5593284/undefined-reference-to-ssl-library-init-and-ssl-load-error-strings
>
Nirmal Khedkar· Jan 21, 2020, 11:50 UTC · re: Johannes Schindelin · lore

Re: Facing error in git-imap-send while compiling Git

Hey Johannes!

On Tue, Jan 21, 2020 at 3:05 AM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 58 quoted lines
>
> Hi,
>
> On Tue, 21 Jan 2020, Nirmal Khedkar wrote:
>
> > On Fri, Jan 17, 2020 at 7:05 PM Johannes Schindelin
> > <Johannes.Schindelin@gmx.de> wrote:
> > >
> > > On Fri, 17 Jan 2020, Nirmal Khedkar wrote:
> > >
> > > > On Fri, Jan 17, 2020 at 4:21 AM Junio C Hamano <gitster@pobox.com> wrote:
> > > > >
> > > > > Perhaps the thread
> > > > >
> > > > >   https://lore.kernel.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com
> > > > >
> > > > > may help?
> > > >
> > > > It did, to the extent that I now know why I'm facing these errors out
> > > > of the blue.
> > > >
> > > > I'm  not quite sure as to what am I supposed to do right now, should I
> > > > wait for Liam's patch to be merged,  or should I implement his fixes
> > > > locally or should I just downgrade my openssl?
> > > >
> > > > Liam's PR (#516 on GitGitGadget [1]) haven't yet passed all build
> > > > checks and I guess its still a work in progress. Nevertheless I've
> > > > tried implementing his fixes to imap-send.c, and the make still fails.
> > > > Am I missing something here?
> > >
> > > Speaking for myself, I am still waiting for
> > > https://public-inbox.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com/
> > > to be addressed adequately. I think this is the main blocker.
> > >
> > > You could be that person who addresses this, as already 10 days went past
> > > without even so much as an acknowledgement of Junio's suggestion. Maybe
> > > you can make it work, and submit a fixed patch (You could take authorship
> > > and add a footer "Original-patch-by: Liam Huang <liamhuang0205@gmail.com>"
> > > because it is most likely a total rewrite of Liam's patch).
> > >
> > > Ciao,
> > > Johannes
> >
> > The OpenSSL version on my system is 1.1.1. I've tried implementing
> > Junio's suggestions, and it just doesn't work.
>
> Does the code otherwise compile cleanly with `make DEVELOPER=1`?
>
> > It gives me the same
> > error as it gave me earlier.
> >
>
> Those are linker errors, meaning that the symbols were not found in the
> libraries.
>
> If you build with `make V=1 DEVELOPER=1` you should see that
> `git-imap-send` links in OpenSSL via -lssl (and/or -lcrypto). Is this the
> case for you?

Doing "echo DEVELOPER=1 >config.mak" does not help in any way. I get the same errors. Here's my diff, in case I have been making mistakes all along.

---
diff --git a/imap-send.c b/imap-send.c
index 6c54d8c29d..73ed3bc287 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -42,6 +42,12 @@ typedef void *SSL;
 #define USE_CURL_DEFAULT 0
 #endif

+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+    #define OPENSSL_sk_num(x) sk_GENERAL_NAME_num(x)
+    #define OPENSSL_sk_value(x,y) sk_GENERAL_NAME_value((x),(y))
+    #define OPENSSL_sk_pop_free(x,y) sk_GENERAL_NAME_pop_free((x),(y))
+#endif
+
 static int verbosity;
 static int use_curl = USE_CURL_DEFAULT;

@@ -59,6 +65,8 @@ static struct option imap_send_options[] = {
 #define DRV_BOX_BAD     -2
 #define DRV_STORE_BAD   -3
---

From my limited knowledge of OpenSSL libraries, I think the error has
more to do with 'SSL_library_init()' , which appears like a
constructor to the OpenSSL library. I found these emails regarding
"if" cases around this function. Please check out these patches:
1. Rosen Penev:
https://lore.kernel.org/git/20181227023548.396-1-rosenp@gmail.com/
2. eroen: https://lore.kernel.org/git/20170112104219.563497-1-git-scm@occam.eroen.eu/

Are the fixes made in these patches relevant here. Please let me know
if I'm going wrong.

Thanks!
Nirmal Khedkar
https://nirmalhk7.github.io
Junio C Hamano· Jan 21, 2020, 18:11 UTC · re: Nirmal Khedkar · lore

Re: Facing error in git-imap-send while compiling Git

Nirmal Khedkar <nirmalhk7@gmail.com> writes:
Show 26 quoted lines
> the same errors. Here's my diff, in case I have been making mistakes
> all along.
>
>
> ---
> diff --git a/imap-send.c b/imap-send.c
> index 6c54d8c29d..73ed3bc287 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -42,6 +42,12 @@ typedef void *SSL;
>  #define USE_CURL_DEFAULT 0
>  #endif
>
> +#if OPENSSL_VERSION_NUMBER < 0x10100000L
> +    #define OPENSSL_sk_num(x) sk_GENERAL_NAME_num(x)
> +    #define OPENSSL_sk_value(x,y) sk_GENERAL_NAME_value((x),(y))
> +    #define OPENSSL_sk_pop_free(x,y) sk_GENERAL_NAME_pop_free((x),(y))
> +#endif
> +
>  static int verbosity;
>  static int use_curl = USE_CURL_DEFAULT;
>
> @@ -59,6 +65,8 @@ static struct option imap_send_options[] = {
>  #define DRV_BOX_BAD     -2
>  #define DRV_STORE_BAD   -3
> ---

If the above is the whole change, then I do not think it would work. In the thread I referred you to, I was responding to a patch that has repetitive

	+#if OPENSSL_VERSION_NUMBER < 0x10100000L
		call_this_original_function();
	+#else
	+	call_this_new_function();
	+#endif

and I was merely suggesting to reduce the patch noise by #define'ing a compatibility macro to allow us use new names in the code regardless of the version (i.e. OPENSSL_sk_*() may not be available in older version, which used to call them sk_*()---the solution is to pretend we have OPENSSL_sk_*() by defining them in terms of sk_*() we do have).

There was a hunk (or perhaps two) in the patch I was responding to that is different from the mere function renaming. That part is not there in the above patch you pasted, and needs to be kept, I think.

Johannes Schindelin· Jan 21, 2020, 21:09 UTC · re: Nirmal Khedkar · lore

Re: Facing error in git-imap-send while compiling Git

Hi,
On Tue, 21 Jan 2020, Nirmal Khedkar wrote:
Show 78 quoted lines
> On Tue, Jan 21, 2020 at 3:05 AM Johannes Schindelin
> <Johannes.Schindelin@gmx.de> wrote:
> >
> > On Tue, 21 Jan 2020, Nirmal Khedkar wrote:
> >
> > > On Fri, Jan 17, 2020 at 7:05 PM Johannes Schindelin
> > > <Johannes.Schindelin@gmx.de> wrote:
> > > >
> > > > On Fri, 17 Jan 2020, Nirmal Khedkar wrote:
> > > >
> > > > > On Fri, Jan 17, 2020 at 4:21 AM Junio C Hamano <gitster@pobox.com> wrote:
> > > > > >
> > > > > > Perhaps the thread
> > > > > >
> > > > > >   https://lore.kernel.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com
> > > > > >
> > > > > > may help?
> > > > >
> > > > > It did, to the extent that I now know why I'm facing these errors out
> > > > > of the blue.
> > > > >
> > > > > I'm  not quite sure as to what am I supposed to do right now, should I
> > > > > wait for Liam's patch to be merged,  or should I implement his fixes
> > > > > locally or should I just downgrade my openssl?
> > > > >
> > > > > Liam's PR (#516 on GitGitGadget [1]) haven't yet passed all build
> > > > > checks and I guess its still a work in progress. Nevertheless I've
> > > > > tried implementing his fixes to imap-send.c, and the make still fails.
> > > > > Am I missing something here?
> > > >
> > > > Speaking for myself, I am still waiting for
> > > > https://public-inbox.org/git/xmqqpnfv3tq4.fsf@gitster-ct.c.googlers.com/
> > > > to be addressed adequately. I think this is the main blocker.
> > > >
> > > > You could be that person who addresses this, as already 10 days went past
> > > > without even so much as an acknowledgement of Junio's suggestion. Maybe
> > > > you can make it work, and submit a fixed patch (You could take authorship
> > > > and add a footer "Original-patch-by: Liam Huang <liamhuang0205@gmail.com>"
> > > > because it is most likely a total rewrite of Liam's patch).
> > > >
> > > > Ciao,
> > > > Johannes
> > >
> > > The OpenSSL version on my system is 1.1.1. I've tried implementing
> > > Junio's suggestions, and it just doesn't work.
> >
> > Does the code otherwise compile cleanly with `make DEVELOPER=1`?
> >
> > > It gives me the same
> > > error as it gave me earlier.
> > >
> >
> > Those are linker errors, meaning that the symbols were not found in the
> > libraries.
> >
> > If you build with `make V=1 DEVELOPER=1` you should see that
> > `git-imap-send` links in OpenSSL via -lssl (and/or -lcrypto). Is this the
> > case for you?
>
> Doing "echo DEVELOPER=1 >config.mak" does not help in any way. I get
> the same errors. Here's my diff, in case I have been making mistakes
> all along.
>
>
> ---
> diff --git a/imap-send.c b/imap-send.c
> index 6c54d8c29d..73ed3bc287 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -42,6 +42,12 @@ typedef void *SSL;
>  #define USE_CURL_DEFAULT 0
>  #endif
>
> +#if OPENSSL_VERSION_NUMBER < 0x10100000L
> +    #define OPENSSL_sk_num(x) sk_GENERAL_NAME_num(x)
> +    #define OPENSSL_sk_value(x,y) sk_GENERAL_NAME_value((x),(y))
> +    #define OPENSSL_sk_pop_free(x,y) sk_GENERAL_NAME_pop_free((x),(y))
> +#endif
That looks sensible.
Show 15 quoted lines
> +
>  static int verbosity;
>  static int use_curl = USE_CURL_DEFAULT;
>
> @@ -59,6 +65,8 @@ static struct option imap_send_options[] = {
>  #define DRV_BOX_BAD     -2
>  #define DRV_STORE_BAD   -3
> ---
>
> From my limited knowledge of OpenSSL libraries, I think the error has
> more to do with 'SSL_library_init()' , which appears like a
> constructor to the OpenSSL library. I found these emails regarding
> "if" cases around this function. Please check out these patches:
> 1. Rosen Penev:
> https://lore.kernel.org/git/20181227023548.396-1-rosenp@gmail.com/

I remember that one. And I agreed with Junio that the documentation suggests that the call is _optional_, while the patch suggests that it would be _incorrect_ instead.

And looking at https://www.openssl.org/docs/man1.1.1/man3/SSL_library_init.html suggests to me that it is still supported.

Having said that, if I look at the headers installed for `libssl-dev` version `1.1.1-1ubuntu2.1~18.04.5` in my Ubuntu installation, I see that `/usr/include/openssl/ssl.h` defines that symbol as:

	#  define SSL_library_init() OPENSSL_init_ssl(0, NULL)
but _only_:
	# if OPENSSL_API_COMPAT < 0x10100000L

So maybe that disagrees with the documentation that says that SSL_library_init() is optional?

The curious thing is that `OPENSSL_API_COMPAT` is not even defined anywhere. So maybe it _is_ the right thing to also `#define SSL_library_init() (void)` in the diff you listed above?

_Maybe_ guarded within `#ifndef SSL_library_init ... #endif` guards?
> 2. eroen: https://lore.kernel.org/git/20170112104219.563497-1-git-scm@occam.eroen.eu/
That sounds like a good suggestion, too.
> Are the fixes made in these patches relevant here. Please let me know
> if I'm going wrong.

Yes, both threads are relevant, and if you can reconcile them into a patch that makes Git compile with OpenSSL v1.1.1, I will try my best to review them (Cc: me, just in case).

Ciao, Johannes

Junio C Hamano· Jan 22, 2020, 19:20 UTC · re: Johannes Schindelin · lore

Re: Facing error in git-imap-send while compiling Git

Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
Show 44 quoted lines
>> From my limited knowledge of OpenSSL libraries, I think the error has
>> more to do with 'SSL_library_init()' , which appears like a
>> constructor to the OpenSSL library. I found these emails regarding
>> "if" cases around this function. Please check out these patches:
>> 1. Rosen Penev:
>> https://lore.kernel.org/git/20181227023548.396-1-rosenp@gmail.com/
>
> I remember that one. And I agreed with Junio that the documentation
> suggests that the call is _optional_, while the patch suggests that it
> would be _incorrect_ instead.
>
> And looking at
> https://www.openssl.org/docs/man1.1.1/man3/SSL_library_init.html suggests
> to me that it is still supported.
>
> Having said that, if I look at the headers installed for `libssl-dev`
> version `1.1.1-1ubuntu2.1~18.04.5` in my Ubuntu installation, I see that
> `/usr/include/openssl/ssl.h` defines that symbol as:
>
> 	#  define SSL_library_init() OPENSSL_init_ssl(0, NULL)
>
> but _only_:
>
> 	# if OPENSSL_API_COMPAT < 0x10100000L
>
> So maybe that disagrees with the documentation that says that
> SSL_library_init() is optional?
>
> The curious thing is that `OPENSSL_API_COMPAT` is not even defined
> anywhere. So maybe it _is_ the right thing to also `#define
> SSL_library_init() (void)` in the diff you listed above?
>
> _Maybe_ guarded within `#ifndef SSL_library_init ... #endif` guards?
>
>> 2. eroen: https://lore.kernel.org/git/20170112104219.563497-1-git-scm@occam.eroen.eu/
>
> That sounds like a good suggestion, too.
>
>> Are the fixes made in these patches relevant here. Please let me know
>> if I'm going wrong.
>
> Yes, both threads are relevant, and if you can reconcile them into a patch
> that makes Git compile with OpenSSL v1.1.1, I will try my best to review
> them (Cc: me, just in case).

I agree with the above reasoning and the suggestion given by Bates in https://lore.kernel.org/git/66967e0e-8bd9-f4b6-d2d4-ccce9004f42e@nottheoilrig.com/ sounds like a reasonable one.

Thanks for digging and double-checking these two previous efforts, and giving another round of thoughts on them.

Nirmal Khedkar· Jan 30, 2020, 20:26 UTC · re: Junio C Hamano · lore

Re: Facing error in git-imap-send while compiling Git

Hi All,
I'll admit I'm quite perplexed with this OpenSSL problem that I'm
facing. Here's what I've done along with their results:
1. eroen and Jack Bates' suggestions
(https://lore.kernel.org/git/66967e0e-8bd9-f4b6-d2d4-ccce9004f42e@nottheoilrig.com/)
2. I've also implemented Johannes' suggestions, and I'm still facing
the same problem.Here's the final diff:
---
diff --git a/imap-send.c b/imap-send.c
index 6c54d8c29d..3248bc2123 100644
--- a/imap-send.c
+++ b/imap-send.c
@@ -41,7 +41,9 @@ typedef void *SSL;
 /* We don't have curl, so continue to use the historical implementation */
 #define USE_CURL_DEFAULT 0
 #endif
-
+#ifndef SSL_library_init
+       #define SSL_library_init();
+#endif
 static int verbosity;
 static int use_curl = USE_CURL_DEFAULT;

@@ -59,6 +61,13 @@ static struct option imap_send_options[] = {
 #define DRV_BOX_BAD     -2
 #define DRV_STORE_BAD   -3

+
+#if OPENSSL_VERSION_NUMBER < 0x10100000L
+       #define OPENSSL_sk_num(x) sk_GENERAL_NAME_num(x)
+       #define OPENSSL_sk_value(x,y) sk_GENERAL_NAME_value((x),(y))
+       #define OPENSSL_sk_pop_free(x,y) sk_GENERAL_NAME_pop_free((x),(y))
+#endif
+
 __attribute__((format (printf, 1, 2)))
 static void imap_info(const char *, ...);
 __attribute__((format (printf, 1, 2)))
@@ -275,21 +284,30 @@ static int verify_hostname(X509 *cert, const
char *hostname)

 static int ssl_socket_connect(struct imap_socket *sock, int
use_tls_only, int verify)
 {
-#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
-       const SSL_METHOD *meth;
-#else
-       SSL_METHOD *meth;
-#endif
-       SSL_CTX *ctx;
-       int ret;
-       X509 *cert;
-
-       SSL_library_init();
-       SSL_load_error_strings();
+       #if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
+               const SSL_METHOD *meth;
+       #else
+               SSL_METHOD *meth;
+       #endif
+               SSL_CTX *ctx;
+               int ret;
+               X509 *cert;
+
+       #if OPENSSL_VERSION_NUMBER >= 0x10100000L ||
defined(LIBRESSL_VERSION_NUMBER)
+               OPENSSL_init_ssl(0, NULL);
+               meth = TLS_method();
+       #else
+               SSL_library_init();
+               SSL_load_error_strings();
+               meth = SSLv23_method();
+       #endif

-       meth = SSLv23_method();
        if (!meth) {
-               ssl_socket_perror("SSLv23_method");
+       #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
+                       ssl_socket_perror("TLS_method");
+       #else
+                       ssl_socket_perror("SSLv23_method");
+       #endif
                return -1;
        }


---

Also, on a different note: I'm actually really interested in applying
to Git for GSoC, and I should be doing Git microprojects right now to
properly cement my chance of doing GSoC with Git. Many aspiring GSoC
applicants already been asking, enquiring and maybe even working about
Git microprojects, as evident from the mailing list.

So while I'm not saying that I'm in deep trouble and all this OpenSSL
v1.1.1 issue fixing is completely useless (I'm learning quite a lot
along the way and able to understand the project structure), but
saying that I'm not worried about my GSoC prospects of working in this
organization would honestly be false :) . I love git, I would love
contributing to Git, but I'd love to do a GSoC Summer with Git much
more than the rest.

Please let me know where am I going wrong. If there's any other system
packages that I can download so that I can focus on other Git issues
and this one simultaneously, please let me know. Here are my system
specifications (let me know if you need anything more specific):
---
OS: Ubuntu 18.04
Linux Kernel: 5.3
OpenSSL Version: 1.1.1d
---

Apologies for the long email,
Thank You,
Nirmal Khedkar
(https://nirmalhk7.github.io)


On Thu, Jan 23, 2020 at 12:50 AM Junio C Hamano <gitster@pobox.com> wrote:
>
> Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
>
> >> From my limited knowledge of OpenSSL libraries, I think the error has
> >> more to do with 'SSL_library_init()' , which appears like a
> >> constructor to the OpenSSL library. I found these emails regarding
> >> "if" cases around this function. Please check out these patches:
> >> 1. Rosen Penev:
> >> https://lore.kernel.org/git/20181227023548.396-1-rosenp@gmail.com/
> >
> > I remember that one. And I agreed with Junio that the documentation
> > suggests that the call is _optional_, while the patch suggests that it
> > would be _incorrect_ instead.
> >
> > And looking at
> > https://www.openssl.org/docs/man1.1.1/man3/SSL_library_init.html suggests
> > to me that it is still supported.
> >
> > Having said that, if I look at the headers installed for `libssl-dev`
> > version `1.1.1-1ubuntu2.1~18.04.5` in my Ubuntu installation, I see that
> > `/usr/include/openssl/ssl.h` defines that symbol as:
> >
> >       #  define SSL_library_init() OPENSSL_init_ssl(0, NULL)
> >
> > but _only_:
> >
> >       # if OPENSSL_API_COMPAT < 0x10100000L
> >
> > So maybe that disagrees with the documentation that says that
> > SSL_library_init() is optional?
> >
> > The curious thing is that `OPENSSL_API_COMPAT` is not even defined
> > anywhere. So maybe it _is_ the right thing to also `#define
> > SSL_library_init() (void)` in the diff you listed above?
> >
> > _Maybe_ guarded within `#ifndef SSL_library_init ... #endif` guards?
> >
> >> 2. eroen: https://lore.kernel.org/git/20170112104219.563497-1-git-scm@occam.eroen.eu/
> >
> > That sounds like a good suggestion, too.
> >
> >> Are the fixes made in these patches relevant here. Please let me know
> >> if I'm going wrong.
> >
> > Yes, both threads are relevant, and if you can reconcile them into a patch
> > that makes Git compile with OpenSSL v1.1.1, I will try my best to review
> > them (Cc: me, just in case).
>
> I agree with the above reasoning and the suggestion given by Bates in
> https://lore.kernel.org/git/66967e0e-8bd9-f4b6-d2d4-ccce9004f42e@nottheoilrig.com/
> sounds like a reasonable one.
>
> Thanks for digging and double-checking these two previous efforts,
> and giving another round of thoughts on them.
>
>
>
>
Beat Bolli· Jan 30, 2020, 23:03 UTC · re: Nirmal Khedkar · lore

Re: Facing error in git-imap-send while compiling Git

Hi Nirmal!
On 30.01.20 21:26, Nirmal Khedkar wrote:
> Hi All,
> I'll admit I'm quite perplexed with this OpenSSL problem that I'm
> facing. Here's what I've done along with their results:
... snipped ...
Show 12 quoted lines
> Please let me know where am I going wrong. If there's any other system
> packages that I can download so that I can focus on other Git issues
> and this one simultaneously, please let me know. Here are my system
> specifications (let me know if you need anything more specific):
> ---
> OS: Ubuntu 18.04
> Linux Kernel: 5.3
> OpenSSL Version: 1.1.1d
> ---
> 
> Apologies for the long email,
> Thank You,
No problem!

My system is similar: Debian testing with the OpenSSL 1.1.1d from the distribution. I have no build problems whatsoever. OpenSSL comes with backward compatibility macros that most allow code written for 1.0.2 to be compiled without errors. These macros can be turned off by changing the API compatibility version using -DOPENSSL_API_COMPAT=<version>.

You can check this with
    make V=1 imap-send.o
This will show the compiler command executed:
    gcc -o imap-send.o -c -MF ./.depend/imap-send.o.d -MQ imap-send.o
-MMD -MP   -g -O2 -I. -DHAVE_SYSINFO -DGIT_HOST_CPU="\"x86_64\""
-DHAVE_ALLOCA_H -DUSE_CURL_FOR_IMAP_SEND -DSHA1_DC
-DSHA1DC_NO_STANDARD_INCLUDES -DSHA1DC_INIT_SAFE_HASH_DEFAULT=0
-DSHA1DC_CUSTOM_INCLUDE_SHA1_C="\"cache.h\""
-DSHA1DC_CUSTOM_INCLUDE_UBC_CHECK_C="\"git-compat-util.h\"" -DSHA256_BLK
-pthread -DHAVE_PATHS_H -DHAVE_STRINGS_H -DHAVE_DEV_TTY
-DHAVE_CLOCK_GETTIME -DHAVE_CLOCK_MONOTONIC -DHAVE_GETDELIM
'-DPROCFS_EXECUTABLE_PATH="/proc/self/exe"'  -DFREAD_READS_DIRECTORIES
-DNO_STRLCPY -DSHELL_PATH='"/bin/sh"' -DPAGER_ENV='"LESS=FRX LV=-c"'
imap-send.c
Check it for any -D flags mentioning OpenSSL.

You can get even more verbose output from gcc by copying the compiler command make displays and running it after appending the verbose flag "-v" at the end.

Check this new output for include directories etc. You need to make sure that gcc picks up the system OpenSSL include files. They should be found under /usr/include/openssl.

Hope this helps,
Beat Bolli
Johannes Schindelin· Feb 1, 2020, 21:35 UTC · re: Nirmal Khedkar · lore

Re: Facing error in git-imap-send while compiling Git

Hi Nirmal,
On Fri, 31 Jan 2020, Nirmal Khedkar wrote:
Show 6 quoted lines
> I'll admit I'm quite perplexed with this OpenSSL problem that I'm
> facing. Here's what I've done along with their results:
> 1. eroen and Jack Bates' suggestions
> (https://lore.kernel.org/git/66967e0e-8bd9-f4b6-d2d4-ccce9004f42e@nottheoilrig.com/)
> 2. I've also implemented Johannes' suggestions, and I'm still facing
> the same problem.

Could you repeat the symptoms? I forgot the details since you posted your previous email.

Show 80 quoted lines
> Here's the final diff:
> ---
> diff --git a/imap-send.c b/imap-send.c
> index 6c54d8c29d..3248bc2123 100644
> --- a/imap-send.c
> +++ b/imap-send.c
> @@ -41,7 +41,9 @@ typedef void *SSL;
>  /* We don't have curl, so continue to use the historical implementation */
>  #define USE_CURL_DEFAULT 0
>  #endif
> -
> +#ifndef SSL_library_init
> +       #define SSL_library_init();
> +#endif
>  static int verbosity;
>  static int use_curl = USE_CURL_DEFAULT;
>
> @@ -59,6 +61,13 @@ static struct option imap_send_options[] = {
>  #define DRV_BOX_BAD     -2
>  #define DRV_STORE_BAD   -3
>
> +
> +#if OPENSSL_VERSION_NUMBER < 0x10100000L
> +       #define OPENSSL_sk_num(x) sk_GENERAL_NAME_num(x)
> +       #define OPENSSL_sk_value(x,y) sk_GENERAL_NAME_value((x),(y))
> +       #define OPENSSL_sk_pop_free(x,y) sk_GENERAL_NAME_pop_free((x),(y))
> +#endif
> +
>  __attribute__((format (printf, 1, 2)))
>  static void imap_info(const char *, ...);
>  __attribute__((format (printf, 1, 2)))
> @@ -275,21 +284,30 @@ static int verify_hostname(X509 *cert, const
> char *hostname)
>
>  static int ssl_socket_connect(struct imap_socket *sock, int
> use_tls_only, int verify)
>  {
> -#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
> -       const SSL_METHOD *meth;
> -#else
> -       SSL_METHOD *meth;
> -#endif
> -       SSL_CTX *ctx;
> -       int ret;
> -       X509 *cert;
> -
> -       SSL_library_init();
> -       SSL_load_error_strings();
> +       #if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
> +               const SSL_METHOD *meth;
> +       #else
> +               SSL_METHOD *meth;
> +       #endif
> +               SSL_CTX *ctx;
> +               int ret;
> +               X509 *cert;
> +
> +       #if OPENSSL_VERSION_NUMBER >= 0x10100000L ||
> defined(LIBRESSL_VERSION_NUMBER)
> +               OPENSSL_init_ssl(0, NULL);
> +               meth = TLS_method();
> +       #else
> +               SSL_library_init();
> +               SSL_load_error_strings();
> +               meth = SSLv23_method();
> +       #endif
>
> -       meth = SSLv23_method();
>         if (!meth) {
> -               ssl_socket_perror("SSLv23_method");
> +       #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
> +                       ssl_socket_perror("TLS_method");
> +       #else
> +                       ssl_socket_perror("SSLv23_method");
> +       #endif
>                 return -1;
>         }
>
>
> ---
That diff looks pretty okay to me.
Show 5 quoted lines
> Also, on a different note: I'm actually really interested in applying
> to Git for GSoC, and I should be doing Git microprojects right now to
> properly cement my chance of doing GSoC with Git. Many aspiring GSoC
> applicants already been asking, enquiring and maybe even working about
> Git microprojects, as evident from the mailing list.

For the record, I am not even sure whether Git will participate in GSoC this year; I am not aware of any activity in that direction.

Having said that, the purpose of a Git microproject is to get acquainted with the development process of Git (at least in my mind). It is not so much fixing some issue in Git, but more like learning how to interact with the Git mailing list, in particular how to communicate effectively with the developers/reviewers on this list.

In that light, if I were a possible mentor (which I am not, at least not in this year's GSoC) I would not insist on a microproject. Or more like: I would accept your work on getting this vexing OpenSSL v1.1.1 issue sorted out as a microproject in its own right.

Show 19 quoted lines
> So while I'm not saying that I'm in deep trouble and all this OpenSSL
> v1.1.1 issue fixing is completely useless (I'm learning quite a lot
> along the way and able to understand the project structure), but
> saying that I'm not worried about my GSoC prospects of working in this
> organization would honestly be false :) . I love git, I would love
> contributing to Git, but I'd love to do a GSoC Summer with Git much
> more than the rest.
>
> Please let me know where am I going wrong. If there's any other system
> packages that I can download so that I can focus on other Git issues
> and this one simultaneously, please let me know. Here are my system
> specifications (let me know if you need anything more specific):
> ---
> OS: Ubuntu 18.04
> Linux Kernel: 5.3
> OpenSSL Version: 1.1.1d
> ---
>
> Apologies for the long email,

This is not even close to being the longest email sent to this list, so don't worry!

Ciao, Johannes

Show 65 quoted lines
> Thank You,
> Nirmal Khedkar
> (https://nirmalhk7.github.io)
>
>
> On Thu, Jan 23, 2020 at 12:50 AM Junio C Hamano <gitster@pobox.com> wrote:
> >
> > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> >
> > >> From my limited knowledge of OpenSSL libraries, I think the error has
> > >> more to do with 'SSL_library_init()' , which appears like a
> > >> constructor to the OpenSSL library. I found these emails regarding
> > >> "if" cases around this function. Please check out these patches:
> > >> 1. Rosen Penev:
> > >> https://lore.kernel.org/git/20181227023548.396-1-rosenp@gmail.com/
> > >
> > > I remember that one. And I agreed with Junio that the documentation
> > > suggests that the call is _optional_, while the patch suggests that it
> > > would be _incorrect_ instead.
> > >
> > > And looking at
> > > https://www.openssl.org/docs/man1.1.1/man3/SSL_library_init.html suggests
> > > to me that it is still supported.
> > >
> > > Having said that, if I look at the headers installed for `libssl-dev`
> > > version `1.1.1-1ubuntu2.1~18.04.5` in my Ubuntu installation, I see that
> > > `/usr/include/openssl/ssl.h` defines that symbol as:
> > >
> > >       #  define SSL_library_init() OPENSSL_init_ssl(0, NULL)
> > >
> > > but _only_:
> > >
> > >       # if OPENSSL_API_COMPAT < 0x10100000L
> > >
> > > So maybe that disagrees with the documentation that says that
> > > SSL_library_init() is optional?
> > >
> > > The curious thing is that `OPENSSL_API_COMPAT` is not even defined
> > > anywhere. So maybe it _is_ the right thing to also `#define
> > > SSL_library_init() (void)` in the diff you listed above?
> > >
> > > _Maybe_ guarded within `#ifndef SSL_library_init ... #endif` guards?
> > >
> > >> 2. eroen: https://lore.kernel.org/git/20170112104219.563497-1-git-scm@occam.eroen.eu/
> > >
> > > That sounds like a good suggestion, too.
> > >
> > >> Are the fixes made in these patches relevant here. Please let me know
> > >> if I'm going wrong.
> > >
> > > Yes, both threads are relevant, and if you can reconcile them into a patch
> > > that makes Git compile with OpenSSL v1.1.1, I will try my best to review
> > > them (Cc: me, just in case).
> >
> > I agree with the above reasoning and the suggestion given by Bates in
> > https://lore.kernel.org/git/66967e0e-8bd9-f4b6-d2d4-ccce9004f42e@nottheoilrig.com/
> > sounds like a reasonable one.
> >
> > Thanks for digging and double-checking these two previous efforts,
> > and giving another round of thoughts on them.
> >
> >
> >
> >
>
Nirmal Khedkar· Feb 15, 2020, 14:00 UTC · re: Johannes Schindelin · lore

Re: Facing error in git-imap-send while compiling Git

Hi All! Apologies for late reply, had examinations for past week.

On Sun, Feb 2, 2020 at 3:05 AM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 14 quoted lines
>
> Hi Nirmal,
>
> On Fri, 31 Jan 2020, Nirmal Khedkar wrote:
>
> > I'll admit I'm quite perplexed with this OpenSSL problem that I'm
> > facing. Here's what I've done along with their results:
> > 1. eroen and Jack Bates' suggestions
> > (https://lore.kernel.org/git/66967e0e-8bd9-f4b6-d2d4-ccce9004f42e@nottheoilrig.com/)
> > 2. I've also implemented Johannes' suggestions, and I'm still facing
> > the same problem.
>
> Could you repeat the symptoms? I forgot the details since you posted your
> previous email.
Here's the latest errors:
---
    LINK git-imap-send
imap-send.o: In function `verify_hostname':
imap-send.c:261: undefined reference to `sk_num'
imap-send.c:263: undefined reference to `sk_value'
imap-send.c:269: undefined reference to `sk_pop_free'
imap-send.c:269: undefined reference to `sk_pop_free'
imap-send.o: In function `ssl_socket_connect':
imap-send.c:301: undefined reference to `SSL_load_error_strings'
imap-send.c:302: undefined reference to `SSLv23_method'
collect2: error: ld returned 1 exit status
Makefile:2454: recipe for target 'git-imap-send' failed
make: *** [git-imap-send] Error 1
---

I was kind-of hoping that when I switch from Linux 5.3 Edge to Linux 5.3 (Which came about a week ago), these issues would disappear, but they still exist.

I've also tried Beat Bolli's suggestion, but I get *no output* when I run "make V=1 imap-send.o". I dont understand why either.

My previous emails have already mentioned this: I seriously want to apply to Git. Its a serious component to all my projects and pretty sure for everyone else's too, and contributing to Git gives me the _contributing-back-to-society_ vibes which I like :)

So I'd love if someone could break down to me (who's never worked with OpenSSL) on what imap-send does (in words simpler than ones in manpages). I think only if I understand OpenSSL better, will I be able to fix this issue.

Thanks a lot! Regards, Nirmal Khedkar

--
Nirmal Khedkar
https://nirmalhk7.github.io
Github: www.github.com/nirmalhk7

On Sun, Feb 2, 2020 at 3:05 AM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote:

Show 209 quoted lines
>
> Hi Nirmal,
>
> On Fri, 31 Jan 2020, Nirmal Khedkar wrote:
>
> > I'll admit I'm quite perplexed with this OpenSSL problem that I'm
> > facing. Here's what I've done along with their results:
> > 1. eroen and Jack Bates' suggestions
> > (https://lore.kernel.org/git/66967e0e-8bd9-f4b6-d2d4-ccce9004f42e@nottheoilrig.com/)
> > 2. I've also implemented Johannes' suggestions, and I'm still facing
> > the same problem.
>
> Could you repeat the symptoms? I forgot the details since you posted your
> previous email.
>
> > Here's the final diff:
> > ---
> > diff --git a/imap-send.c b/imap-send.c
> > index 6c54d8c29d..3248bc2123 100644
> > --- a/imap-send.c
> > +++ b/imap-send.c
> > @@ -41,7 +41,9 @@ typedef void *SSL;
> >  /* We don't have curl, so continue to use the historical implementation */
> >  #define USE_CURL_DEFAULT 0
> >  #endif
> > -
> > +#ifndef SSL_library_init
> > +       #define SSL_library_init();
> > +#endif
> >  static int verbosity;
> >  static int use_curl = USE_CURL_DEFAULT;
> >
> > @@ -59,6 +61,13 @@ static struct option imap_send_options[] = {
> >  #define DRV_BOX_BAD     -2
> >  #define DRV_STORE_BAD   -3
> >
> > +
> > +#if OPENSSL_VERSION_NUMBER < 0x10100000L
> > +       #define OPENSSL_sk_num(x) sk_GENERAL_NAME_num(x)
> > +       #define OPENSSL_sk_value(x,y) sk_GENERAL_NAME_value((x),(y))
> > +       #define OPENSSL_sk_pop_free(x,y) sk_GENERAL_NAME_pop_free((x),(y))
> > +#endif
> > +
> >  __attribute__((format (printf, 1, 2)))
> >  static void imap_info(const char *, ...);
> >  __attribute__((format (printf, 1, 2)))
> > @@ -275,21 +284,30 @@ static int verify_hostname(X509 *cert, const
> > char *hostname)
> >
> >  static int ssl_socket_connect(struct imap_socket *sock, int
> > use_tls_only, int verify)
> >  {
> > -#if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
> > -       const SSL_METHOD *meth;
> > -#else
> > -       SSL_METHOD *meth;
> > -#endif
> > -       SSL_CTX *ctx;
> > -       int ret;
> > -       X509 *cert;
> > -
> > -       SSL_library_init();
> > -       SSL_load_error_strings();
> > +       #if (OPENSSL_VERSION_NUMBER >= 0x10000000L)
> > +               const SSL_METHOD *meth;
> > +       #else
> > +               SSL_METHOD *meth;
> > +       #endif
> > +               SSL_CTX *ctx;
> > +               int ret;
> > +               X509 *cert;
> > +
> > +       #if OPENSSL_VERSION_NUMBER >= 0x10100000L ||
> > defined(LIBRESSL_VERSION_NUMBER)
> > +               OPENSSL_init_ssl(0, NULL);
> > +               meth = TLS_method();
> > +       #else
> > +               SSL_library_init();
> > +               SSL_load_error_strings();
> > +               meth = SSLv23_method();
> > +       #endif
> >
> > -       meth = SSLv23_method();
> >         if (!meth) {
> > -               ssl_socket_perror("SSLv23_method");
> > +       #if (OPENSSL_VERSION_NUMBER >= 0x10100000L)
> > +                       ssl_socket_perror("TLS_method");
> > +       #else
> > +                       ssl_socket_perror("SSLv23_method");
> > +       #endif
> >                 return -1;
> >         }
> >
> >
> > ---
>
> That diff looks pretty okay to me.
>
> > Also, on a different note: I'm actually really interested in applying
> > to Git for GSoC, and I should be doing Git microprojects right now to
> > properly cement my chance of doing GSoC with Git. Many aspiring GSoC
> > applicants already been asking, enquiring and maybe even working about
> > Git microprojects, as evident from the mailing list.
>
> For the record, I am not even sure whether Git will participate in GSoC
> this year; I am not aware of any activity in that direction.
>
> Having said that, the purpose of a Git microproject is to get acquainted
> with the development process of Git (at least in my mind). It is not so
> much fixing some issue in Git, but more like learning how to interact with
> the Git mailing list, in particular how to communicate effectively with
> the developers/reviewers on this list.
>
> In that light, if I were a possible mentor (which I am not, at least not
> in this year's GSoC) I would not insist on a microproject. Or more like: I
> would accept your work on getting this vexing OpenSSL v1.1.1 issue sorted
> out as a microproject in its own right.
>
> > So while I'm not saying that I'm in deep trouble and all this OpenSSL
> > v1.1.1 issue fixing is completely useless (I'm learning quite a lot
> > along the way and able to understand the project structure), but
> > saying that I'm not worried about my GSoC prospects of working in this
> > organization would honestly be false :) . I love git, I would love
> > contributing to Git, but I'd love to do a GSoC Summer with Git much
> > more than the rest.
> >
> > Please let me know where am I going wrong. If there's any other system
> > packages that I can download so that I can focus on other Git issues
> > and this one simultaneously, please let me know. Here are my system
> > specifications (let me know if you need anything more specific):
> > ---
> > OS: Ubuntu 18.04
> > Linux Kernel: 5.3
> > OpenSSL Version: 1.1.1d
> > ---
> >
> > Apologies for the long email,
>
> This is not even close to being the longest email sent to this list, so
> don't worry!
>
> Ciao,
> Johannes
>
> > Thank You,
> > Nirmal Khedkar
> > (https://nirmalhk7.github.io)
> >
> >
> > On Thu, Jan 23, 2020 at 12:50 AM Junio C Hamano <gitster@pobox.com> wrote:
> > >
> > > Johannes Schindelin <Johannes.Schindelin@gmx.de> writes:
> > >
> > > >> From my limited knowledge of OpenSSL libraries, I think the error has
> > > >> more to do with 'SSL_library_init()' , which appears like a
> > > >> constructor to the OpenSSL library. I found these emails regarding
> > > >> "if" cases around this function. Please check out these patches:
> > > >> 1. Rosen Penev:
> > > >> https://lore.kernel.org/git/20181227023548.396-1-rosenp@gmail.com/
> > > >
> > > > I remember that one. And I agreed with Junio that the documentation
> > > > suggests that the call is _optional_, while the patch suggests that it
> > > > would be _incorrect_ instead.
> > > >
> > > > And looking at
> > > > https://www.openssl.org/docs/man1.1.1/man3/SSL_library_init.html suggests
> > > > to me that it is still supported.
> > > >
> > > > Having said that, if I look at the headers installed for `libssl-dev`
> > > > version `1.1.1-1ubuntu2.1~18.04.5` in my Ubuntu installation, I see that
> > > > `/usr/include/openssl/ssl.h` defines that symbol as:
> > > >
> > > >       #  define SSL_library_init() OPENSSL_init_ssl(0, NULL)
> > > >
> > > > but _only_:
> > > >
> > > >       # if OPENSSL_API_COMPAT < 0x10100000L
> > > >
> > > > So maybe that disagrees with the documentation that says that
> > > > SSL_library_init() is optional?
> > > >
> > > > The curious thing is that `OPENSSL_API_COMPAT` is not even defined
> > > > anywhere. So maybe it _is_ the right thing to also `#define
> > > > SSL_library_init() (void)` in the diff you listed above?
> > > >
> > > > _Maybe_ guarded within `#ifndef SSL_library_init ... #endif` guards?
> > > >
> > > >> 2. eroen: https://lore.kernel.org/git/20170112104219.563497-1-git-scm@occam.eroen.eu/
> > > >
> > > > That sounds like a good suggestion, too.
> > > >
> > > >> Are the fixes made in these patches relevant here. Please let me know
> > > >> if I'm going wrong.
> > > >
> > > > Yes, both threads are relevant, and if you can reconcile them into a patch
> > > > that makes Git compile with OpenSSL v1.1.1, I will try my best to review
> > > > them (Cc: me, just in case).
> > >
> > > I agree with the above reasoning and the suggestion given by Bates in
> > > https://lore.kernel.org/git/66967e0e-8bd9-f4b6-d2d4-ccce9004f42e@nottheoilrig.com/
> > > sounds like a reasonable one.
> > >
> > > Thanks for digging and double-checking these two previous efforts,
> > > and giving another round of thoughts on them.
> > >
> > >
> > >
> > >
> >

← back to recent threads