diff options
author | Simon McVittie <smcv@collabora.com> | 2021-07-19 14:45:11 +0000 |
---|---|---|
committer | Simon McVittie <smcv@collabora.com> | 2021-07-19 14:45:11 +0000 |
commit | 6772bc492b359d6bc3de7b862a94ce93afc8d815 (patch) | |
tree | b7adb7d9ecf07c03e3e183ee0f05e150afb8703f | |
parent | e4e401127bbd323b220ca07aa08eafd0fb4c0270 (diff) | |
parent | 26786ced3b924681d3e763321249b87206d9c379 (diff) | |
download | dbus-python-6772bc492b359d6bc3de7b862a94ce93afc8d815.tar.gz |
Merge branch 'wip/smcv/misc' into 'master'
unixfd: Don't leak self if variant_level < 0
See merge request dbus/dbus-python!11
-rw-r--r-- | .gitlab-ci.yml | 9 | ||||
-rw-r--r-- | .travis.yml | 65 | ||||
-rw-r--r-- | CONTRIBUTING.md | 2 | ||||
-rw-r--r-- | Makefile.am | 1 | ||||
-rw-r--r-- | NEWS | 19 | ||||
-rw-r--r-- | dbus_bindings/unixfd.c | 9 | ||||
-rwxr-xr-x | test/test-standalone.py | 3 | ||||
-rwxr-xr-x | tools/ci-build.sh | 25 |
8 files changed, 36 insertions, 97 deletions
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 0373c7d..9753202 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -95,4 +95,13 @@ build:python3.9-dbg: dbus_ci_system_python_module_suffix: -dbg script: *script +build:python3.10: + stage: build + image: "ubuntu:impish" + variables: + ci_distro: ubuntu + ci_suite: impish + dbus_ci_system_python: python3.10 + script: *script + # vim:set sw=2 sts=2 et: diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 62e671a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,65 +0,0 @@ -# Copyright © 2016 Simon McVittie -# -# SPDX-License-Identifier: MIT -# -# Permission is hereby granted, free of charge, to any person -# obtaining a copy of this software and associated documentation -# files (the "Software"), to deal in the Software without -# restriction, including without limitation the rights to use, copy, -# modify, merge, publish, distribute, sublicense, and/or sell copies -# of the Software, and to permit persons to whom the Software is -# furnished to do so, subject to the following conditions: -# -# The above copyright notice and this permission notice shall be -# included in all copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND -# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT -# HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, -# WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -# DEALINGS IN THE SOFTWARE. - -sudo: required -dist: xenial -language: python -cache: - pip: true - directories: - - $HOME/.ccache -install: - - test -z "$dbus_ci_system_python" || deactivate - - ./tools/ci-install.sh -python: - - "3.6" - - "3.6-dev" - - "3.7-dev" - - "3.8-dev" - - "nightly" -script: - - PATH="/usr/lib/ccache:$PATH" ./tools/ci-build.sh - -matrix: - include: - - python: "2.7" - env: - dbus_ci_system_python=python - - python: "2.7" - env: - dbus_ci_system_python=python-dbg - - python: "3.5" - env: - dbus_ci_system_python=python3 - - python: "3.5" - env: - dbus_ci_system_python=python3-dbg - - python: "3.7" - env: - ci_distro=debian ci_docker=debian:buster-slim ci_suite=buster dbus_ci_system_python=python3 - - python: "3.7" - env: - ci_distro=debian ci_docker=debian:buster-slim ci_suite=buster dbus_ci_system_python=python3-dbg - -# vim:set sw=2 sts=2 et: diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 75937a6..7b1da64 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -165,7 +165,7 @@ so you should have an issue number or a merge request ID to refer to. #### Pre-release steps -* Make sure CI (currently Travis-CI and Gitlab) is passing +* Make sure CI (currently Gitlab-CI) is passing * Update `NEWS` and the version number in `configure.ac`, and commit them #### Building and uploading the release diff --git a/Makefile.am b/Makefile.am index 5780cce..0fd75c2 100644 --- a/Makefile.am +++ b/Makefile.am @@ -11,7 +11,6 @@ CLEANFILES = \ test/test-service.log \ $(NULL) EXTRA_DIST = \ - .travis.yml \ AUTHORS \ CONTRIBUTING.md \ COPYING \ @@ -3,13 +3,21 @@ dbus Python Bindings 1.2.18 (UNRELEASED) Fixes: +• Move from collections.Sequence to collections.abc.Sequence on + Python ≥ 3.3, for Python 3.10 compatibility + (dbus-python#37, Simon McVittie) + • Avoid another deprecation warning for inspect.getargspec(). This is similar to the one fixed in 1.2.4, but for dbus.decorators.signal rather than dbus.decorators.method. (dbus-python!8; Martin Stumpf) +• Fix an unlikely fd leak if memory allocation fails for UnixFd + (dbus-python!9, Red Hat #1938703; David King) + +• Fix memory and fd leak if UnixFd is given an invalid negative + variant_level (Simon McVittie) + • Avoid more deprecation warnings: - - collections.Sequence (now used via collections.abc.Sequence on - Python ≥ 3.3) - gi.repository.GObject.MainLoop etc. (now used via gi.repository.GLib) - gi.repository.GLib.threads_init (no longer necessary at all) (Simon McVittie) @@ -23,6 +31,13 @@ CI fixes: • Stop installing tap.py for Python 2. The latest version only supports Python 3. (Simon McVittie) +• Move from Python 3.8 on Debian unstable (no longer available) to + 3.9 on Debian 11 (Simon McVittie) + +• Also test with Python 3.10 on Ubuntu 21.10 (Simon McVittie) + +• Remove Travis-CI integration, only use Gitlab-CI (Simon McVittie) + dbus Python Bindings 1.2.16 (2020-01-14) ======================================== diff --git a/dbus_bindings/unixfd.c b/dbus_bindings/unixfd.c index 3da9323..ed99386 100644 --- a/dbus_bindings/unixfd.c +++ b/dbus_bindings/unixfd.c @@ -111,6 +111,11 @@ UnixFd_tp_new(PyTypeObject *cls, PyObject *args, PyObject *kwargs) return NULL; } + if (variant_level < 0) { + PyErr_Format(PyExc_ValueError, "variant_level cannot be less than 0"); + return NULL; + } + status = make_fd(arg, &fd_original); if (status < 0) return NULL; @@ -151,10 +156,6 @@ UnixFd_tp_new(PyTypeObject *cls, PyObject *args, PyObject *kwargs) } self->fd = fd; - if (variant_level < 0) { - PyErr_Format(PyExc_ValueError, "variant_level cannot be less than 0"); - return NULL; - } self->variant_level = variant_level; return (PyObject *)self; diff --git a/test/test-standalone.py b/test/test-standalone.py index cd967a6..7ec6e47 100755 --- a/test/test-standalone.py +++ b/test/test-standalone.py @@ -612,6 +612,9 @@ class TestMessageMarshalling(unittest.TestCase): with self.assertRaises(TypeError): types.UnixFd(plain_fd, variant_level='nope') + + with self.assertRaises(ValueError): + types.UnixFd(plain_fd, variant_level=-1) finally: os.close(plain_fd) diff --git a/tools/ci-build.sh b/tools/ci-build.sh index d1dd528..ac82998 100755 --- a/tools/ci-build.sh +++ b/tools/ci-build.sh @@ -43,8 +43,6 @@ if [ -n "$ci_docker" ]; then --env=ci_suite="${ci_suite}" \ --env=dbus_ci_parallel="${dbus_ci_parallel}" \ --env=dbus_ci_system_python="${dbus_ci_system_python-}" \ - --env=TRAVIS="${TRAVIS-}" \ - --env=TRAVIS_PYTHON_VERSION="${TRAVIS_PYTHON_VERSION-}" \ --privileged \ ci-image \ tools/ci-build.sh @@ -70,27 +68,6 @@ if [ -n "$dbus_ci_system_python" ]; then export PYTHON_LIBS="-lpython2.7_d" ;; esac - -elif [ -n "$TRAVIS_PYTHON_VERSION" ]; then - # Possibly in a virtualenv - dbus_ci_bindir="$(python -c 'import sys; print(sys.prefix)')"/bin - # The real underlying paths, even if we have a virtualenv - # e.g. /opt/pythonwhatever/bin on travis-ci - dbus_ci_real_bindir="$(python -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_var("BINDIR"))')" - dbus_ci_real_libdir="$(python -c 'import distutils.sysconfig; print(distutils.sysconfig.get_config_var("LIBDIR"))')" - - # We want the virtualenv bindir for python itself, then the real bindir - # for python[X.Y]-config (which isn't copied into the virtualenv, so we - # risk picking up the wrong one from travis-ci's PATH if we don't - # do this) - export PATH="${dbus_ci_bindir}:${dbus_ci_real_bindir}:${PATH}" - # travis-ci's /opt/pythonwhatever/lib isn't on the library search path - export LD_LIBRARY_PATH="${dbus_ci_real_libdir}" - # travis-ci's Python 2 library is static, so it raises warnings - # about tmpnam_r and tempnam - case "$TRAVIS_PYTHON_VERSION" in - (2*) export LDFLAGS=-Wl,--no-fatal-warnings;; - esac fi NOCONFIGURE=1 ./autogen.sh @@ -102,7 +79,7 @@ e=0 --prefix="$prefix" \ ${NULL} ) || e=1 -if [ "x$e" != x0 ] || [ -n "$TRAVIS" ]; then +if [ "x$e" != x0 ]; then cat "$builddir/config.log" fi test "x$e" = x0 |