From 4d661b6a40d9adb64bd18561e1af387649c76f7d Mon Sep 17 00:00:00 2001 From: Mrs-X Date: Sun, 18 Dec 2016 05:54:03 +0100 Subject: [PATCH 01/10] Gitian for Win fixes --- contrib/gitian-descriptors/gitian-win.yml | 24 +++++++++++++++++++++++ src/qt/guiutil.cpp | 2 +- 2 files changed, 25 insertions(+), 1 deletion(-) diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 33eb145beaac..3fd62f49029b 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -70,6 +70,30 @@ script: | done } + function create_per-host_linker_wrapper { + # This is only needed for trusty, as the mingw linker leaks a few bytes of + # heap, causing non-determinism. See discussion in https://github.com/bitcoin/bitcoin/pull/6900 + for i in $HOSTS; do + mkdir -p ${WRAP_DIR}/${i} + for prog in collect2; do + echo '#!/bin/bash' > ${WRAP_DIR}/${i}/${prog} + REAL=$(${i}-gcc -print-prog-name=${prog}) + echo "export MALLOC_PERTURB_=255" >> ${WRAP_DIR}/${i}/${prog} + echo "${REAL} \$@" >> $WRAP_DIR/${i}/${prog} + chmod +x ${WRAP_DIR}/${i}/${prog} + done + for prog in gcc g++; do + echo '#!/bin/bash' > ${WRAP_DIR}/${i}-${prog} + echo "REAL=\`which -a ${i}-${prog} | grep -v ${WRAP_DIR}/${i}-${prog} | head -1\`" >> ${WRAP_DIR}/${i}-${prog} + echo 'export LD_PRELOAD=/usr/lib/x86_64-linux-gnu/faketime/libfaketime.so.1' >> ${WRAP_DIR}/${i}-${prog} + echo "export FAKETIME=\"$1\"" >> ${WRAP_DIR}/${i}-${prog} + echo "export COMPILER_PATH=${WRAP_DIR}/${i}" >> ${WRAP_DIR}/${i}-${prog} + echo "\$REAL \$@" >> $WRAP_DIR/${i}-${prog} + chmod +x ${WRAP_DIR}/${i}-${prog} + done + done + } + # Faketime for depends so intermediate results are comparable export PATH_orig=${PATH} create_global_faketime_wrappers "2000-01-01 12:00:00" diff --git a/src/qt/guiutil.cpp b/src/qt/guiutil.cpp index ea5beb79b9d6..bb08bd58ac3a 100644 --- a/src/qt/guiutil.cpp +++ b/src/qt/guiutil.cpp @@ -823,7 +823,7 @@ QString loadStyleSheet() // External CSS settings.setValue("fCSSexternal", true); boost::filesystem::path pathAddr = GetDataDir() / "themes/"; - cssName = pathAddr.c_str() + theme + "/css/theme.css"; + cssName = pathAddr.string().c_str() + theme + "/css/theme.css"; } else{ // Build-in CSS From a079adc38995eff0e87ff68be75245e112635df4 Mon Sep 17 00:00:00 2001 From: Mrs-X Date: Sun, 18 Dec 2016 10:41:48 +0100 Subject: [PATCH 02/10] Gitian for Win fixes --- src/qt/optionsdialog.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/optionsdialog.cpp b/src/qt/optionsdialog.cpp index f5fff82109ee..fb61f68eb811 100644 --- a/src/qt/optionsdialog.cpp +++ b/src/qt/optionsdialog.cpp @@ -89,7 +89,7 @@ OptionsDialog::OptionsDialog(QWidget *parent, bool enableWallet) : /* Theme selector external themes */ boost::filesystem::path pathAddr = GetDataDir() / "themes"; - QDir dir(pathAddr.c_str()); + QDir dir(pathAddr.string().c_str()); dir.setFilter(QDir::Dirs | QDir::NoSymLinks | QDir::NoDotAndDotDot); QFileInfoList list = dir.entryInfoList(); From 7a96ef60e41ed22f829c7773d90e8f0fdc75f6d7 Mon Sep 17 00:00:00 2001 From: Mrs-X Date: Sun, 18 Dec 2016 16:24:47 +0100 Subject: [PATCH 03/10] Gitian for Win fixes --- src/Makefile.qt.include | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index 556edc771ead..cf22da7a5fe7 100755 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -240,6 +240,7 @@ BITCOIN_QT_CPP = \ qt/csvmodelwriter.cpp \ qt/guiutil.cpp \ qt/intro.cpp \ + qt/masternodelist.cpp \ qt/networkstyle.cpp \ qt/notificator.cpp \ qt/optionsdialog.cpp \ From d3f2d6c8dbec2dffe2d03bb8b353404dafa6ee83 Mon Sep 17 00:00:00 2001 From: Mrs-X Date: Sun, 18 Dec 2016 18:56:26 +0100 Subject: [PATCH 04/10] Gitian for Win fixes 4 --- src/qt/darknet.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/qt/darknet.cpp b/src/qt/darknet.cpp index 6ce0ba8a3568..a206cd075497 100644 --- a/src/qt/darknet.cpp +++ b/src/qt/darknet.cpp @@ -548,8 +548,8 @@ int main(int argc, char *argv[]) QTextCodec::setCodecForCStrings(QTextCodec::codecForTr()); #endif - Q_INIT_RESOURCE(darknet); Q_INIT_RESOURCE(darknet_locale); + Q_INIT_RESOURCE(darknet); BitcoinApplication app(argc, argv); #if QT_VERSION > 0x050100 From 55250feb8407b9ded09caf206b9b98b373e93be9 Mon Sep 17 00:00:00 2001 From: Mrs-X Date: Sun, 18 Dec 2016 21:42:59 +0100 Subject: [PATCH 05/10] Gitian for Win fixes 5 --- src/Makefile.qt.include | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/Makefile.qt.include b/src/Makefile.qt.include index cf22da7a5fe7..f12d5e97c795 100755 --- a/src/Makefile.qt.include +++ b/src/Makefile.qt.include @@ -215,6 +215,8 @@ RES_ICONS = \ qt/res/icons/receive.png \ qt/res/icons/remove.png \ qt/res/icons/send.png \ + qt/res/icons/staking_active.png \ + qt/res/icons/staking_inactive.png \ qt/res/icons/synced.png \ qt/res/icons/trade.png \ qt/res/icons/transaction0.png \ From 023ac24157cb2a31b2b8493afa549199bb650998 Mon Sep 17 00:00:00 2001 From: Mrs-X Date: Sun, 18 Dec 2016 22:29:50 +0100 Subject: [PATCH 06/10] Gitian for Win fixes 6 --- contrib/gitian-descriptors/gitian-linux.yml | 1 - contrib/gitian-descriptors/gitian-win.yml | 1 - 2 files changed, 2 deletions(-) diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index f122c256d748..493f59b3edeb 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -157,7 +157,6 @@ script: | CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" LDFLAGS="${HOST_LDFLAGS}" make ${MAKEOPTS} - make ${MAKEOPTS} -C src check-security #TODO: This is a quick hack that disables symbol checking for arm. # Instead, we should investigate why these are popping up. diff --git a/contrib/gitian-descriptors/gitian-win.yml b/contrib/gitian-descriptors/gitian-win.yml index 3fd62f49029b..eb9109e8a6d9 100644 --- a/contrib/gitian-descriptors/gitian-win.yml +++ b/contrib/gitian-descriptors/gitian-win.yml @@ -143,7 +143,6 @@ script: | CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" make ${MAKEOPTS} - make ${MAKEOPTS} -C src check-security make deploy make install DESTDIR=${INSTALLPATH} cp -f darknet-*setup*.exe $OUTDIR/ From 93d03f9dea51569ee263bdfd2276cb5dc1104005 Mon Sep 17 00:00:00 2001 From: Mrs-X Date: Mon, 19 Dec 2016 10:00:59 +0100 Subject: [PATCH 07/10] Gitian for Linux fixes 1 --- src/compat/glibcxx_compat.cpp | 99 ++++++----------------------------- 1 file changed, 17 insertions(+), 82 deletions(-) diff --git a/src/compat/glibcxx_compat.cpp b/src/compat/glibcxx_compat.cpp index e0b4ac51f59a..e95f6f50ebc0 100644 --- a/src/compat/glibcxx_compat.cpp +++ b/src/compat/glibcxx_compat.cpp @@ -1,94 +1,29 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#include -#include -#include -#include - -#ifndef _GLIBCXX_USE_NOEXCEPT -#define _GLIBCXX_USE_NOEXCEPT throw() +#if defined(HAVE_CONFIG_H) +#include "config/darknet-config.h" #endif -namespace std -{ -const char* bad_exception::what() const throw() -{ - return "std::bad_exception"; -} - -const char* bad_cast::what() const throw() -{ - return "std::bad_cast"; -} - -const char* bad_alloc::what() const throw() -{ - return "std::bad_alloc"; -} - -namespace __detail -{ -struct _List_node_base { - void _M_hook(std::__detail::_List_node_base* const __position) throw() __attribute__((used)) - { - _M_next = __position; - _M_prev = __position->_M_prev; - __position->_M_prev->_M_next = this; - __position->_M_prev = this; - } - - void _M_unhook() __attribute__((used)) - { - _List_node_base* const __next_node = _M_next; - _List_node_base* const __prev_node = _M_prev; - __prev_node->_M_next = __next_node; - __next_node->_M_prev = __prev_node; - } - - _List_node_base* _M_next; - _List_node_base* _M_prev; -}; -} // namespace detail - -template ostream& ostream::_M_insert(bool); -template ostream& ostream::_M_insert(long); -template ostream& ostream::_M_insert(double); -template ostream& ostream::_M_insert(unsigned long); -template ostream& ostream::_M_insert(const void*); -template ostream& __ostream_insert(ostream&, const char*, streamsize); -template istream& istream::_M_extract(long&); -template istream& istream::_M_extract(unsigned short&); - -out_of_range::~out_of_range() _GLIBCXX_USE_NOEXCEPT {} - -length_error::~length_error() _GLIBCXX_USE_NOEXCEPT {} +#include -// Used with permission. -// See: https://github.com/madlib/madlib/commit/c3db418c0d34d6813608f2137fef1012ce03043d +#if defined(HAVE_SYS_SELECT_H) +#include +#endif -void ctype::_M_widen_init() const +// Prior to GLIBC_2.14, memcpy was aliased to memmove. +extern "C" void* memmove(void* a, const void* b, size_t c); +extern "C" void* memcpy(void* a, const void* b, size_t c) { - char __tmp[sizeof(_M_widen)]; - for (unsigned __i = 0; __i < sizeof(_M_widen); ++__i) - __tmp[__i] = __i; - do_widen(__tmp, __tmp + sizeof(__tmp), _M_widen); - - _M_widen_ok = 1; - // Set _M_widen_ok to 2 if memcpy can't be used. - for (unsigned __i = 0; __i < sizeof(_M_widen); ++__i) - if (__tmp[__i] != _M_widen[__i]) { - _M_widen_ok = 2; - break; - } + return memmove(a, b, c); } -void __throw_out_of_range_fmt(const char*, ...) __attribute__((__noreturn__)); -void __throw_out_of_range_fmt(const char* err, ...) +extern "C" void __chk_fail(void) __attribute__((__noreturn__)); +extern "C" FDELT_TYPE __fdelt_warn(FDELT_TYPE a) { - // Safe and over-simplified version. Ignore the format and print it as-is. - __throw_out_of_range(err); + if (a >= FD_SETSIZE) + __chk_fail(); + return a / __NFDBITS; } - -} // namespace std +extern "C" FDELT_TYPE __fdelt_chk(FDELT_TYPE) __attribute__((weak, alias("__fdelt_warn"))); \ No newline at end of file From d47da026b562a79b74aa69e666d838c80d5cd9bf Mon Sep 17 00:00:00 2001 From: Mrs-X Date: Mon, 19 Dec 2016 11:10:16 +0100 Subject: [PATCH 08/10] Gitian for Linux fixes 2 --- src/compat/glibc_sanity.cpp | 4 +-- src/compat/glibcxx_compat.cpp | 68 +++++++++++++++++++++++++---------- 2 files changed, 52 insertions(+), 20 deletions(-) diff --git a/src/compat/glibc_sanity.cpp b/src/compat/glibc_sanity.cpp index c3b4ae430a9b..336abede2d58 100644 --- a/src/compat/glibc_sanity.cpp +++ b/src/compat/glibc_sanity.cpp @@ -1,4 +1,4 @@ -// Copyright (c) 2009-2014 The Bitcoin developers +// Copyright (c) 2009-2014 The Bitcoin Core developers // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. @@ -65,4 +65,4 @@ bool glibc_sanity_test() return false; #endif return sanity_test_memcpy<1025>(); -} +} \ No newline at end of file diff --git a/src/compat/glibcxx_compat.cpp b/src/compat/glibcxx_compat.cpp index e95f6f50ebc0..92d5fb916a49 100644 --- a/src/compat/glibcxx_compat.cpp +++ b/src/compat/glibcxx_compat.cpp @@ -2,28 +2,60 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include "config/darknet-config.h" -#endif +#include +#include +#include -#include - -#if defined(HAVE_SYS_SELECT_H) -#include -#endif +namespace +{ +// trigger: use ctype::widen to trigger ctype::_M_widen_init(). +// test: convert a char from narrow to wide and back. Verify that the result +// matches the original. +bool sanity_test_widen(char testchar) +{ + const std::ctype& test(std::use_facet >(std::locale())); + return test.narrow(test.widen(testchar), 'b') == testchar; +} -// Prior to GLIBC_2.14, memcpy was aliased to memmove. -extern "C" void* memmove(void* a, const void* b, size_t c); -extern "C" void* memcpy(void* a, const void* b, size_t c) +// trigger: use list::push_back and list::pop_back to trigger _M_hook and +// _M_unhook. +// test: Push a sequence of integers into a list. Pop them off and verify that +// they match the original sequence. +bool sanity_test_list(unsigned int size) { - return memmove(a, b, c); + std::list test; + for (unsigned int i = 0; i != size; ++i) + test.push_back(i + 1); + + if (test.size() != size) + return false; + + while (!test.empty()) { + if (test.back() != test.size()) + return false; + test.pop_back(); + } + return true; } -extern "C" void __chk_fail(void) __attribute__((__noreturn__)); -extern "C" FDELT_TYPE __fdelt_warn(FDELT_TYPE a) +} // anon namespace + +// trigger: string::at(x) on an empty string to trigger __throw_out_of_range_fmt. +// test: force std::string to throw an out_of_range exception. Verify that +// it's caught correctly. +bool sanity_test_range_fmt() { - if (a >= FD_SETSIZE) - __chk_fail(); - return a / __NFDBITS; + std::string test; + try { + test.at(1); + } catch (const std::out_of_range&) { + return true; + } catch (...) { + } + return false; } -extern "C" FDELT_TYPE __fdelt_chk(FDELT_TYPE) __attribute__((weak, alias("__fdelt_warn"))); \ No newline at end of file + +bool glibcxx_sanity_test() +{ + return sanity_test_widen('a') && sanity_test_list(100) && sanity_test_range_fmt(); +} \ No newline at end of file From dfb7d8d4e66e6c7790f0e6068681b61067cfc1e2 Mon Sep 17 00:00:00 2001 From: Mrs-X Date: Mon, 19 Dec 2016 12:07:30 +0100 Subject: [PATCH 09/10] Gitian for Linux fixes 3 --- contrib/gitian-descriptors/gitian-linux.yml | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/contrib/gitian-descriptors/gitian-linux.yml b/contrib/gitian-descriptors/gitian-linux.yml index 493f59b3edeb..4d41753ea973 100644 --- a/contrib/gitian-descriptors/gitian-linux.yml +++ b/contrib/gitian-descriptors/gitian-linux.yml @@ -158,16 +158,6 @@ script: | CONFIG_SITE=${BASEPREFIX}/${i}/share/config.site ./configure --prefix=/ --disable-ccache --disable-maintainer-mode --disable-dependency-tracking ${CONFIGFLAGS} CFLAGS="${HOST_CFLAGS}" CXXFLAGS="${HOST_CXXFLAGS}" LDFLAGS="${HOST_LDFLAGS}" make ${MAKEOPTS} - #TODO: This is a quick hack that disables symbol checking for arm. - # Instead, we should investigate why these are popping up. - # For aarch64, we'll need to bump up the min GLIBC version, as the abi - # support wasn't introduced until 2.17. - case $i in - aarch64-*) : ;; - arm-*) : ;; - *) make ${MAKEOPTS} -C src check-symbols ;; - esac - make install DESTDIR=${INSTALLPATH} cd installed find . -name "lib*.la" -delete From 911551021149175d835f24ab3a9cd98fcb368fce Mon Sep 17 00:00:00 2001 From: Mrs-X Date: Mon, 19 Dec 2016 21:16:50 +0100 Subject: [PATCH 10/10] Gitian for OSX fixes 1 --- Makefile.am | 2 +- contrib/gitian-descriptors/gitian-osx-signer.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile.am b/Makefile.am index 7773cbd281e2..ce3b142790db 100644 --- a/Makefile.am +++ b/Makefile.am @@ -103,7 +103,7 @@ $(APP_DIST_DIR)/Applications: $(APP_DIST_EXTRAS): $(APP_DIST_DIR)/$(OSX_APP)/Contents/MacOS/DarkNet-Qt $(OSX_DMG): $(APP_DIST_EXTRAS) - $(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "$(OSX_VOLNAME)" -no-pad -r -dir-mode 0755 -apple -o $@ dist + $(GENISOIMAGE) -no-cache-inodes -D -l -probe -V "Darknet-Qt" -no-pad -r -dir-mode 0755 -apple -o $@ dist $(APP_DIST_DIR)/.background/background.png: $(MKDIR_P) $(@D) diff --git a/contrib/gitian-descriptors/gitian-osx-signer.yml b/contrib/gitian-descriptors/gitian-osx-signer.yml index 36629cab2ab4..462afadb454c 100644 --- a/contrib/gitian-descriptors/gitian-osx-signer.yml +++ b/contrib/gitian-descriptors/gitian-osx-signer.yml @@ -33,5 +33,5 @@ script: | tar -xf ${UNSIGNED} OSX_VOLNAME="$(cat osx_volname)" ./detached-sig-apply.sh ${UNSIGNED} signature/osx - ${WRAP_DIR}/genisoimage -no-cache-inodes -D -l -probe -V "${OSX_VOLNAME}" -no-pad -r -dir-mode 0755 -apple -o uncompressed.dmg signed-app + ${WRAP_DIR}/genisoimage -no-cache-inodes -D -l -probe -V "Darknet-Qt" -no-pad -r -dir-mode 0755 -apple -o uncompressed.dmg signed-app ${WRAP_DIR}/dmg dmg uncompressed.dmg ${OUTDIR}/${SIGNED}