* Facing error in git-imap-send while compiling Git @ 2020-01-16 19:20 Nirmal Khedkar 2020-01-16 22:51 ` Junio C Hamano 0 siblings, 1 reply; 15+ messages in thread From: Nirmal Khedkar @ 2020-01-16 19:20 UTC (permalink / raw) To: git 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-16 19:20 Facing error in git-imap-send while compiling Git Nirmal Khedkar @ 2020-01-16 22:51 ` Junio C Hamano 2020-01-17 12:42 ` Nirmal Khedkar 0 siblings, 1 reply; 15+ messages in thread From: Junio C Hamano @ 2020-01-16 22:51 UTC (permalink / raw) To: Nirmal Khedkar; +Cc: git 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? ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-16 22:51 ` Junio C Hamano @ 2020-01-17 12:42 ` Nirmal Khedkar 2020-01-17 13:35 ` Johannes Schindelin 0 siblings, 1 reply; 15+ messages in thread From: Nirmal Khedkar @ 2020-01-17 12:42 UTC (permalink / raw) To: git, gitster 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? Thanks! Regards, Nirmal Khedkar [1] https://github.com/gitgitgadget/git/pull/516 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-17 12:42 ` Nirmal Khedkar @ 2020-01-17 13:35 ` Johannes Schindelin 2020-01-20 19:12 ` Nirmal Khedkar 0 siblings, 1 reply; 15+ messages in thread From: Johannes Schindelin @ 2020-01-17 13:35 UTC (permalink / raw) To: Nirmal Khedkar; +Cc: git, gitster 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-17 13:35 ` Johannes Schindelin @ 2020-01-20 19:12 ` Nirmal Khedkar 2020-01-20 21:35 ` Johannes Schindelin 0 siblings, 1 reply; 15+ messages in thread From: Nirmal Khedkar @ 2020-01-20 19:12 UTC (permalink / raw) To: Johannes.Schindelin; +Cc: gitster, git Hey Johannes! On Fri, Jan 17, 2020 at 7:05 PM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > > 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-20 19:12 ` Nirmal Khedkar @ 2020-01-20 21:35 ` Johannes Schindelin 2020-01-21 11:50 ` Nirmal Khedkar 0 siblings, 1 reply; 15+ messages in thread From: Johannes Schindelin @ 2020-01-20 21:35 UTC (permalink / raw) To: Nirmal Khedkar; +Cc: gitster, git 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: > > > > > > > > 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`? > 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 > > 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 > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-20 21:35 ` Johannes Schindelin @ 2020-01-21 11:50 ` Nirmal Khedkar 2020-01-21 18:11 ` Junio C Hamano 2020-01-21 21:09 ` Johannes Schindelin 0 siblings, 2 replies; 15+ messages in thread From: Nirmal Khedkar @ 2020-01-21 11:50 UTC (permalink / raw) To: Johannes Schindelin; +Cc: git Hey Johannes! On Tue, Jan 21, 2020 at 3:05 AM Johannes Schindelin <Johannes.Schindelin@gmx.de> wrote: > > 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 ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-21 11:50 ` Nirmal Khedkar @ 2020-01-21 18:11 ` Junio C Hamano 2020-01-21 21:09 ` Johannes Schindelin 1 sibling, 0 replies; 15+ messages in thread From: Junio C Hamano @ 2020-01-21 18:11 UTC (permalink / raw) To: Nirmal Khedkar; +Cc: Johannes Schindelin, git Nirmal Khedkar <nirmalhk7@gmail.com> writes: > 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-21 11:50 ` Nirmal Khedkar 2020-01-21 18:11 ` Junio C Hamano @ 2020-01-21 21:09 ` Johannes Schindelin 2020-01-22 19:20 ` Junio C Hamano 1 sibling, 1 reply; 15+ messages in thread From: Johannes Schindelin @ 2020-01-21 21:09 UTC (permalink / raw) To: Nirmal Khedkar; +Cc: git Hi, On Tue, 21 Jan 2020, Nirmal Khedkar wrote: > 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. > + > 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-21 21:09 ` Johannes Schindelin @ 2020-01-22 19:20 ` Junio C Hamano 2020-01-30 20:26 ` Nirmal Khedkar 0 siblings, 1 reply; 15+ messages in thread From: Junio C Hamano @ 2020-01-22 19:20 UTC (permalink / raw) To: Johannes Schindelin; +Cc: Nirmal Khedkar, git 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. ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-22 19:20 ` Junio C Hamano @ 2020-01-30 20:26 ` Nirmal Khedkar 2020-01-30 23:03 ` Beat Bolli 2020-02-01 21:35 ` Johannes Schindelin 0 siblings, 2 replies; 15+ messages in thread From: Nirmal Khedkar @ 2020-01-30 20:26 UTC (permalink / raw) To: Johannes Schindelin; +Cc: git, gitster 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. > > > > ^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-30 20:26 ` Nirmal Khedkar @ 2020-01-30 23:03 ` Beat Bolli 2020-02-01 21:35 ` Johannes Schindelin 1 sibling, 0 replies; 15+ messages in thread From: Beat Bolli @ 2020-01-30 23:03 UTC (permalink / raw) To: Nirmal Khedkar; +Cc: Johannes Schindelin, 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 ... > 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 ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-01-30 20:26 ` Nirmal Khedkar 2020-01-30 23:03 ` Beat Bolli @ 2020-02-01 21:35 ` Johannes Schindelin 2020-02-15 14:00 ` Nirmal Khedkar 1 sibling, 1 reply; 15+ messages in thread From: Johannes Schindelin @ 2020-02-01 21:35 UTC (permalink / raw) To: Nirmal Khedkar; +Cc: git, gitster 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. > > > > > > > > > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git 2020-02-01 21:35 ` Johannes Schindelin @ 2020-02-15 14:00 ` Nirmal Khedkar 0 siblings, 0 replies; 15+ messages in thread From: Nirmal Khedkar @ 2020-02-15 14:00 UTC (permalink / raw) To: Johannes Schindelin, dev+git; +Cc: git, gitster 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: > > 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: > > 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. > > > > > > > > > > > > > > ^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: Facing error in git-imap-send while compiling Git @ 2020-02-17 9:30 Abhishek Kumar 0 siblings, 0 replies; 15+ messages in thread From: Abhishek Kumar @ 2020-02-17 9:30 UTC (permalink / raw) To: nirmalhk7; +Cc: Johannes Schindelin, dev+git, git, gitster Greetings Nirmal > what imap-send does (in words simpler than ones in manpages). IMAP is a protocol that stores email messages on a mail server but allows end-user to view and manipulate them as local files. imap-send sends a collection of patches from stdin to an IMAP folder. You create patches using `git format-patch`, edit them and once satisfied, send them to your drafts folder using `git imap-send`. **Note**: This does not mean that they are sent out, but rather they are (usually) in your email service's draft folder. As for your diff, I have some suggestions - --- 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 If the macro does not exist, you define it to - nothing, really. You might have meant this. [1] ``` #ifndef SSL_libary_init #define SSL_library_init() OPENSSL_init_ssl(0, null) #endif ``` Regardless, you do check below for the version (hence indirectly whether the macro exists). You can safely remove these lines. 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 Maintain zero indentation for macros for consistency. Also define `METHOD_NAME` as `SSLv23_method` and `TLS_method` to reduce noise below. + SSL_CTX *ctx; + int ret; + X509 *cert; + > + #if OPENSSL_VERSION_NUMBER >= 0x10100000L || > + defined(LIBRESSL_VERSION_NUMBER) > + OPENSSL_init_ssl(0, NULL); This will be executed if openssl version >= 1.1 or has libressl installed - which means it will *also* be executed for openssl < 1.1 and libressl installed. OPENSSL_init_ssl hasn't been defined for older versions and will throw an undefined reference as well. [2] + 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 Use `METHOD_NAME` defined above. return -1; } As a general note for this patch - I would rather make OpenSSL 1.1 the common case, using directives to make it compatible with the older versions. Do consult with Junio and Johannes over the larger picture here. --- Regards Abhishek [1]: https://github.com/openssl/openssl/blob/8083fd3a183d4c881d6b15727cbc6cb7faeb3280/include/openssl/ssl.h#L1995 [2]: https://www.openssl.org/docs/man1.1.0/man3/OPENSSL_init_ssl.html ^ permalink raw reply related [flat|nested] 15+ messages in thread
end of thread, other threads:[~2020-02-17 9:31 UTC | newest] Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2020-01-16 19:20 Facing error in git-imap-send while compiling Git Nirmal Khedkar 2020-01-16 22:51 ` Junio C Hamano 2020-01-17 12:42 ` Nirmal Khedkar 2020-01-17 13:35 ` Johannes Schindelin 2020-01-20 19:12 ` Nirmal Khedkar 2020-01-20 21:35 ` Johannes Schindelin 2020-01-21 11:50 ` Nirmal Khedkar 2020-01-21 18:11 ` Junio C Hamano 2020-01-21 21:09 ` Johannes Schindelin 2020-01-22 19:20 ` Junio C Hamano 2020-01-30 20:26 ` Nirmal Khedkar 2020-01-30 23:03 ` Beat Bolli 2020-02-01 21:35 ` Johannes Schindelin 2020-02-15 14:00 ` Nirmal Khedkar 2020-02-17 9:30 Abhishek Kumar
Code repositories for project(s) associated with this public inbox https://80x24.org/mirrors/git.git This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).