From f027fac8a2a4becddbc4e37bec5786d21c58cea6 Mon Sep 17 00:00:00 2001 From: Kovid Goyal Date: Mon, 4 Oct 2021 14:39:42 +0530 Subject: [PATCH] Use the new env var to disable RTLD_DEEPBIND for pycryptodome when running the tests with sanitization enabled --- setup/arch-ci.sh | 1 + setup/test.py | 6 ++++-- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/setup/arch-ci.sh b/setup/arch-ci.sh index 4db0bfb65c..3163434a5f 100755 --- a/setup/arch-ci.sh +++ b/setup/arch-ci.sh @@ -8,6 +8,7 @@ set -xe pacman -S --noconfirm --needed base-devel sudo git sip pyqt-builder chmlib icu jxrlib hunspell libmtp libusb libwmf optipng podofo python-apsw python-beautifulsoup4 python-cssselect python-css-parser python-dateutil python-jeepney python-dnspython python-dukpy python-feedparser python-html2text python-html5-parser python-lxml python-markdown python-mechanize python-msgpack python-netifaces python-unrardll python-pillow python-psutil python-pygments python-pyqt5 python-regex python-zeroconf python-pyqtwebengine qt5-x11extras qt5-svg qt5-imageformats udisks2 hyphen python-pychm python-pycryptodome speech-dispatcher python-sphinx python-urllib3 python-py7zr python-pip python-cchardet libstemmer # See https://github.com/Legrandin/pycryptodome/issues/376 +# Can be removed when https://github.com/Legrandin/pycryptodome/issues/558 is released file_to_patch=$(pacman -Ql python-pycryptodome | grep _raw_api.py$ | cut -d" " -f2) echo "Patching $file_to_patch" sed -i 's/RTLD_DEEPBIND/RTLD_DEEPBIND_DISABLED_BY_KOVID/g' "$file_to_patch" diff --git a/setup/test.py b/setup/test.py index 633ae04522..9479c322ae 100644 --- a/setup/test.py +++ b/setup/test.py @@ -181,9 +181,11 @@ class Test(Command): help='Run the test suite with the sanitizer preloaded') def run(self, opts): - if opts.under_sanitize and 'libasan' not in os.environ.get('LD_PRELOAD', ''): - os.environ['LD_PRELOAD'] = os.path.abspath(subprocess.check_output('gcc -print-file-name=libasan.so'.split()).decode('utf-8').strip()) + if opts.under_sanitize: + if 'libasan' not in os.environ.get('LD_PRELOAD', ''): + os.environ['LD_PRELOAD'] = os.path.abspath(subprocess.check_output('gcc -print-file-name=libasan.so'.split()).decode('utf-8').strip()) os.environ['ASAN_OPTIONS'] = 'detect_leaks=0' + os.environ['PYCRYPTODOME_DISABLE_DEEPBIND'] = 1 # https://github.com/Legrandin/pycryptodome/issues/558 self.info(f'Re-execing with LD_PRELOAD={os.environ["LD_PRELOAD"]}') sys.stdout.flush() os.execl('setup.py', *sys.argv)