net-p2p/amule: various fixes
authorAlexander Tsoy <alexander@tsoy.me>
Mon, 18 Jun 2018 18:18:19 +0000 (21:18 +0300)
committerPatrice Clement <monsieurp@gentoo.org>
Fri, 22 Jun 2018 22:17:16 +0000 (00:17 +0200)
Add/remove patches:
- Removed fallocate patch. Not needed according to debian maintainers.
- Fix crash if a shared dir contains UTF-8 chars.
- Fix crash on closing last search tab.
- Compatibility with crypto++ 6.0.0.
- Disable check for updates by default.

Closes: https://bugs.gentoo.org/654692

net-p2p/amule/amule-2.3.2-r2.ebuild
net-p2p/amule/files/amule-2.3.2-cryptopp-6.patch [new file with mode: 0644]
net-p2p/amule/files/amule-2.3.2-disable-version-check.patch [new file with mode: 0644]
net-p2p/amule/files/amule-2.3.2-fix-crash-closing-last-search-tab-1.patch [new file with mode: 0644]
net-p2p/amule/files/amule-2.3.2-fix-crash-closing-last-search-tab-2.patch [new file with mode: 0644]
net-p2p/amule/files/amule-2.3.2-fix-crash-shared-dir-utf8.patch [new file with mode: 0644]

index e219e45a08b0b0caf791c4778e50d20f4ec14707..30ed14b5a3327d3e18909979f431f82f4b230294 100644 (file)
@@ -33,7 +33,13 @@ COMMON_DEPEND="
 DEPEND="${COMMON_DEPEND}"
 RDEPEND="${COMMON_DEPEND}"
 
-PATCHES=( "${FILESDIR}/${PN}-2.2.6-fallocate.diff" )
+PATCHES=(
+       "${FILESDIR}/${PN}-2.3.2-fix-crash-shared-dir-utf8.patch"
+       "${FILESDIR}/${PN}-2.3.2-fix-crash-closing-last-search-tab-1.patch"
+       "${FILESDIR}/${PN}-2.3.2-fix-crash-closing-last-search-tab-2.patch"
+       "${FILESDIR}/${PN}-2.3.2-cryptopp-6.patch"
+       "${FILESDIR}/${PN}-2.3.2-disable-version-check.patch"
+)
 
 pkg_setup() {
        if use stats && ! use X; then
diff --git a/net-p2p/amule/files/amule-2.3.2-cryptopp-6.patch b/net-p2p/amule/files/amule-2.3.2-cryptopp-6.patch
new file mode 100644 (file)
index 0000000..d235344
--- /dev/null
@@ -0,0 +1,25 @@
+From 27c13f3e622b8a3eaaa05bb62b0149604bdcc9e8 Mon Sep 17 00:00:00 2001
+From: Tommy Jerry Mairo <tommy.mairo@gmail.com>
+Date: Wed, 21 Mar 2018 19:56:28 +0100
+Subject: [PATCH] Bugfix: API mismatch with crypto++ 6.0.0
+
+---
+ src/ClientCreditsList.cpp | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/src/ClientCreditsList.cpp b/src/ClientCreditsList.cpp
+index 3bea9fe2d..69e881fd8 100644
+--- a/src/ClientCreditsList.cpp
++++ b/src/ClientCreditsList.cpp
+@@ -312,7 +312,7 @@ void CClientCreditsList::InitalizeCrypting()
+               // calculate and store public key
+               CryptoPP::RSASSA_PKCS1v15_SHA_Verifier pubkey(*static_cast<CryptoPP::RSASSA_PKCS1v15_SHA_Signer *>(m_pSignkey));
+               CryptoPP::ArraySink asink(m_abyMyPublicKey, 80);
+-              pubkey.DEREncode(asink);
++              pubkey.GetMaterial().Save(asink);
+               m_nMyPublicKeyLen = asink.TotalPutLength();
+               asink.MessageEnd();
+       } catch (const CryptoPP::Exception& e) {
+-- 
+2.16.4
+
diff --git a/net-p2p/amule/files/amule-2.3.2-disable-version-check.patch b/net-p2p/amule/files/amule-2.3.2-disable-version-check.patch
new file mode 100644 (file)
index 0000000..74a0203
--- /dev/null
@@ -0,0 +1,12 @@
+Disable NewVersionCheck by default
+--- a/src/Preferences.cpp
++++ b/src/Preferences.cpp
+@@ -1210,7 +1210,7 @@ void CPreferences::BuildItemList( const
+       /**
+        * Version check
+        **/
+-       NewCfgItem(IDC_NEWVERSION,     (new Cfg_Bool( wxT("/eMule/NewVersionCheck"), s_NewVersionCheck, true )));
++       NewCfgItem(IDC_NEWVERSION,     (new Cfg_Bool( wxT("/eMule/NewVersionCheck"), s_NewVersionCheck, false )));
+        /**
+         * Obfuscation
diff --git a/net-p2p/amule/files/amule-2.3.2-fix-crash-closing-last-search-tab-1.patch b/net-p2p/amule/files/amule-2.3.2-fix-crash-closing-last-search-tab-1.patch
new file mode 100644 (file)
index 0000000..c480165
--- /dev/null
@@ -0,0 +1,97 @@
+From 0f0c5c220228aea81142c7c00f73414cdb1b507a Mon Sep 17 00:00:00 2001
+From: gaffa <gaffa@confuseacat.dk>
+Date: Wed, 12 Oct 2016 19:36:21 +0200
+Subject: [PATCH] A workaround for inconsistent behaviour in wxWidgets, where
+ the button release signal is falling through. Instead of calling DeletePage
+ directly an event is added to delete the page after the button release event
+ has been processed by all handlers.
+
+---
+ src/MuleNotebook.cpp | 17 ++++++++++++++++-
+ src/MuleNotebook.h   | 13 +++++++++++++
+ 2 files changed, 29 insertions(+), 1 deletion(-)
+
+diff --git a/src/MuleNotebook.cpp b/src/MuleNotebook.cpp
+index ff3ba294e..4ab23ce18 100644
+--- a/src/MuleNotebook.cpp
++++ b/src/MuleNotebook.cpp
+@@ -32,6 +32,7 @@
+ DEFINE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_PAGE_CLOSING)
+ DEFINE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_ALL_PAGES_CLOSED)
++DEFINE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_DELETE_PAGE)
+ BEGIN_EVENT_TABLE(CMuleNotebook, wxNotebook)
+       EVT_RIGHT_DOWN(CMuleNotebook::OnRMButton)
+@@ -44,6 +45,7 @@ BEGIN_EVENT_TABLE(CMuleNotebook, wxNotebook)
+       EVT_LEFT_UP(CMuleNotebook::OnMouseButtonRelease)
+       EVT_MIDDLE_UP(CMuleNotebook::OnMouseButtonRelease)
+       EVT_MOTION(CMuleNotebook::OnMouseMotion)
++      EVT_MULENOTEBOOK_DELETE_PAGE(wxID_ANY, CMuleNotebook::OnDeletePage)
+ END_EVENT_TABLE()
+ CMuleNotebook::CMuleNotebook( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name )
+@@ -60,6 +62,12 @@ CMuleNotebook::~CMuleNotebook()
+       DeleteAllPages();
+ }
++void CMuleNotebook::OnDeletePage(wxBookCtrlEvent& evt)
++{
++      int page = evt.GetSelection();
++      DeletePage(page);
++}
++
+ bool CMuleNotebook::DeletePage(int nPage)
+ {
+@@ -216,7 +224,14 @@ void CMuleNotebook::OnMouseButtonRelease(wxMouseEvent &event)
+       if ((tab != -1) &&  (((flags == wxNB_HITTEST_ONICON) && event.LeftUp()) ||
+                       ((flags == wxNB_HITTEST_ONLABEL) && event.MiddleUp()))) {
+               // User did click on a 'x' or middle click on the label
+-              DeletePage(tab);
++
++              /*      WORKAROUND: Instead of calling DeletePage, we need to wait for the
++               *      mouse release signal to reach Gtk. Inconsistent with normal wxEvent
++               *      behaviour the button release handler in wxWidgets don't evaluate
++               *      the result of the signal handling. */
++              wxNotebookEvent evt( wxEVT_COMMAND_MULENOTEBOOK_DELETE_PAGE, GetId(), tab );
++              evt.SetEventObject(this);
++              AddPendingEvent( evt );
+       } else {
+               // Is not a 'x'. Send this event up.
+               event.Skip();
+diff --git a/src/MuleNotebook.h b/src/MuleNotebook.h
+index dda097d07..ab2809d88 100644
+--- a/src/MuleNotebook.h
++++ b/src/MuleNotebook.h
+@@ -31,7 +31,16 @@
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_PAGE_CLOSING, -1)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_ALL_PAGES_CLOSED, -1)
++DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_DELETE_PAGE, -1)
++#define EVT_MULENOTEBOOK_DELETE_PAGE(id, fn)                                          \
++      DECLARE_EVENT_TABLE_ENTRY(                                                      \
++              wxEVT_COMMAND_MULENOTEBOOK_DELETE_PAGE,                                 \
++              id,                                                                     \
++              -1,                                                                     \
++              (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn,  \
++              NULL                                                                    \
++      ),
+ #define EVT_MULENOTEBOOK_PAGE_CLOSING(id, fn)                                         \
+       DECLARE_EVENT_TABLE_ENTRY(                                                      \
+               wxEVT_COMMAND_MULENOTEBOOK_PAGE_CLOSING,                                        \
+@@ -107,6 +116,10 @@ public:
+        */
+       void SetPopupHandler( wxWindow* widget );
++private:
++      // Internal handler. Workaround for wxWidgets Tab-Crash bug.
++      void OnDeletePage(wxBookCtrlEvent& evt);
++
+ protected:
+       /**
+        * Event handler for left or middle mouse button release (for closing pages)
+-- 
+2.16.4
+
diff --git a/net-p2p/amule/files/amule-2.3.2-fix-crash-closing-last-search-tab-2.patch b/net-p2p/amule/files/amule-2.3.2-fix-crash-closing-last-search-tab-2.patch
new file mode 100644 (file)
index 0000000..e47970b
--- /dev/null
@@ -0,0 +1,159 @@
+From 4c94c2d9f3be8b9068966f15aebc29b8c9b706ab Mon Sep 17 00:00:00 2001
+From: =?UTF-8?q?D=C3=A9vai=20Tam=C3=A1s?= <gonosztopi@amule.org>
+Date: Mon, 17 Oct 2016 22:14:26 +0200
+Subject: [PATCH] Apply the workaround only if needed
+
+This way it'll be easy for us to remove the workaround once wxWidgets fixes
+the bug.
+---
+ docs/Changelog       |  4 ++++
+ src/MuleNotebook.cpp | 19 ++++++++++++++-----
+ src/MuleNotebook.h   |  8 ++++++++
+ 3 files changed, 26 insertions(+), 5 deletions(-)
+
+diff --git a/docs/Changelog b/docs/Changelog
+index 7dbff70b2..e9176dd51 100644
+--- a/docs/Changelog
++++ b/docs/Changelog
+@@ -2,6 +2,10 @@ Version 2.4.0 - The river knows.
+ ----------
+ 201?-??-??
++      gaffatape:
++              * Workaround for bug in wxWidgets causing aMule to crash on
++                closing the last search tab
++
+       GonoszTopi:
+               * Fix restoring toolbar orientation on 'Cancel'
+diff --git a/src/MuleNotebook.cpp b/src/MuleNotebook.cpp
+index 4ab23ce18..5d3ad0453 100644
+--- a/src/MuleNotebook.cpp
++++ b/src/MuleNotebook.cpp
+@@ -32,7 +32,10 @@
+ DEFINE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_PAGE_CLOSING)
+ DEFINE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_ALL_PAGES_CLOSED)
++
++#if MULE_NEEDS_DELETEPAGE_WORKAROUND
+ DEFINE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_DELETE_PAGE)
++#endif
+ BEGIN_EVENT_TABLE(CMuleNotebook, wxNotebook)
+       EVT_RIGHT_DOWN(CMuleNotebook::OnRMButton)
+@@ -45,9 +48,12 @@ BEGIN_EVENT_TABLE(CMuleNotebook, wxNotebook)
+       EVT_LEFT_UP(CMuleNotebook::OnMouseButtonRelease)
+       EVT_MIDDLE_UP(CMuleNotebook::OnMouseButtonRelease)
+       EVT_MOTION(CMuleNotebook::OnMouseMotion)
++#if MULE_NEEDS_DELETEPAGE_WORKAROUND
+       EVT_MULENOTEBOOK_DELETE_PAGE(wxID_ANY, CMuleNotebook::OnDeletePage)
++#endif
+ END_EVENT_TABLE()
++
+ CMuleNotebook::CMuleNotebook( wxWindow *parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style, const wxString& name )
+       : wxNotebook(parent, id, pos, size, style, name)
+ {
+@@ -62,11 +68,14 @@ CMuleNotebook::~CMuleNotebook()
+       DeleteAllPages();
+ }
++
++#if MULE_NEEDS_DELETEPAGE_WORKAROUND
+ void CMuleNotebook::OnDeletePage(wxBookCtrlEvent& evt)
+ {
+       int page = evt.GetSelection();
+       DeletePage(page);
+ }
++#endif // MULE_NEEDS_DELETEPAGE_WORKAROUND
+ bool CMuleNotebook::DeletePage(int nPage)
+@@ -208,7 +217,6 @@ void CMuleNotebook::OnPopupCloseOthers(wxCommandEvent& WXUNUSED(evt))
+ void CMuleNotebook::OnMouseButtonRelease(wxMouseEvent &event)
+ {
+-
+       if (GetImageList() == NULL) {
+               // This Mulenotebook has no images on tabs, so nothing to do.
+               event.Skip();
+@@ -224,7 +232,7 @@ void CMuleNotebook::OnMouseButtonRelease(wxMouseEvent &event)
+       if ((tab != -1) &&  (((flags == wxNB_HITTEST_ONICON) && event.LeftUp()) ||
+                       ((flags == wxNB_HITTEST_ONLABEL) && event.MiddleUp()))) {
+               // User did click on a 'x' or middle click on the label
+-
++#if MULE_NEEDS_DELETEPAGE_WORKAROUND
+               /*      WORKAROUND: Instead of calling DeletePage, we need to wait for the
+                *      mouse release signal to reach Gtk. Inconsistent with normal wxEvent
+                *      behaviour the button release handler in wxWidgets don't evaluate
+@@ -232,16 +240,18 @@ void CMuleNotebook::OnMouseButtonRelease(wxMouseEvent &event)
+               wxNotebookEvent evt( wxEVT_COMMAND_MULENOTEBOOK_DELETE_PAGE, GetId(), tab );
+               evt.SetEventObject(this);
+               AddPendingEvent( evt );
++#else
++              DeletePage(tab);
++#endif // MULE_NEEDS_DELETEPAGE_WORKAROUND
+       } else {
+               // Is not a 'x'. Send this event up.
+               event.Skip();
+       }
+-
+ }
++
+ void CMuleNotebook::OnMouseMotion(wxMouseEvent &event)
+ {
+-
+       if (GetImageList() == NULL) {
+               // This Mulenotebook has no images on tabs, so nothing to do.
+               event.Skip();
+@@ -263,7 +273,6 @@ void CMuleNotebook::OnMouseMotion(wxMouseEvent &event)
+               // Is not a 'x'. Send this event up.
+               event.Skip();
+       }
+-
+ }
+ // File_checked_for_headers
+diff --git a/src/MuleNotebook.h b/src/MuleNotebook.h
+index ab2809d88..14f61ee68 100644
+--- a/src/MuleNotebook.h
++++ b/src/MuleNotebook.h
+@@ -28,9 +28,13 @@
+ #include <wx/notebook.h>
++#define MULE_NEEDS_DELETEPAGE_WORKAROUND      wxCHECK_VERSION(3,0,2)
++
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_PAGE_CLOSING, -1)
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_ALL_PAGES_CLOSED, -1)
++
++#if MULE_NEEDS_DELETEPAGE_WORKAROUND
+ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_DELETE_PAGE, -1)
+ #define EVT_MULENOTEBOOK_DELETE_PAGE(id, fn)                                          \
+@@ -41,6 +45,8 @@ DECLARE_LOCAL_EVENT_TYPE(wxEVT_COMMAND_MULENOTEBOOK_DELETE_PAGE, -1)
+               (wxObjectEventFunction)(wxEventFunction)(wxNotebookEventFunction) &fn,  \
+               NULL                                                                    \
+       ),
++#endif // MULE_NEEDS_DELETEPAGE_WORKAROUND
++
+ #define EVT_MULENOTEBOOK_PAGE_CLOSING(id, fn)                                         \
+       DECLARE_EVENT_TABLE_ENTRY(                                                      \
+               wxEVT_COMMAND_MULENOTEBOOK_PAGE_CLOSING,                                        \
+@@ -116,9 +122,11 @@ public:
+        */
+       void SetPopupHandler( wxWindow* widget );
++#if MULE_NEEDS_DELETEPAGE_WORKAROUND
+ private:
+       // Internal handler. Workaround for wxWidgets Tab-Crash bug.
+       void OnDeletePage(wxBookCtrlEvent& evt);
++#endif // MULE_NEEDS_DELETEPAGE_WORKAROUND
+ protected:
+       /**
+-- 
+2.16.4
+
diff --git a/net-p2p/amule/files/amule-2.3.2-fix-crash-shared-dir-utf8.patch b/net-p2p/amule/files/amule-2.3.2-fix-crash-shared-dir-utf8.patch
new file mode 100644 (file)
index 0000000..aa92ff6
--- /dev/null
@@ -0,0 +1,78 @@
+From 17816ed02f59bab9c27310e7f24c73266b0a3003 Mon Sep 17 00:00:00 2001
+From: persmule <persmule@gmail.com>
+Date: Wed, 5 Oct 2016 13:47:46 +0800
+Subject: [PATCH] Add a routine to set file name conversion for amuled which
+ based on wxAppConsole
+
+---
+ src/amule.h    |  7 +++++++
+ src/amuled.cpp | 35 +++++++++++++++++++++++++++++++++++
+ 2 files changed, 42 insertions(+)
+
+diff --git a/src/amule.h b/src/amule.h
+index f25702f60..240c02dd9 100644
+--- a/src/amule.h
++++ b/src/amule.h
+@@ -553,6 +553,13 @@ private:
+       int OnExit();
+       virtual int InitGui(bool geometry_enable, wxString &geometry_string);
++      // The GTK wxApps sets its file name conversion properly
++      // in wxApp::Initialize(), while wxAppConsole::Initialize()
++      // does not, leaving wxConvFile being set to wxConvLibc. File
++      // name conversion should be set otherwise amuled will abort to
++      // handle non-ASCII file names which monolithic amule can handle.
++      // This function are overrided to perform this.
++      virtual bool Initialize(int& argc_, wxChar **argv_);
+ #ifdef AMULED_APPTRAITS
+       struct sigaction m_oldSignalChildAction;
+diff --git a/src/amuled.cpp b/src/amuled.cpp
+index 486da5973..86e1ff8b8 100644
+--- a/src/amuled.cpp
++++ b/src/amuled.cpp
+@@ -704,6 +704,41 @@ int CamuleDaemonApp::InitGui(bool ,wxString &)
+       return 0;
+ }
++bool CamuleDaemonApp::Initialize(int& argc_, wxChar **argv_)
++{
++      if ( !wxAppConsole::Initialize(argc_, argv_) ) {
++              return false;
++      }
++
++#ifdef __UNIX__
++      wxString encName;
++#if wxUSE_INTL
++      // if a non default locale is set,
++      // assume that the user wants his
++        // filenames in this locale too
++        encName = wxLocale::GetSystemEncodingName().Upper();
++
++        // But don't consider ASCII in this case.
++      if ( !encName.empty() ) {
++              if ( encName == wxT("US-ASCII") ) {
++                      // This means US-ASCII when returned
++                      // from GetEncodingFromName().
++                      encName.clear();
++              }
++        }
++#endif // wxUSE_INTL
++
++      // in this case, UTF-8 is used by default.
++        if ( encName.empty() ) {
++              encName = wxT("UTF-8");
++      }
++
++      static wxConvBrokenFileNames fileconv(encName);
++      wxConvFileName = &fileconv;
++#endif // __UNIX__
++
++      return true;
++}
+ int CamuleDaemonApp::OnExit()
+ {
+-- 
+2.16.4
+