git@vger.kernel.org mailing list mirror (one of many)
 help / color / mirror / code / Atom feed
* 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-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
  -- strict thread matches above, loose matches on Subject: below --
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).