If the source and replacement strings were the same length, the code
was performing undefined pointer arithmetic involving a NULL pointer.
I'm not aware of any observable effects of this in practice, but it's
potentially problematic. It's detected by ubsan, for example when
running `make check-python-test-suite`:
DOH/string.c:839:4: runtime error: applying non-zero offset to non-null pointer 0x602000001558 produced null pointer
SUMMARY: UndefinedBehaviorSanitizer: undefined-behavior DOH/string.c:839:4 in
Occurs when using the director class from multiple threads - a race condition
initialising block scope static variables.
Block scope static variables are guaranteed to be thread safe in C++11,
so the fix is guaranteed when using C++11. However, most modern compilers
also fix it when using C++03/C++98.
Closes#1862
* remove-dependency-on-2to3:
Remove need for Python 2to3
Modify examples to be both Python 2 and 3 compatible
Remove python3 specific runme3.py test files
Convert python tests using 2to3
Convert python test scripts to be Python 2 and 3 compatible
Convert swigobject python test to be python 2 and 3 compatible
Convert two tests to work with both Python 2 and 3
Improve director_exception Python test
Remove further print statements from Python tests
Improve Python testing catching exceptions
Improve contract Python testcase testing
Remove print statements from Python tests
All Python examples and tests have been written to be both Python 2 and Python 3
compatible, removing the need for 2to3 to run the examples or test-suite.
The 2to3 executable is not always available and even when available does not
always work, e.g. with pyenv. An alternative would be to use the lib2to3 Python
module instead, but this isn't available in some older versions of Python 3.
I had this problem on Ubuntu Bionic on Travis:
checking Examples/python/callback
pyenv: 2to3-3.8: command not found
The `2to3-3.8' command exists in these Python versions:
3.8
3.8.1
Reference issues:
https://github.com/pypa/virtualenv/issues/1399https://travis-ci.community/t/2to3-command-not-found-in-venv-in-bionic/4495
Android builds all host tools with -Werror=no-return, which generates a
false positive in name_regexmatch_value() if HAVE_PCRE is not present.
Fix this by adding a return code to the !HAVE_PCRE path. This return
will not be reached but will suppress the compiler warning.
If/when SWIG can require C++11 compilers, a better fix would be to make
SWIG_exit() [[noreturn]].
Closes#1860
AC_CHECK_PROGS will find the tool using exactly the name given: it
only searches for "pkg-config". When doing native builds, this is
generally fine. However, when cross-compiling, this is not ideal
as `pkg-config` is often configured for the build system, not the
system we want to cross-compile for.
Switch to using the AC_PATH_TOOL tool instead. This will look for
"pkg-config" with a $host- prefix first before falling back to the
plain "pkg-config". When doing native builds, things should still
behave the same, but now things work better out of the box when we
cross-compile.
For example, `./configure --host=aarch64-linux-gnu` will first look
for "aarch64-linux-gnu-pkg-config" before falling back to the plain
"pkg-config".