Hello community, here is the log from the commit of package python-python-afl for openSUSE:Factory checked in at 2018-07-06 10:45:16 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-python-afl (Old) and /work/SRC/openSUSE:Factory/.python-python-afl.new (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-afl" Fri Jul 6 10:45:16 2018 rev:2 rq:621052 version:0.7 Changes: -------- --- /work/SRC/openSUSE:Factory/python-python-afl/python-python-afl.changes 2017-10-03 23:17:19.962015995 +0200 +++ /work/SRC/openSUSE:Factory/.python-python-afl.new/python-python-afl.changes 2018-07-06 10:45:21.383014700 +0200 @@ -1,0 +2,21 @@ +Sun May 6 08:36:28 UTC 2018 - sebix+novell....@sebix.at + +- update to version 0.7: + * Fix stability issues in persistent mode. + * Capitalize “American Fuzzy Lop” in documentation. + * Speed up integer division and modulo operators. + * Improve the build system: + + Declare build-dependencies (as per PEP-518). + + Add the bdist_wheel command. + * Improve the test suite. + + Print helpful error message when the required command-line tools are + missing. + + Fix stability of the persistent target. + + Rewind stdin in the persistent target. + Thanks to Alex Groce for the bug report. + * Improve documentation: + + Add another “Further reading” link to README. + + Update PyPI URLs. + * Add the PYTHON_AFL_TSTL environment variable. + +------------------------------------------------------------------- Old: ---- python-afl-0.6.1.tar.gz New: ---- python-afl-0.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-python-afl.spec ++++++ --- /var/tmp/diff_new_pack.ehBTRY/_old 2018-07-06 10:45:21.875014115 +0200 +++ /var/tmp/diff_new_pack.ehBTRY/_new 2018-07-06 10:45:21.875014115 +0200 @@ -1,7 +1,7 @@ # # spec file for package python-python-afl # -# Copyright (c) 2017 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -13,28 +13,29 @@ # published by the Open Source Initiative. # Please submit bugfixes or comments via http://bugs.opensuse.org/ +# %{?!python_module:%define python_module() python-%{**} python3-%{**}} %bcond_without test Name: python-python-afl -Version: 0.6.1 +Version: 0.7 Release: 0 -License: MIT Summary: American fuzzy lop fork server and instrumentation for pure-Python code -Url: http://jwilk.net/software/python-afl +License: MIT Group: Development/Languages/Python +Url: http://jwilk.net/software/python-afl Source: https://files.pythonhosted.org/packages/source/p/python-afl/python-afl-%{version}.tar.gz # PATCH-FIX-OPENSUSE -Patch0: https://github.com/jwilk/python-afl/compare/master...sebix:fix-setup-tests.patch#/Use-setuptools-and-use-test-command-for-setup.patch -BuildRequires: python-rpm-macros -BuildRequires: %{python_module devel} +Patch0: https://github.com/jwilk/python-afl/compare/0.7...sebix:0.7-fix-setup-tests.patch#/Use-setuptools-and-use-test-command-for-setup.patch BuildRequires: %{python_module Cython >= 0.19} +BuildRequires: %{python_module devel} BuildRequires: %{python_module setuptools} +BuildRequires: python-rpm-macros %if %{with test} -BuildRequires: procps -BuildRequires: afl >= 2 BuildRequires: %{python_module nose} +BuildRequires: afl >= 2 +BuildRequires: procps %endif BuildRequires: fdupes Requires: afl >= 2 ++++++ Use-setuptools-and-use-test-command-for-setup.patch ++++++ --- /var/tmp/diff_new_pack.ehBTRY/_old 2018-07-06 10:45:21.891014096 +0200 +++ /var/tmp/diff_new_pack.ehBTRY/_new 2018-07-06 10:45:21.891014096 +0200 @@ -1,15 +1,14 @@ -From 8ed58064a967c88b1b568b24d1690fbfd60340a2 Mon Sep 17 00:00:00 2001 +From 18aa9f38a495deb7ee7c17077980c62835db99d2 Mon Sep 17 00:00:00 2001 From: Sebastian Wagner <se...@sebix.at> Date: Fri, 14 Oct 2016 09:54:20 +0200 Subject: [PATCH] Use setuptools and use test command for setup -Signed-off-by: Sebastian Wagner <se...@sebix.at> --- - setup.py | 61 ++++++++++++++----------------------------------------------- - 1 file changed, 14 insertions(+), 47 deletions(-) + setup.py | 68 +++++++++++++--------------------------------------------------- + 1 file changed, 14 insertions(+), 54 deletions(-) diff --git a/setup.py b/setup.py -index 5c617e0..c1a08d2 100644 +index d813411..d43b3d3 100644 --- a/setup.py +++ b/setup.py @@ -32,9 +32,9 @@ @@ -24,8 +23,8 @@ +from Cython.Build import cythonize try: - import distutils644 -@@ -62,6 +62,13 @@ def get_version(): + from wheel.bdist_wheel import bdist_wheel +@@ -67,6 +67,13 @@ def get_version(): Topic :: Software Development :: Testing '''.strip().splitlines() @@ -39,7 +38,7 @@ meta = dict( name='python-afl', version=get_version(), -@@ -72,53 +79,13 @@ def get_version(): +@@ -77,60 +84,13 @@ def get_version(): url='http://jwilk.net/software/python-afl', author='Jakub Wilk', author_email='jw...@jwilk.net', @@ -48,21 +47,19 @@ + ext_modules = cythonize(extensions), ) --if 'setuptools' in sys.modules and sys.argv[1] == 'egg_info': -- # We wouldn't normally want setuptools; but pip forces it upon us anyway, -- # so let's abuse it to instruct pip to install Cython if it's missing. -- distutils.core.setup( -- install_requires=['Cython>=0.19'], -- # Conceptually, “setup_requires” would make more sense than -- # “install_requires”, but the former is not supported by pip: -- # https://github.com/pypa/pip/issues/1820 -- **meta -- ) -- sys.exit(0) -- -try: - import Cython -except ImportError: +- # This shouldn't happen with pip >= 10, thanks to PEP-518 support. +- # For older versions, we use this hack to trick it into installing Cython: +- if 'setuptools' in sys.modules and sys.argv[1] == 'egg_info': +- distutils.core.setup( +- install_requires=['Cython>=0.19'], +- # Conceptually, “setup_requires” would make more sense than +- # “install_requires”, but the former is not supported by pip. +- **meta +- ) +- sys.exit(0) - raise RuntimeError('Cython >= 0.19 is required') - -try: @@ -89,11 +86,20 @@ - distutils_sdist.make_release_tree(self, base_dir, files) - self.maybe_move_file(base_dir, 'LICENSE', 'doc/LICENSE') - +-def d(**kwargs): +- return dict( +- (k, v) for k, v in kwargs.items() +- if v is not None +- ) +- -distutils.core.setup( - ext_modules=Cython.Build.cythonize('afl.pyx'), +setup( scripts=glob.glob('py-afl-*'), -- cmdclass=dict(sdist=cmd_sdist), +- cmdclass=d( +- bdist_wheel=bdist_wheel, +- sdist=cmd_sdist, +- ), **meta ) ++++++ python-afl-0.6.1.tar.gz -> python-afl-0.7.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/MANIFEST.in new/python-afl-0.7/MANIFEST.in --- old/python-afl-0.6.1/MANIFEST.in 2017-04-05 13:00:32.000000000 +0200 +++ new/python-afl-0.7/MANIFEST.in 2018-02-09 22:45:58.000000000 +0100 @@ -1,5 +1,5 @@ exclude *.c -exclude README +exclude README.rst include *.pyx include LICENSE include MANIFEST.in diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/PKG-INFO new/python-afl-0.7/PKG-INFO --- old/python-afl-0.6.1/PKG-INFO 2017-07-28 16:48:21.000000000 +0200 +++ new/python-afl-0.7/PKG-INFO 2018-04-30 11:04:42.000000000 +0200 @@ -1,15 +1,15 @@ Metadata-Version: 1.1 Name: python-afl -Version: 0.6.1 -Summary: American fuzzy lop fork server and instrumentation for pure-Python code +Version: 0.7 +Summary: American Fuzzy Lop fork server and instrumentation for pure-Python code Home-page: http://jwilk.net/software/python-afl Author: Jakub Wilk Author-email: jw...@jwilk.net License: MIT Description: *python-afl* is an experimental module that enables - `American fuzzy lop`_ fork server and instrumentation for pure-Python code. + `American Fuzzy Lop`_ fork server and instrumentation for pure-Python code. - .. _American fuzzy lop: http://lcamtuf.coredump.cx/afl/ + .. _American Fuzzy Lop: http://lcamtuf.coredump.cx/afl/ Platform: UNKNOWN Classifier: Development Status :: 3 - Alpha Classifier: Intended Audience :: Developers diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/afl.pyx new/python-afl-0.7/afl.pyx --- old/python-afl-0.6.1/afl.pyx 2017-04-08 21:26:41.000000000 +0200 +++ new/python-afl-0.7/afl.pyx 2018-04-30 10:00:28.000000000 +0200 @@ -1,4 +1,4 @@ -# Copyright © 2014-2016 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2014-2018 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -20,12 +20,13 @@ #cython: autotestdict=False #cython: c_string_encoding=default +#cython: cdivision=True ''' -American fuzzy lop fork server and instrumentation for pure-Python code +American Fuzzy Lop fork server and instrumentation for pure-Python code ''' -__version__ = '0.6.1' +__version__ = '0.7' cdef object os, signal, struct, sys, warnings import os @@ -58,12 +59,12 @@ cdef size_t len = strlen(key) cdef uint32_t h = 0x811C9DC5 while len > 0: - h ^= <unsigned char> key[0]; + h ^= <unsigned char> key[0] h *= 0x01000193 len -= 1 key += 1 while offset > 0: - h ^= <unsigned char> offset; + h ^= <unsigned char> offset h *= 0x01000193 offset >>= 8 return h @@ -75,10 +76,13 @@ cdef object trace def trace(frame, event, arg): - global prev_location + global prev_location, tstl_mode cdef unsigned int location, offset + cdef object filename = frame.f_code.co_filename + if tstl_mode and (filename[-7:] in ['sut.py', '/sut.py']): + return None location = ( - lhash(frame.f_code.co_filename, frame.f_lineno) + lhash(filename, frame.f_lineno) % MAP_SIZE ) offset = location ^ prev_location @@ -101,9 +105,11 @@ os.kill(os.getpid(), except_signal_id) cdef bint init_done = False +cdef bint tstl_mode = False cdef int _init(bint persistent_mode) except -1: - global afl_area, init_done + global afl_area, init_done, tstl_mode + tstl_mode = os.getenv('PYTHON_AFL_TSTL') is not None use_forkserver = True try: os.write(FORKSRV_FD + 1, b'\0\0\0\0') @@ -180,7 +186,8 @@ afl-fuzz >= 1.82b is required for this feature. ''' - global persistent_allowed, persistent_counter + global persistent_allowed, persistent_counter, prev_location + prev_location = 0 if persistent_counter == 0: persistent_allowed = os.getenv('PYTHON_AFL_PERSISTENT') is not None _init(persistent_mode=persistent_allowed) @@ -195,6 +202,7 @@ persistent_counter += 1 return True else: + sys.settrace(None) return False __all__ = [ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/doc/LICENSE new/python-afl-0.7/doc/LICENSE --- old/python-afl-0.6.1/doc/LICENSE 2017-03-26 22:00:14.000000000 +0200 +++ new/python-afl-0.7/doc/LICENSE 2018-04-21 23:31:12.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright © 2013-2017 Jakub Wilk <jw...@jwilk.net> +Copyright © 2013-2018 Jakub Wilk <jw...@jwilk.net> Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/doc/README new/python-afl-0.7/doc/README --- old/python-afl-0.6.1/doc/README 2017-04-04 19:05:19.000000000 +0200 +++ new/python-afl-0.7/doc/README 2018-04-19 12:57:38.000000000 +0200 @@ -1,7 +1,7 @@ This is experimental module that enables -`American fuzzy lop`_ fork server and instrumentation for pure-Python code. +`American Fuzzy Lop`_ fork server and instrumentation for pure-Python code. -.. _American fuzzy lop: http://lcamtuf.coredump.cx/afl/ +.. _American Fuzzy Lop: http://lcamtuf.coredump.cx/afl/ HOWTO ----- @@ -76,9 +76,16 @@ *py-afl-fuzz* sets this variable automatically, so there should normally no need to set it manually. +``PYTHON_AFL_TSTL`` + `TSTL`_ test harness code is ignored if this variable is set; + relevant only to users of TSTL interface to python-afl. + +.. _TSTL: https://github.com/agroce/tstl + Further reading --------------- +* `Taking a look at python-afl <https://barro.github.io/2018/01/taking-a-look-at-python-afl/>`_ by Jussi Judin * `Introduction to Fuzzing in Python with AFL <https://alexgaynor.net/2015/apr/13/introduction-to-fuzzing-in-python-with-afl/>`_ by Alex Gaynor * `AFL's README <http://lcamtuf.coredump.cx/afl/README.txt>`_ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/doc/changelog new/python-afl-0.7/doc/changelog --- old/python-afl-0.6.1/doc/changelog 2017-07-28 16:43:08.000000000 +0200 +++ new/python-afl-0.7/doc/changelog 2018-04-30 10:42:20.000000000 +0200 @@ -1,3 +1,27 @@ +python-afl (0.7) unstable; urgency=low + + [ Jakub Wilk ] + * Fix stability issues in persistent mode. + * Capitalize “American Fuzzy Lop” in documentation. + * Speed up integer division and modulo operators. + * Improve the build system: + + Declare build-dependencies (as per PEP-518). + + Add the bdist_wheel command. + * Improve the test suite. + + Print helpful error message when the required command-line tools are + missing. + + Fix stability of the persistent target. + + Rewind stdin in the persistent target. + Thanks to Alex Groce for the bug report. + * Improve documentation: + + Add another “Further reading” link to README. + + Update PyPI URLs. + + [ Alex Groce ] + * Add the PYTHON_AFL_TSTL environment variable. + + -- Jakub Wilk <jw...@jwilk.net> Mon, 30 Apr 2018 10:42:18 +0200 + python-afl (0.6.1) unstable; urgency=low * Improve the test suite. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/doc/trophy-case new/python-afl-0.7/doc/trophy-case --- old/python-afl-0.6.1/doc/trophy-case 2017-03-29 12:47:12.000000000 +0200 +++ new/python-afl-0.7/doc/trophy-case 2018-04-20 18:15:37.000000000 +0200 @@ -62,7 +62,7 @@ | https://github.com/dateutil/dateutil/issues/82 -.. __: https://pypi.python.org/pypi/python-dateutil +.. __: https://pypi.org/project/python-dateutil/ regex__ ------- @@ -72,6 +72,6 @@ | https://bitbucket.org/mrabarnett/mrab-regex/issues/199/segfault-in-recompile | https://bitbucket.org/mrabarnett/mrab-regex/issues/200/attributeerror-in-regexcompile-with-latest -.. __: https://pypi.python.org/pypi/regex +.. __: https://pypi.org/project/regex/ .. vim:ft=rst ts=3 sts=3 sw=3 et diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/private/run-pydiatra new/python-afl-0.7/private/run-pydiatra --- old/python-afl-0.6.1/private/run-pydiatra 2017-04-14 00:04:16.000000000 +0200 +++ new/python-afl-0.7/private/run-pydiatra 1970-01-01 01:00:00.000000000 +0100 @@ -1,30 +0,0 @@ -#!/bin/sh - -# Copyright © 2016-2017 Jakub Wilk <jw...@jwilk.net> -# -# 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. - -PYTHON=${PYTHON:-python} -if [ $# -eq 0 ] -then - set -- $(find . -name '*.py') -fi -exec "$PYTHON" -m pydiatra "$@" - -# vim:ts=4 sts=4 sw=4 et diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/private/run-pyflakes new/python-afl-0.7/private/run-pyflakes --- old/python-afl-0.6.1/private/run-pyflakes 2017-04-04 21:34:21.000000000 +0200 +++ new/python-afl-0.7/private/run-pyflakes 1970-01-01 01:00:00.000000000 +0100 @@ -1,33 +0,0 @@ -#!/bin/sh - -# Copyright © 2016-2017 Jakub Wilk <jw...@jwilk.net> -# -# 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. - -PYTHON=${PYTHON:-python} -pyflakes=$(command -v pyflakes) || { echo pyflakes not found >&2; exit 1; } -if [ $# -eq 0 ] -then - set -- $(find . -name '*.py') -fi -# It would be tempting to use "python -m pyflakes" here, -# but that doesn't work in Python 2.6. -exec "$PYTHON" "$pyflakes" "$@" - -# vim:ts=4 sts=4 sw=4 et diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/private/run-pylint new/python-afl-0.7/private/run-pylint --- old/python-afl-0.6.1/private/run-pylint 2017-04-04 23:03:14.000000000 +0200 +++ new/python-afl-0.7/private/run-pylint 2018-02-27 23:18:56.000000000 +0100 @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright © 2015-2017 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2015-2018 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -28,7 +28,7 @@ then set -- setup.py tests/*.py fi -if [ -n "${TRAVIS_PYTHON_VERSION:-}" ] +if [ -n "${VIRTUAL_ENV:-}" ] then # https://github.com/PyCQA/pylint/issues/73 set -- --ignored-modules=distutils "$@" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/setup.cfg new/python-afl-0.7/setup.cfg --- old/python-afl-0.6.1/setup.cfg 1970-01-01 01:00:00.000000000 +0100 +++ new/python-afl-0.7/setup.cfg 2018-04-17 23:16:49.000000000 +0200 @@ -0,0 +1,5 @@ +[pycodestyle] +filename = *.py,*.pyx +ignore = E12,E21,E22,E265,E3,E4,E722,W504 +max-line-length = 120 +show-source = true diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/setup.py new/python-afl-0.7/setup.py --- old/python-afl-0.6.1/setup.py 2017-04-19 19:05:29.000000000 +0200 +++ new/python-afl-0.7/setup.py 2018-04-26 15:13:29.000000000 +0200 @@ -1,6 +1,6 @@ # encoding=UTF-8 -# Copyright © 2014-2017 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2014-2018 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -22,9 +22,9 @@ ''' *python-afl* is an experimental module that enables -`American fuzzy lop`_ fork server and instrumentation for pure-Python code. +`American Fuzzy Lop`_ fork server and instrumentation for pure-Python code. -.. _American fuzzy lop: http://lcamtuf.coredump.cx/afl/ +.. _American Fuzzy Lop: http://lcamtuf.coredump.cx/afl/ ''' import glob @@ -37,6 +37,11 @@ from distutils.command.sdist import sdist as distutils_sdist try: + from wheel.bdist_wheel import bdist_wheel +except ImportError: + bdist_wheel = None + +try: import distutils644 except ImportError: pass @@ -66,7 +71,7 @@ name='python-afl', version=get_version(), license='MIT', - description='American fuzzy lop fork server and instrumentation for pure-Python code', + description='American Fuzzy Lop fork server and instrumentation for pure-Python code', long_description=__doc__.strip(), classifiers=classifiers, url='http://jwilk.net/software/python-afl', @@ -74,21 +79,19 @@ author_email='jw...@jwilk.net', ) -if 'setuptools' in sys.modules and sys.argv[1] == 'egg_info': - # We wouldn't normally want setuptools; but pip forces it upon us anyway, - # so let's abuse it to instruct pip to install Cython if it's missing. - distutils.core.setup( - install_requires=['Cython>=0.19'], - # Conceptually, “setup_requires” would make more sense than - # “install_requires”, but the former is not supported by pip: - # https://github.com/pypa/pip/issues/1820 - **meta - ) - sys.exit(0) - try: import Cython except ImportError: + # This shouldn't happen with pip >= 10, thanks to PEP-518 support. + # For older versions, we use this hack to trick it into installing Cython: + if 'setuptools' in sys.modules and sys.argv[1] == 'egg_info': + distutils.core.setup( + install_requires=['Cython>=0.19'], + # Conceptually, “setup_requires” would make more sense than + # “install_requires”, but the former is not supported by pip. + **meta + ) + sys.exit(0) raise RuntimeError('Cython >= 0.19 is required') try: @@ -115,10 +118,19 @@ distutils_sdist.make_release_tree(self, base_dir, files) self.maybe_move_file(base_dir, 'LICENSE', 'doc/LICENSE') +def d(**kwargs): + return dict( + (k, v) for k, v in kwargs.items() + if v is not None + ) + distutils.core.setup( ext_modules=Cython.Build.cythonize('afl.pyx'), scripts=glob.glob('py-afl-*'), - cmdclass=dict(sdist=cmd_sdist), + cmdclass=d( + bdist_wheel=bdist_wheel, + sdist=cmd_sdist, + ), **meta ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/tests/target_persistent.py new/python-afl-0.7/tests/target_persistent.py --- old/python-afl-0.6.1/tests/target_persistent.py 2017-04-04 21:58:11.000000000 +0200 +++ new/python-afl-0.7/tests/target_persistent.py 2018-04-30 10:07:04.000000000 +0200 @@ -3,6 +3,7 @@ import afl def main(): + sys.stdin.seek(0) # work-around for C stdio caching EOF status s = sys.stdin.read() if len(s) < 1: print('Hum?') @@ -14,6 +15,7 @@ print('A non-zero value? How quaint!') if __name__ == '__main__': + ''.encode('ASCII') # make sure the codec module is loaded before the loop while afl.loop(): main() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/tests/test_cmin.py new/python-afl-0.7/tests/test_cmin.py --- old/python-afl-0.6.1/tests/test_cmin.py 2017-04-04 19:05:40.000000000 +0200 +++ new/python-afl-0.7/tests/test_cmin.py 2018-03-12 17:38:20.000000000 +0100 @@ -1,6 +1,6 @@ # encoding=UTF-8 -# Copyright © 2015-2017 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2015-2018 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -25,6 +25,7 @@ from .tools import ( assert_equal, + require_commands, run, tempdir, ) @@ -33,6 +34,7 @@ target = here + '/target.py' def run_afl_cmin(input, xoutput, crashes_only=False): + require_commands('py-afl-cmin', 'afl-cmin') input = sorted(input) xoutput = sorted(xoutput) with tempdir() as workdir: @@ -62,7 +64,7 @@ run_afl_cmin([ b'0' * 6, b'0', b'X' * 7, b'1', - b'\xcf\x87', + b'\xCF\x87', ], [ b'0', b'1', @@ -72,9 +74,9 @@ run_afl_cmin([ b'0' * 6, b'0', b'X' * 7, b'1', - b'\xcf\x87', + b'\xCF\x87', ], [ - b'\xcf\x87', + b'\xCF\x87', ], crashes_only=True) # vim:ts=4 sts=4 sw=4 et diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/tests/test_fuzz.py new/python-afl-0.7/tests/test_fuzz.py --- old/python-afl-0.6.1/tests/test_fuzz.py 2017-04-03 22:54:26.000000000 +0200 +++ new/python-afl-0.7/tests/test_fuzz.py 2018-03-12 17:38:22.000000000 +0100 @@ -1,6 +1,6 @@ # encoding=UTF-8 -# Copyright © 2015-2017 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2015-2018 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -45,6 +45,7 @@ SkipTest, assert_true, clean_environ, + require_commands, tempdir, ) @@ -55,13 +56,14 @@ token = token.decode('ASCII') def get_afl_version(): + require_commands('afl-fuzz') child = ipc.Popen(['afl-fuzz'], stdout=ipc.PIPE) version = child.stdout.readline() child.stdout.close() child.wait() if str is not bytes: version = version.decode('ASCII') - version = re.sub(r'\x1b\[[^m]+m', '', version) + version = re.sub(r'\x1B\[[^m]+m', '', version) match = re.match(r'^afl-fuzz\s+([0-9.]+)b?\b', version) version = match.group(1) return distutils.version.StrictVersion(version) @@ -80,6 +82,7 @@ raise SkipTest('/proc/sys/kernel/core_pattern = ' + pattern) def _test_fuzz(workdir, target, dumb=False): + require_commands('py-afl-fuzz', 'afl-fuzz') input_dir = workdir + '/in' output_dir = workdir + '/out' os.mkdir(input_dir) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/tests/test_showmap.py new/python-afl-0.7/tests/test_showmap.py --- old/python-afl-0.6.1/tests/test_showmap.py 2017-04-03 23:22:54.000000000 +0200 +++ new/python-afl-0.7/tests/test_showmap.py 2018-03-12 17:38:25.000000000 +0100 @@ -1,6 +1,6 @@ # encoding=UTF-8 -# Copyright © 2015-2017 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2015-2018 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -26,6 +26,7 @@ from .tools import ( assert_equal, assert_not_equal, + require_commands, run, tempdir, ) @@ -34,6 +35,7 @@ target = here + '/target.py' def run_afl_showmap(stdin, xstdout=None, xstatus=0): + require_commands('py-afl-showmap', 'afl-showmap') with tempdir() as workdir: outpath = workdir + '/out' (stdout, stderr) = run( @@ -53,7 +55,7 @@ assert_not_equal(out1, out2) def test_exception(): - out = run_afl_showmap(b'\xff', + out = run_afl_showmap(b'\xFF', xstatus=2, ) assert_not_equal(out, b'') diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/tests/test_tmin.py new/python-afl-0.7/tests/test_tmin.py --- old/python-afl-0.6.1/tests/test_tmin.py 2017-04-04 19:01:06.000000000 +0200 +++ new/python-afl-0.7/tests/test_tmin.py 2018-03-12 17:38:27.000000000 +0100 @@ -1,6 +1,6 @@ # encoding=UTF-8 -# Copyright © 2015-2017 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2015-2018 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -25,6 +25,7 @@ from .tools import ( assert_equal, + require_commands, run, tempdir, ) @@ -33,6 +34,7 @@ target = here + '/target.py' def run_afl_tmin(input, xoutput, xstatus=0): + require_commands('py-afl-tmin', 'afl-tmin') with tempdir() as workdir: inpath = workdir + '/in' with open(inpath, 'wb') as file: @@ -51,6 +53,6 @@ run_afl_tmin(b'X' * 7, b'X') def test_exc(): - run_afl_tmin(b'\xcf\x87', b'\x87') + run_afl_tmin(b'\xCF\x87', b'\x87') # vim:ts=4 sts=4 sw=4 et diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-afl-0.6.1/tests/tools.py new/python-afl-0.7/tests/tools.py --- old/python-afl-0.6.1/tests/tools.py 2017-07-28 16:33:21.000000000 +0200 +++ new/python-afl-0.7/tests/tools.py 2018-03-12 17:38:30.000000000 +0100 @@ -1,6 +1,6 @@ # encoding=UTF-8 -# Copyright © 2013-2017 Jakub Wilk <jw...@jwilk.net> +# Copyright © 2013-2018 Jakub Wilk <jw...@jwilk.net> # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the “Software”), to deal @@ -134,6 +134,17 @@ os.environ['AFL_ALLOW_TMP'] = '1' # AFL >= 2.48b os.environ['PWD'] = '//' + os.getcwd() # poor man's AFL_ALLOW_TMP for AFL << 2.48b +def require_commands(*cmds): + PATH = os.environ.get('PATH', os.defpath) + PATH = PATH.split(os.pathsep) + for cmd in cmds: + for dir in PATH: + path = os.path.join(dir, cmd) + if os.access(path, os.X_OK): + break + else: + raise RuntimeError('{cmd} not found; is PATH set correctly?'.format(cmd=cmd)) + def run(cmd, stdin='', xstatus=0): child = ipc.Popen( list(cmd), @@ -225,6 +236,7 @@ 'assert_true', 'assert_warns_regex', 'fork_isolation', + 'require_commands', 'run', 'tempdir', ]