Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 705038 - >net-libs/mbedtls-2.18 installing incorrect headers, breaking most reverse deps
Summary: >net-libs/mbedtls-2.18 installing incorrect headers, breaking most reverse deps
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Anthony Basile
URL:
Whiteboard:
Keywords:
: 705036 705864 (view as bug list)
Depends on:
Blocks: 703280 705036
  Show dependency tree
 
Reported: 2020-01-09 16:47 UTC by Ben Kohler
Modified: 2020-02-01 22:39 UTC (History)
7 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
un-pebcak-705038-wrong-file.patch (un-pebcak-705038-wrong-file.patch,2.63 KB, patch)
2020-01-26 17:28 UTC, Greg Turner
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Ben Kohler gentoo-dev 2020-01-09 16:47:07 UTC
See this upstream issue: https://github.com/ARMmbed/mbedtls/issues/2965

This is causing build failures in various packages-- so far I've tested only a few but found failures in media-sound/umurmur, dev-scheme/gauche, and games-emulation/dolphin.

Also this is what's going on in bug 703280.

I think we either need to mask 2.18+ or backport some kind of patch for the mbedtls build system.
Comment 1 Anthony Basile gentoo-dev 2020-01-11 18:55:01 UTC
(In reply to Ben Kohler from comment #0)
>
> I think we either need to mask 2.18+ or backport some kind of patch for the
> mbedtls build system.

I've masked 2.18.1 and 2.19.1 for now.  It doesn't look like a patch is available yet.  So we'll wait for either a bump with the fix or a patch.
Comment 2 PaX Team 2020-01-21 12:07:19 UTC
(In reply to Anthony Basile from comment #1)
> I've masked 2.18.1 and 2.19.1 for now.  It doesn't look like a patch is
> available yet.  So we'll wait for either a bump with the fix or a patch.
looks like this got committed in the meantime: https://github.com/Ionic/mbed-crypto/commit/de35f31091b7e6cb20ebc8d8c0afc3b20bc57098
Comment 3 Anthony Basile gentoo-dev 2020-01-21 21:50:33 UTC
(In reply to PaX Team from comment #2)
> (In reply to Anthony Basile from comment #1)
> > I've masked 2.18.1 and 2.19.1 for now.  It doesn't look like a patch is
> > available yet.  So we'll wait for either a bump with the fix or a patch.
> looks like this got committed in the meantime:
> https://github.com/Ionic/mbed-crypto/commit/
> de35f31091b7e6cb20ebc8d8c0afc3b20bc57098

I've added the patch to mbedtls-2.18.1-r1.ebuild and mbedtls-2.19.1-r1.ebuild.  Can you please test, and if it fixes it for you, close this bug.
Comment 4 PaX Team 2020-01-22 07:52:05 UTC
(In reply to Anthony Basile from comment #3)
> I've added the patch to mbedtls-2.18.1-r1.ebuild and
> mbedtls-2.19.1-r1.ebuild.  Can you please test, and if it fixes it for you,
> close this bug.
thanks, i can confirm that mbedtls and shadowsocks-libev build fine.
Comment 5 Kobboi 2020-01-22 08:35:37 UTC
obs-studio-24.0.5 is still broken after this mbedtls update
Comment 6 PaX Team 2020-01-22 09:14:39 UTC
(In reply to Kobboi from comment #5)
> obs-studio-24.0.5 is still broken after this mbedtls update
i don't know if it helps tracking dowb the remaining issues with config handling but adding

#define MBEDTLS_X509_CRT_PARSE_C
#define MBEDTLS_DHM_C
#define MBEDTLS_SSL_SRV_C
#define MBEDTLS_SSL_CLI_C

to librtmp/rtmp_sys.h makes it compile at least. i guess it's a gross hack but perhaps will help someone figure out the root cause.
Comment 7 Hector Martin 2020-01-26 15:52:16 UTC
I figured out what went wrong in 703280, adding it here too.

The upstream patch is for *mbed-crypto* but mbedtls-2.19.1-r1.ebuild applies it at the root of the worktree, which is *mbed*. It happens to apply correctly to the other CMakeLists... and thus does exactly the opposite of what it's intended to do, removing the good include files and leaving the bad ones in.

The patch in portage needs to have its path changed to add /crypto/:

diff --git a/crypto/include/CMakeLists.txt b/crypto/include/CMakeLists.txt
index 02f924df4..92229a221 100644
--- a/crypto/include/CMakeLists.txt
+++ b/crypto/include/CMakeLists.txt

Then it works.
Comment 8 Greg Turner 2020-01-26 17:28:47 UTC
Created attachment 604728 [details, diff]
un-pebcak-705038-wrong-file.patch

(In reply to Hector Martin from comment #7)
> I figured out what went wrong in 703280, adding it here too.
> 
> The upstream patch is for *mbed-crypto* but mbedtls-2.19.1-r1.ebuild applies
> it at the root of the worktree, which is *mbed*. It happens to apply
> correctly to the other CMakeLists... and thus does exactly the opposite of
> what it's intended to do, removing the good include files and leaving the
> bad ones in.
> 
> The patch in portage needs to have its path changed to add /crypto/:
> 
> diff --git a/crypto/include/CMakeLists.txt b/crypto/include/CMakeLists.txt
> index 02f924df4..92229a221 100644
> --- a/crypto/include/CMakeLists.txt
> +++ b/crypto/include/CMakeLists.txt
> 
> Then it works.

ACK.  Hopefully this comment makes things more clear (a serious possibility/concern under the circumstances...!)

ebuild patched the wrong file: "${S}"/include/CMakeLists.txt.  Upstream meant for us to patch "${S}"/crypto/include/CMakeLists.txt.  Unfortunately, although the patch may be applied to both files, it is only correct to patch the latter of the two (and the ebuild only applied it to the former... see, crystal-clear! :P)

The attached file makes this explicit (and perhaps more directly comprehensible) by reverting the misapplied patch, and then re-applying upstream's medicine to the correct patient.

Obviously, sticking this into ${FILESDIR} as a second patch along with the bad patch (although it would work) would be pretty sloppy, the bad patch should probably get dropped or corrected as Hector suggests.

In the meanwhile, it may be put in /etc/portage/patches/net-libs/mbedtls-2.19.1-r1 as a work-around for the current snafu, thus fixing breakage like folks are observing in obs-studio.
Comment 9 Sergei Trofimovich (RETIRED) gentoo-dev 2020-01-26 21:33:47 UTC
=games-emulation/dolphin-5.0 is also still broken against =net-libs/mbedtls-2.19.1-r1:

In file included from ../../../../dolphin-5.0/Source/Core/Core/IPC_HLE/WII_Socket.h:54,
                 from ../../../../dolphin-5.0/Source/Core/Core/Core.cpp:60:
../../../../dolphin-5.0/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h:64:2: error: ‘mbedtls_x509_crt’ does not name a type; did you mean ‘mbedtls_time_t’?
   64 |  mbedtls_x509_crt cacert;
      |  ^~~~~~~~~~~~~~~~
      |  mbedtls_time_t
../../../../dolphin-5.0/Source/Core/Core/IPC_HLE/WII_IPC_HLE_Device_net_ssl.h:65:2: error: ‘mbedtls_x509_crt’ does not name a type; did you mean ‘mbedtls_time_t’?
   65 |  mbedtls_x509_crt clicert;
      |  ^~~~~~~~~~~~~~~~
      |  mbedtls_time_t
Comment 10 Chiitoo gentoo-dev 2020-01-27 15:34:47 UTC
(In reply to PaX Team from comment #2)
> (In reply to Anthony Basile from comment #1)
> > I've masked 2.18.1 and 2.19.1 for now.  It doesn't look like a patch is
> > available yet.  So we'll wait for either a bump with the fix or a patch.
> looks like this got committed in the meantime:
> https://github.com/Ionic/mbed-crypto/commit/
> de35f31091b7e6cb20ebc8d8c0afc3b20bc57098

Am I being blind, or is this patch actually in the upstream code already?

This seems to be the fork with the proposed (not yet accepted) patch.
Comment 11 Dennis Schridde 2020-01-27 21:17:56 UTC
(In reply to Greg Turner from comment #8)
> Created attachment 604728 [details, diff] [details, diff]
> un-pebcak-705038-wrong-file.patch

I confirm, this patch makes mbedtls-2.19.1-r1 build for me.
Comment 12 Anthony Basile gentoo-dev 2020-01-29 14:03:54 UTC
(In reply to Dennis Schridde from comment #11)
> (In reply to Greg Turner from comment #8)
> > Created attachment 604728 [details, diff] [details, diff] [details, diff]
> > un-pebcak-705038-wrong-file.patch
> 
> I confirm, this patch makes mbedtls-2.19.1-r1 build for me.

Thanks guys!  I see what's going on now.  I'll add this patch.
Comment 13 Larry the Git Cow gentoo-dev 2020-01-29 14:22:21 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=9bdff0e5ea288b745e38ef08914fe141a127902c

commit 9bdff0e5ea288b745e38ef08914fe141a127902c
Author:     Anthony G. Basile <blueness@gentoo.org>
AuthorDate: 2020-01-29 14:21:46 +0000
Commit:     Anthony G. Basile <blueness@gentoo.org>
CommitDate: 2020-01-29 14:22:13 +0000

    net-libs/mbedtls: fix wrong headers, bug #705038
    
    Closes: https://bugs.gentoo.org/705038
    Package-Manager: Portage-2.3.84, Repoman-2.3.20
    Signed-off-by: Anthony G. Basile <blueness@gentoo.org>

 .../mbedtls-un-pebcak-705038-wrong-file.patch      | 50 ++++++++++++++++++++++
 net-libs/mbedtls/mbedtls-2.18.1-r1.ebuild          |  1 +
 net-libs/mbedtls/mbedtls-2.19.1-r1.ebuild          |  1 +
 3 files changed, 52 insertions(+)
Comment 14 Anthony Basile gentoo-dev 2020-01-29 14:23:53 UTC
*** Bug 705864 has been marked as a duplicate of this bug. ***
Comment 15 Sergei Trofimovich (RETIRED) gentoo-dev 2020-01-30 22:01:08 UTC
(In reply to Larry the Git Cow from comment #13)
> The bug has been closed via the following commit(s):
> 
> https://gitweb.gentoo.org/repo/gentoo.git/commit/
> ?id=9bdff0e5ea288b745e38ef08914fe141a127902c
> 
> commit 9bdff0e5ea288b745e38ef08914fe141a127902c
> Author:     Anthony G. Basile <blueness@gentoo.org>
> AuthorDate: 2020-01-29 14:21:46 +0000
> Commit:     Anthony G. Basile <blueness@gentoo.org>
> CommitDate: 2020-01-29 14:22:13 +0000
> 
>     net-libs/mbedtls: fix wrong headers, bug #705038
>     
>     Closes: https://bugs.gentoo.org/705038
>     Package-Manager: Portage-2.3.84, Repoman-2.3.20
>     Signed-off-by: Anthony G. Basile <blueness@gentoo.org>
> 
>  .../mbedtls-un-pebcak-705038-wrong-file.patch      | 50
> ++++++++++++++++++++++
>  net-libs/mbedtls/mbedtls-2.18.1-r1.ebuild          |  1 +
>  net-libs/mbedtls/mbedtls-2.19.1-r1.ebuild          |  1 +
>  3 files changed, 52 insertions(+)

I suggest to revbump an ebuild so users cloud just upgrade their systems instead of finding out that they need to rebuild mbedtls manually.
Comment 16 Sergei Trofimovich (RETIRED) gentoo-dev 2020-01-30 22:04:59 UTC
*** Bug 705036 has been marked as a duplicate of this bug. ***
Comment 17 Anthony Basile gentoo-dev 2020-02-01 22:39:03 UTC
(In reply to Sergei Trofimovich from comment #15)
>
> I suggest to revbump an ebuild so users cloud just upgrade their systems
> instead of finding out that they need to rebuild mbedtls manually.

Yeah, you're right.  I pushed the rev bump.