From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 021876EC5D; Fri, 9 Apr 2021 22:56:11 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 021876EC5D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1617998171; bh=wpqSya1dmzwr6gmYKeUmgA+ujhI6Q7J14YGVvQfzYgw=; h=In-Reply-To:Date:Cc:References:To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=YYyrrib0XhiMqU4rkMqd6JqO3a3v4hXt9SE1yGjEdSIkn0SCLNVZM1TKM+qsArw1J 0ocdvVIhrjNbw8FRiGgiJzTeX2jXX16gGKUjh7YCAxYkZaUehd0gKaImVOf7pSRmen gzVwrjTdGQHjCeMsXLr5BVLG6RNs8qIBKAHrrBH8= Received: from smtp44.i.mail.ru (smtp44.i.mail.ru [94.100.177.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id D193B6EC63 for ; Fri, 9 Apr 2021 22:55:12 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org D193B6EC63 Received: by smtp44.i.mail.ru with esmtpa (envelope-from ) id 1lUxDk-0006AJ-3d; Fri, 09 Apr 2021 22:55:12 +0300 Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 13.4 \(3608.120.23.2.1\)) In-Reply-To: <20210330231354.vm2emlswu77wpuys@tkn_work_nb> Date: Fri, 9 Apr 2021 22:55:11 +0300 Cc: tarantool-patches@dev.tarantool.org Content-Transfer-Encoding: quoted-printable Message-Id: <4BE31DD9-5C47-457C-B0F9-8D8826276B88@tarantool.org> References: <20210319134555.71396-1-roman.habibov@tarantool.org> <20210319134555.71396-2-roman.habibov@tarantool.org> <20210330231354.vm2emlswu77wpuys@tkn_work_nb> To: Alexander Turenko , Leonid Vasiliev X-Mailer: Apple Mail (2.3608.120.23.2.1) X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480B1C8842CE613979772AC4B34408C6525182A05F538085040F9AEA61CF8E8663CF49D9AF28D489C15957229D26FEF6600959172F71813842B X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE77BF46084C0059042EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006372D22CC9620B7D5068638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B28B37E9F9A30287CC1D9F168D1DBCC90279373A8315E4CF65D2E47CDBA5A96583C09775C1D3CA48CF7EF884183F8E4D67117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE74601F13E4625331C9FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE711CAF3B2758713E6D32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C0F0EB20F09E7EDBCCCD04E86FAF290E2D7E9C4E3C761E06A71DD303D21008E298D5E8D9A59859A8B6B372FE9A2E580EFC725E5C173C3A84C3C74813BC7F81EC8435872C767BF85DA2F004C90652538430E4A6367B16DE6309 X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4ADED27546C620ED1493A4D386DEC2C2934 X-C1DE0DAB: 0D63561A33F958A58EB6005BA29A7F13335B3E6AA92A6673058D97E47878BEB1D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D3453037B563866572149897659CD26C7DF5364A5BF9E9D00199831A770BE2DE20C3824E876453872791D7E09C32AA3244C0933B21928BC8BF4323A03A0B63FD0EDD9ADFF0C0BDB8D1FFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojyO2lHpuZu4RQeP1rOL+daw== X-Mailru-Sender: ED747E36EB90C325A4602F7CA2CC58C17B7D1618D7D5511D04BCB7DC51C8E81C3FB1763410276AF21EC3B765AEBF8DFDC77752E0C033A69EF2501F26BCC01020D1D7FFF4A7B59B3C6C18EFA0BB12DBB0 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH 1/2] build: enable smtp X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Roman Khabibov via Tarantool-patches Reply-To: Roman Khabibov Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hi! Thanks for the review. > On Mar 31, 2021, at 02:13, Alexander Turenko = wrote: >=20 > Aside of several stylistic nits, I have no objections. >=20 > LGTM after changes (no need to re-review with me.) >=20 > Please, update and proceed with the next reviewer. >=20 > On Fri, Mar 19, 2021 at 04:45:54PM +0300, Roman Khabibov wrote: >> Enable smtp protocol in bundled libCURL. >=20 > Nit: Regarding 'libCURL'. The project page ([1]) name the library > 'libcurl', so it would be better to follow it. Done. > [1]: https://curl.se/libcurl/ >=20 > Please, leave a couple of words why the change is needed and link the > relevant issue. I see that > https://github.com/tarantool/tarantool/issues/4559 is quite relevant. >=20 >> +## feature/build >> + >> +* Enable smtp protocol in bundled libCURL (gh-####). >=20 > Nit: 'gh-####' have no any sense. It is better to replace it with = gh-4559. >=20 >> \ No newline at end of file >=20 > No newline at end of file. Added. >> diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibCURL.cmake >> index 39a1d62fd..59f78d9e2 100644 >> --- a/cmake/BuildLibCURL.cmake >> +++ b/cmake/BuildLibCURL.cmake >> @@ -77,7 +77,7 @@ macro(curl_build) >>=20 >> # Switch off the group of protocols with special flag HTTP_ONLY: >> # ftp, file, ldap, ldaps, rtsp, dict, telnet, tftp, pop3, imap, = smtp. >> - list(APPEND LIBCURL_CMAKE_FLAGS "-DHTTP_ONLY=3DON") >> + list(APPEND LIBCURL_CMAKE_FLAGS "-DHTTP_ONLY=3DOFF") >>=20 >> # Additionaly disable some more protocols. >> list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMB=3DON") >> @@ -142,7 +142,7 @@ macro(curl_build) >> list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_TFTP=3DON") >> list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_POP3=3DON") >> list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_IMAP=3DON") >> - list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMTP=3DON") >> + list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMTP=3DOFF") >=20 > I made the following checks: >=20 > 1. Compared build/curl/work/curl/CMakeCache.txt before and after the > change. Only given options are changed. Okay. >=20 > 2. Added the following hunk to test/box-tap/curl-build.test.lua: >=20 > | local i =3D 0 > | local protocol =3D info.protocols[i] > | while protocol ~=3D nil do > | print(('protocols[%d] =3D %s'):format(i, = ffi.string(protocol))) > | i =3D i + 1 > | protocol =3D info.protocols[i] > | end >=20 > Before the patch: >=20 > | protocols[0] =3D http > | protocols[1] =3D https >=20 > After the patch: >=20 > | protocols[0] =3D http > | protocols[1] =3D https > | protocols[2] =3D smtp > | protocols[3] =3D smtps >=20 > (See, it worth to check for smtps as well.) >=20 > The output looks okay. >=20 > 3. Added the following hunk to test/box-tap/curl-build.test.lua: >=20 > | print(('features: %d'):format(info.features)) >=20 > The output before and after the patch is the same: >=20 > | features: 2622093 >=20 > Looks okay. >=20 > So, it seems, we don't enable or disable something unintentionally. > Nice. >=20 >> +-- >> +-- gh-####: Check if smtp protocol is enabled. >> +-- >=20 > Nit: Please, replace with gh-4559. >=20 >> +local function has_smtp() >> + local i =3D 0 >> + -- curl_version_info_data.protocols is a null terminated array >> + -- of pointers to char. >> + -- See curl/lib/version.c: >> + -- static const char * const protocols[] >> + local protocol =3D info.protocols[i] >> + while protocol ~=3D nil do >> + if ffi.string(protocol) =3D=3D 'smtp' then >> + return true >> + end >=20 > It worth to check for 'smtps' as well (see above). +local function has_protocol(protocol_str) + local i =3D 0 + -- curl_version_info_data.protocols is a null terminated array + -- of pointers to char. + -- See curl/lib/version.c: + -- static const char * const protocols[] + local info =3D ffi.C.curl_version_info(7) + local protocol =3D info.protocols[i] + while protocol ~=3D nil do + if ffi.string(protocol) =3D=3D protocol_str then + return true + end + i =3D i + 1 + protocol =3D info.protocols[i] + end + + return false +end + +-- +-- gh-4559: check if smtp and smtps protocols are enabled. +-- +test:ok(has_protocol('smtp'), 'smtp protocol is supported') +test:ok(has_protocol('smtps'), 'smtps protocol is supported=E2=80=99) + commit 4d939d2ac120774af29f2dc1fd5dd1528f82fce8 Author: Roman Khabibov Date: Tue Jan 19 00:45:32 2021 +0300 build: enable smtp =20 Enable smtp and smtps protocols in bundled libcurl. =20 Part of #4559 diff --git a/changelogs/unreleased/enable-smtp.md = b/changelogs/unreleased/enable-smtp.md new file mode 100755 index 000000000..aa299b3c2 --- /dev/null +++ b/changelogs/unreleased/enable-smtp.md @@ -0,0 +1,3 @@ +## feature/build + +* Enable smtp and smtps protocols in bundled libcurl (gh-4559). diff --git a/cmake/BuildLibCURL.cmake b/cmake/BuildLibCURL.cmake index 39a1d62fd..59f78d9e2 100644 --- a/cmake/BuildLibCURL.cmake +++ b/cmake/BuildLibCURL.cmake @@ -77,7 +77,7 @@ macro(curl_build) =20 # Switch off the group of protocols with special flag HTTP_ONLY: # ftp, file, ldap, ldaps, rtsp, dict, telnet, tftp, pop3, imap, = smtp. - list(APPEND LIBCURL_CMAKE_FLAGS "-DHTTP_ONLY=3DON") + list(APPEND LIBCURL_CMAKE_FLAGS "-DHTTP_ONLY=3DOFF") =20 # Additionaly disable some more protocols. list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMB=3DON") @@ -142,7 +142,7 @@ macro(curl_build) list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_TFTP=3DON") list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_POP3=3DON") list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_IMAP=3DON") - list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMTP=3DON") + list(APPEND LIBCURL_CMAKE_FLAGS "-DCURL_DISABLE_SMTP=3DOFF") =20 include(ExternalProject) ExternalProject_Add( diff --git a/test/box-tap/gh-5223-curl-exports.test.lua = b/test/box-tap/curl-build.test.lua similarity index 88% rename from test/box-tap/gh-5223-curl-exports.test.lua rename to test/box-tap/curl-build.test.lua index 300d60b07..ae0d397b5 100755 --- a/test/box-tap/gh-5223-curl-exports.test.lua +++ b/test/box-tap/curl-build.test.lua @@ -56,7 +56,7 @@ ffi.cdef([[ =20 local info =3D ffi.C.curl_version_info(7) local test =3D tap.test('curl-features') -test:plan(3) +test:plan(5) =20 if test:ok(info.ssl_version ~=3D nil, 'Curl built with SSL support') = then test:diag('ssl_version: ' .. ffi.string(info.ssl_version)) @@ -78,6 +78,9 @@ else RTLD_DEFAULT =3D ffi.cast("void *", 0LL) end =20 +-- +-- gh-5223: Check if all curl symbols are exported. +-- -- The following list was obtained by parsing libcurl.a static library: -- nm libcurl.a | grep -oP 'T \K(curl_.+)$' | sort local curl_symbols =3D { @@ -174,4 +177,29 @@ test:test('curl_symbols', function(t) end end) =20 +local function has_protocol(protocol_str) + local i =3D 0 + -- curl_version_info_data.protocols is a null terminated array + -- of pointers to char. + -- See curl/lib/version.c: + -- static const char * const protocols[] + local info =3D ffi.C.curl_version_info(7) + local protocol =3D info.protocols[i] + while protocol ~=3D nil do + if ffi.string(protocol) =3D=3D protocol_str then + return true + end + i =3D i + 1 + protocol =3D info.protocols[i] + end + + return false +end + +-- +-- gh-4559: check if smtp and smtps protocols are enabled. +-- +test:ok(has_protocol('smtp'), 'smtp protocol is supported') +test:ok(has_protocol('smtps'), 'smtps protocol is supported') + os.exit(test:check() and 0 or 1)