Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6 tests fail using SOURCE_DATE_EPOCH env var #78203

Closed
vstinner opened this issue Jul 2, 2018 · 36 comments
Closed

6 tests fail using SOURCE_DATE_EPOCH env var #78203

vstinner opened this issue Jul 2, 2018 · 36 comments
Labels
3.7 (EOL) end of life 3.8 (EOL) end of life tests Tests in the Lib/test dir

Comments

@vstinner
Copy link
Member

vstinner commented Jul 2, 2018

BPO 34022
Nosy @doko42, @vstinner, @benjaminp, @mcepl, @elprans, @serhiy-storchaka, @thehesiod, @yan12125, @eli-schwartz, @miss-islington
PRs
  • bpo-34022: Unbreak importlib tests when SOURCE_DATE_EPOCH is set #9484
  • bpo-34022: Stop forcing of hash-based invalidation with SOURCE_DATE_EPOCH #9607
  • bpo-34726: Fix handling of hash-based pycs in zipimport #10327
  • [3.7] bpo-34022: Stop forcing of hash-based invalidation with SOURCE_DATE_EPOCH (GH-9607) #10775
  • Files
  • osc-build-log.txt
  • Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.

    Show more details

    GitHub fields:

    assignee = None
    closed_at = <Date 2018-11-29.00:11:53.335>
    created_at = <Date 2018-07-02.12:18:35.907>
    labels = ['3.8', '3.7', 'tests']
    title = '6 tests fail using SOURCE_DATE_EPOCH env var'
    updated_at = <Date 2019-06-28.09:25:54.479>
    user = 'https://github.com/vstinner'

    bugs.python.org fields:

    activity = <Date 2019-06-28.09:25:54.479>
    actor = 'vstinner'
    assignee = 'none'
    closed = True
    closed_date = <Date 2018-11-29.00:11:53.335>
    closer = 'vstinner'
    components = ['Tests']
    creation = <Date 2018-07-02.12:18:35.907>
    creator = 'vstinner'
    dependencies = []
    files = ['47665']
    hgrepos = []
    issue_num = 34022
    keywords = ['patch']
    message_count = 36.0
    messages = ['320875', '320876', '320877', '320885', '320886', '320892', '320894', '320895', '320903', '320919', '320924', '320937', '320938', '320939', '320941', '320943', '320944', '321068', '321853', '326053', '326054', '326057', '326578', '326638', '327479', '327828', '329275', '330499', '330508', '330523', '330524', '330525', '330619', '330622', '330640', '346814']
    nosy_count = 10.0
    nosy_names = ['doko', 'vstinner', 'benjamin.peterson', 'mcepl', 'Elvis.Pranskevichus', 'serhiy.storchaka', 'thehesiod', 'yan12125', 'eschwartz', 'miss-islington']
    pr_nums = ['9484', '9607', '10327', '10775']
    priority = 'normal'
    resolution = 'fixed'
    stage = 'resolved'
    status = 'closed'
    superseder = None
    type = None
    url = 'https://bugs.python.org/issue34022'
    versions = ['Python 3.7', 'Python 3.8']

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 2, 2018

    https://build.opensuse.org/package/show/home:mcepl:work/python3

    6 tests failed:
    test_cmd_line_script test_compileall test_importlib
    test_multiprocessing_main_handling test_py_compile test_runpy

    ======================================================================
    ERROR: test_zipfile_compiled (test.test_runpy.RunPathTestCase)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/runpy.py", line 153, in _get_module_details
        code = loader.get_code(mod_name)
    zipimport.ZipImportError: can't find module '__main__'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/runpy.py", line 219, in _get_main_module_details
        return _get_module_details(main_name)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/runpy.py", line 155, in _get_module_details
        raise error(format(e)) from e
    ImportError: can't find module '__main__'
    
    The above exception was the direct cause of the following exception:
    
    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_runpy.py", line 715, in test_zipfile_compiled
        mod_name=mod_name, check_loader=False)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_runpy.py", line 631, in _check_script
        self.check_code_execution(create_ns, expected_ns)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_runpy.py", line 130, in check_code_execution
        result_ns = create_namespace(None)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_runpy.py", line 606, in create_ns
        return run_path(script_name, init_globals)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/runpy.py", line 275, in run_path
        mod_name, mod_spec, code = _get_main_module_details()
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/runpy.py", line 223, in _get_main_module_details
        (main_name, sys.path[0])) from exc
    ImportError: can't find '__main__' module in '/tmp/tmp40k8q99u/test_zip.zip'

    ======================================================================
    FAIL: test_zipfile_compiled (test.test_cmd_line_script.CmdLineTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_cmd_line_script.py", line 268, in test_zipfile_compiled
        zipimport.zipimporter)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_cmd_line_script.py", line 129, in _check_script
        *run_args, __isolated=False, __cwd=cwd, **env_vars
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 157, in assert_python_ok
        return _assert_python(True, *args, **env_vars)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 143, in _assert_python
        res.fail(cmd_line)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 84, in fail
        err))
    AssertionError: Process return code is 1
    command line: ['/home/abuild/rpmbuild/BUILD/Python-3.7.0/python', '-X', 'faulthandler', '-E', '/tmp/tmpwlsj3czm/test_zip.zip', 'test1', 'test2', 'test3']

    stdout:
    ---

    ---

    stderr:
    ---
    /home/abuild/rpmbuild/BUILD/Python-3.7.0/python: can't find '__main__' module in '/tmp/tmpwlsj3czm/test_zip.zip'
    ---

    ======================================================================
    FAIL: test_overiden_unchecked_hash_based_pyc (test.test_importlib.source.test_file_loader.Frozen_SimpleTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 349, in test_overiden_unchecked_hash_based_pyc
        self.assertEqual(int.from_bytes(data[4:8], 'little'), 0b1)
    AssertionError: 3 != 1

    ======================================================================
    FAIL: test_unchecked_hash_based_pyc (test.test_importlib.source.test_file_loader.Frozen_SimpleTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 315, in test_unchecked_hash_based_pyc
        self.assertEqual(mod.state, 'old')
    AssertionError: 'new' != 'old'
    - new
    + old

    ======================================================================
    FAIL: test_old_timestamp (test.test_importlib.source.test_file_loader.Frozen_SourceLoaderBadBytecodeTestPEP302)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 635, in test_old_timestamp
        self.assertEqual(bytecode_file.read(4), source_timestamp)
    AssertionError: b'\xf0%\x1e8' != b'\xe2L6['

    ======================================================================
    FAIL: test_old_timestamp (test.test_importlib.source.test_file_loader.Frozen_SourceLoaderBadBytecodeTestPEP451)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 635, in test_old_timestamp
        self.assertEqual(bytecode_file.read(4), source_timestamp)
    AssertionError: b'\xf0%\x1e8' != b'\xe2L6['

    ======================================================================
    FAIL: test_overiden_unchecked_hash_based_pyc (test.test_importlib.source.test_file_loader.Source_SimpleTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 349, in test_overiden_unchecked_hash_based_pyc
        self.assertEqual(int.from_bytes(data[4:8], 'little'), 0b1)
    AssertionError: 3 != 1

    ======================================================================
    FAIL: test_unchecked_hash_based_pyc (test.test_importlib.source.test_file_loader.Source_SimpleTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 315, in test_unchecked_hash_based_pyc
        self.assertEqual(mod.state, 'old')
    AssertionError: 'new' != 'old'
    - new
    + old

    ======================================================================
    FAIL: test_old_timestamp (test.test_importlib.source.test_file_loader.Source_SourceLoaderBadBytecodeTestPEP302)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 635, in test_old_timestamp
        self.assertEqual(bytecode_file.read(4), source_timestamp)
    AssertionError: b'\xf0%\x1e8' != b'\xe2L6['

    ======================================================================
    FAIL: test_old_timestamp (test.test_importlib.source.test_file_loader.Source_SourceLoaderBadBytecodeTestPEP451)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/util.py", line 303, in wrapper
        to_return = fxn(*args, **kwargs)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_importlib/source/test_file_loader.py", line 635, in test_old_timestamp
        self.assertEqual(bytecode_file.read(4), source_timestamp)
    AssertionError: b'\xf0%\x1e8' != b'\xe2L6['

    ======================================================================
    FAIL: test_zipfile_compiled (test.test_multiprocessing_main_handling.ForkCmdLineTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 225, in test_zipfile_compiled
        self._check_script(zip_name)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 156, in _check_script
        rc, out, err = assert_python_ok(*run_args, __isolated=False)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 157, in assert_python_ok
        return _assert_python(True, *args, **env_vars)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 143, in _assert_python
        res.fail(cmd_line)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 84, in fail
        err))
    AssertionError: Process return code is 1
    command line: ['/home/abuild/rpmbuild/BUILD/Python-3.7.0/python', '-X', 'faulthandler', '-E', '/tmp/tmpjsax7ksh/test_zip.zip', 'fork']

    stdout:
    ---

    ---

    stderr:
    ---
    /home/abuild/rpmbuild/BUILD/Python-3.7.0/python: can't find '__main__' module in '/tmp/tmpjsax7ksh/test_zip.zip'
    ---

    ======================================================================
    FAIL: test_zipfile_compiled (test.test_multiprocessing_main_handling.ForkServerCmdLineTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 225, in test_zipfile_compiled
        self._check_script(zip_name)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 156, in _check_script
        rc, out, err = assert_python_ok(*run_args, __isolated=False)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 157, in assert_python_ok
        return _assert_python(True, *args, **env_vars)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 143, in _assert_python
        res.fail(cmd_line)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 84, in fail
        err))
    AssertionError: Process return code is 1
    command line: ['/home/abuild/rpmbuild/BUILD/Python-3.7.0/python', '-X', 'faulthandler', '-E', '/tmp/tmp50n_prgl/test_zip.zip', 'forkserver']

    stdout:
    ---

    ---

    stderr:
    ---
    /home/abuild/rpmbuild/BUILD/Python-3.7.0/python: can't find '__main__' module in '/tmp/tmp50n_prgl/test_zip.zip'
    ---

    ======================================================================
    FAIL: test_zipfile_compiled (test.test_multiprocessing_main_handling.SpawnCmdLineTest)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 225, in test_zipfile_compiled
        self._check_script(zip_name)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_multiprocessing_main_handling.py", line 156, in _check_script
        rc, out, err = assert_python_ok(*run_args, __isolated=False)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 157, in assert_python_ok
        return _assert_python(True, *args, **env_vars)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 143, in _assert_python
        res.fail(cmd_line)
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/support/script_helper.py", line 84, in fail
        err))
    AssertionError: Process return code is 1
    command line: ['/home/abuild/rpmbuild/BUILD/Python-3.7.0/python', '-X', 'faulthandler', '-E', '/tmp/tmp1npoq9bq/test_zip.zip', 'spawn']

    stdout:
    ---

    ---

    stderr:
    ---
    /home/abuild/rpmbuild/BUILD/Python-3.7.0/python: can't find '__main__' module in '/tmp/tmp1npoq9bq/test_zip.zip'
    ---

    ======================================================================
    FAIL: test_invalidation_mode (test.test_py_compile.PyCompileTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_py_compile.py", line 153, in test_invalidation_mode
        self.assertEqual(flags, 0b1)
    AssertionError: 3 != 1
    
    ----------------------------------------------------------------------
    
    

    ======================================================================
    FAIL: test_force (test.test_compileall.CommandLineTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 365, in test_force
        self.assertEqual(mtime, mtime2)
    AssertionError: 1530285241.0427392 != 1530285301.18

    ======================================================================
    FAIL: test_no_args_respects_force_flag (test.test_compileall.CommandLineTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 299, in test_no_args_respects_force_flag
        self.assertEqual(mtime, mtime2)
    AssertionError: 1530285243.012693 != 1530285303.168

    ======================================================================
    FAIL: test_pyc_invalidation_mode (test.test_compileall.CommandLineTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 533, in test_pyc_invalidation_mode
        self.assertEqual(int.from_bytes(data[4:8], 'little'), 0b01)
    AssertionError: 3 != 1

    ======================================================================
    FAIL: test_magic_number (test.test_compileall.CompileallTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 78, in test_magic_number
        self.recreation_check(b'\0\0\0\0')
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 61, in recreation_check
        self.assertEqual(*self.data())
    AssertionError: b'B\r\r\n\x03\x00\x00\x00\\s\xa0J' != b'B\r\r\n\x00\x00\x00\x00\xfaL6['

    ======================================================================
    FAIL: test_mtime (test.test_compileall.CompileallTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 74, in test_mtime
        0, 1))
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_compileall.py", line 61, in recreation_check
        self.assertEqual(*self.data())
    AssertionError: b'B\r\r\n\x03\x00\x00\x00\\s\xa0J' != b'B\r\r\n\x00\x00\x00\x00\xfaL6['

    @vstinner vstinner added 3.7 (EOL) end of life tests Tests in the Lib/test dir labels Jul 2, 2018
    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 2, 2018

    It seems like the same (or similar? I didn't check) tests fail on Debian:

    https://buildd.debian.org/status/fetch.php?pkg=python3.7&arch=amd64&ver=3.7.0-1&stamp=1530136859&raw=0

    @mcepl
    Copy link
    Mannequin

    mcepl mannequin commented Jul 2, 2018

    I would add that Debian doesn't seem to fare that much better ... https://buildd.debian.org/status/fetch.php?pkg=python3.7&arch=amd64&ver=3.7.0-1&stamp=1530136859&raw=0

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 2, 2018

    I'm unable to reproduce the issue on Fedora using the same configure command:

    $ ./configure --host=x86_64-suse-linux-gnu --build=x86_64-suse-linux-gnu --program-prefix= --disable-dependency-tracking --prefix=/usr --exec-prefix=/usr --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc --datadir=/usr/share --includedir=/usr/include --libdir=/usr/lib64 --libexecdir=/usr/lib --localstatedir=/var --sharedstatedir=/var/lib --mandir=/usr/share/man --infodir=/usr/share/info --disable-dependency-tracking --docdir=/usr/share/doc/packages/python --enable-ipv6 --with-fpectl --enable-shared --with-ensurepip=no --with-system-ffi --with-system-expat --with-lto --enable-loadable-sqlite-extensions
    $ make
    $ LD_LIBRARY_PATH=$PWD ./python -m test -j0  test_cmd_line_script test_compileall test_importlib  test_multiprocessing_main_handling test_py_compile test_runpy
    ...
    All 6 tests OK.
    ...
    Tests result: SUCCESS

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 2, 2018

    Thread on python-dev:
    "[Python-Dev] Failing tests [Was: Re: Python 3.7.0 is now available! (and so is 3.6.6)]"
    https://mail.python.org/pipermail/python-dev/2018-July/154208.html

    My reply:
    https://mail.python.org/pipermail/python-dev/2018-July/154224.html

    Extract:

    """
    I'm running the Python test suite every day on Fedora and all tests
    pass. We also run tests multiple times per day on Travis CI (Ubuntu)
    and buildbots (Debian, Gentoo, RHEL, SLES).

    Wait, there is a SLES buildbot and all tests pass except of
    test_gdb.test_threads(). SLES is OpenSUSE no?

    The Debian buildbot is green on all branches.
    """

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 2, 2018

    I also ran the Python test suite on Debian sid using the master branch of Python and all tests pass:
    ---

    $ ./configure --prefix=/usr --enable-ipv6 --enable-loadable-sqlite-extensions --with-dbmliborder=bdb:gdbm --with-computed-gotos --without-ensurepip --with-system-expat --with-system-libmpdec  --with-system-ffi
    $ make
    $ LD_LIBRARY_PATH=$PWD ./python -m test -j0 test_cmd_line_script test_compileall test_importlib test_multiprocessing_main_handling test_py_compile test_runpy

    All 6 tests OK.
    ---

    I also ran the full test suite on Debian Stretch: again, all tests passed.

    Maybe the package builder use a custom configuration or patches? Or issues are specific to Python 3.7? (again, I tested the master branch)

    @vstinner vstinner changed the title Python 3.7: 6 tests failed on OpenSUSE Python 3.7: 6 tests failed on OpenSUSE and Debian Jul 2, 2018
    @mcepl
    Copy link
    Mannequin

    mcepl mannequin commented Jul 2, 2018

    Hmm, what about version of gcc? I suspect some troubles could be caused by gcc version 8 (we have in openSUSE), or LTO option switched on?

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 2, 2018

    Hmm, what about version of gcc? I suspect some troubles could be caused by gcc version 8 (we have in openSUSE), or LTO option switched on?

    For my tests on Fedora, I used gcc 8.1.1. I used the OpenSUSE configure command which includes --with-lto.

    @serhiy-storchaka
    Copy link
    Member

    I built and ran these tests using commands from msg320892 on openSUSE Leap 42.3, and all tests are passed.

    @mcepl
    Copy link
    Mannequin

    mcepl mannequin commented Jul 2, 2018

    It's somehow complicated, in the build chroot I can make tests run only with LD_LIBRARY_PATH set to $(readlink -f Python-3.7.0) and PYTHONPATH to Lib directory. However, then the set of failed tests changes. For example test_runpy runs without problems, but other fails:

    5 tests failed:
    test_asyncio test_concurrent_futures test_gdb test_logging
    test_multiprocessing_main_handling

    (complete log is attached)

    @mcepl
    Copy link
    Mannequin

    mcepl mannequin commented Jul 2, 2018

    Yes, it must be something in the chroot, because when run in the plain command line, all tests as well on openSUSE Tumbleweed (with the latest updates).

    393 tests OK.

    1 test failed:
    test_epoll

    21 tests skipped:
    test_ctypes test_devpoll test_idle test_kqueue test_msilib
    test_nis test_ossaudiodev test_smtpnet test_sqlite test_ssl
    test_startfile test_tcl test_tix test_tk test_ttk_guionly
    test_ttk_textonly test_turtle test_winconsoleio test_winreg
    test_winsound test_zipfile64

    Re-running failed tests in verbose mode
    Re-running test 'test_epoll' in verbose mode
    test_add (test.test_epoll.TestEPoll) ... ok
    test_badcreate (test.test_epoll.TestEPoll) ... ok
    test_close (test.test_epoll.TestEPoll) ... ok
    test_context_manager (test.test_epoll.TestEPoll) ... ok
    test_control_and_wait (test.test_epoll.TestEPoll) ... ok
    test_create (test.test_epoll.TestEPoll) ... ok
    test_errors (test.test_epoll.TestEPoll) ... ok
    test_fd_non_inheritable (test.test_epoll.TestEPoll) ... ok
    test_fromfd (test.test_epoll.TestEPoll) ... ok
    test_unregister_closed (test.test_epoll.TestEPoll) ... ok

    ----------------------------------------------------------------------
    Ran 10 tests in 2.106s

    OK

    == Tests result: FAILURE then SUCCESS ==

    393 tests OK.

    21 tests skipped:
    test_ctypes test_devpoll test_idle test_kqueue test_msilib
    test_nis test_ossaudiodev test_smtpnet test_sqlite test_ssl
    test_startfile test_tcl test_tix test_tk test_ttk_guionly
    test_ttk_textonly test_turtle test_winconsoleio test_winreg
    test_winsound test_zipfile64

    1 re-run test:
    test_epoll

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 3, 2018

    Yes, it must be something in the chroot, because when run in the plain command line, all tests as well on openSUSE Tumbleweed (with the latest updates).

    Are you testing with patches? It may be interesting to try to get these patches upstream:

    [ 59s] Patch #1 (Python-3.0b1-record-rpm.patch):
    [ 59s] Patch #2 (python-3.6.0-multilib-new.patch):
    [ 59s] Patch #4 (python-3.3.0b1-localpath.patch):
    [ 59s] Patch #6 (python-3.3.0b1-fix_date_time_compiler.patch):
    [ 59s] Patch #7 (python-3.3.0b1-curses-panel.patch):
    [ 59s] Patch #9 (python-3.3.0b1-test-posix_fadvise.patch):
    [ 59s] Patch #12 (python-3.3.3-skip-distutils-test_sysconfig_module.patch):
    [ 59s] Patch #15 (subprocess-raise-timeout.patch):
    [ 59s] Patch #22 (distutils-reproducible-compile.patch):

    Some patches seem old. Are they still needed? Where can I find these patches? I'm interested by patches modifying site.py for example.

    @mcepl
    Copy link
    Mannequin

    mcepl mannequin commented Jul 3, 2018

    Are you testing with patches? It may be interesting to try to get these patches upstream:

    Tested both and without patches, the same results. Everything in openSUSE is done in open (rather strikingly similar to RH openness, although things are even more simple, because so much is web accessible), so the official project for development of openSUSE python3 is https://build.opensuse.org/package/show/devel:languages:python:Factory/python3 all patches are there (from there I can make push request to the https://build.opensuse.org/package/show/openSUSE:Factory/python3 which is where openSUSE packages come from).

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 3, 2018

    Are you testing with patches? It may be interesting to try to get these patches upstream: (...)

    I applied manually these patches on 3.7: the 6 tests still pass.

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 3, 2018

    Some patches seem old. Are they still needed? Where can I find these patches? I'm interested by patches modifying site.py for example.

    I created PR 8057 to upstream distutils-reproducible-compile.patch.

    Matej Cepl: Would you mind to try to find the original author of this patch file? I would like to credit them.

    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 3, 2018

    FAIL: test_invalidation_mode (test.test_py_compile.PyCompileTests)
    ----------------------------------------------------------------------

    Traceback (most recent call last):
      File "/home/abuild/rpmbuild/BUILD/Python-3.7.0/Lib/test/test_py_compile.py", line 153, in test_invalidation_mode
        self.assertEqual(flags, 0b1)
    AssertionError: 3 != 1

    This failure looks suspicious. I looked at the code, and the tested function behaves differently depending of the SOURCE_DATE_EPOCH environment variable is set.

    Aha! I found something:

    $ SOURCE_DATE_EPOCH=1530605018 ./python -m test -j0
    ...
    6 tests failed:
        test_cmd_line_script test_compileall test_importlib
        test_multiprocessing_main_handling test_py_compile test_runpy
    ...

    @vstinner vstinner changed the title Python 3.7: 6 tests failed on OpenSUSE and Debian 6 tests fail using SOURCE_DATE_EPOCH env var Jul 3, 2018
    @vstinner
    Copy link
    Member Author

    vstinner commented Jul 3, 2018

    See bpo-29708 and PEP-552 for more info about reproducible builds.

    @mcepl
    Copy link
    Mannequin

    mcepl mannequin commented Jul 4, 2018

    From https://mail.python.org/pipermail/python-dev/2018-July/154273.html
    (by Nick Coghlan):

    In particular, if a build system sets SOURCE_DATE_EPOCH without
    specifying a pyc format for py_compile or compileall, Python 3.7 will
    give you checked hashes by default:
    https://docs.python.org/3/library/py_compile.html?highlight=source_date_epoch#py_compile.compile

    @thehesiod
    Copy link
    Mannequin

    thehesiod mannequin commented Jul 17, 2018

    we're compiling similar to debian and getting the same issues now only with 3.7 so interested in what the resolution is. I tried both w/ and w/o setting SOURCE_DATE_EPOCH and still get failures.

    @elprans
    Copy link
    Mannequin

    elprans mannequin commented Sep 21, 2018

    In particular, if a build system sets SOURCE_DATE_EPOCH without
    specifying a pyc format for py_compile or compileall, Python 3.7 will
    give you checked hashes by default

    Actually, py_compile will _force_ the CHECKED_HASH mode if SOURCE_DATE_EPOCH is set, regardless of what you specified for py_compile or compileall. I'm not sure if that's actually intended or a bug.

    The fix for the tests is to actually be aware of py_compile behavior and control for SOURCE_DATE_EPOCH. I submitted a PR with a fix.

    @benjaminp
    Copy link
    Contributor

    I dislike that having SOURCE_DATE_EPOCH set magically changes command line tools behavior. In my view, this problem should be fixed by reverting ccbe581.

    @elprans
    Copy link
    Mannequin

    elprans mannequin commented Sep 21, 2018

    Perhaps SOURCE_DATE_EPOCH should only be consulted to determine the default behavior if invalidation_mode was not passed explicitly to py_compile.compile().

    @elprans
    Copy link
    Mannequin

    elprans mannequin commented Sep 27, 2018

    #9607 turns SOURCE_DATE_EPOCH into a *default* rather than absolute override.

    test_cmd_line_script and test_runpy fail due to the lack of support for hash-based .pycs in zipimport, which needs fixing also.

    @vstinner
    Copy link
    Member Author

    #9607 turns SOURCE_DATE_EPOCH into a *default* rather than absolute override.

    Once we decided to merge or reject this PR, we should maybe update the PEP-552 to clarify the interaction with the SOURCE_DATE_EPOCH environment variable.

    @vstinner
    Copy link
    Member Author

    New changeset a6b3ec5 by Victor Stinner (Elvis Pranskevichus) in branch 'master':
    bpo-34022: Stop forcing of hash-based invalidation with SOURCE_DATE_EPOCH (GH-9607)
    a6b3ec5

    @vstinner
    Copy link
    Member Author

    There are still tests which fail when SOURCE_DATE_EPOCH env var is defined:

    $ SOURCE_DATE_EPOCH=0 ./python -m test -j0 -r
    (...)
    3 tests failed:
        test_cmd_line_script test_multiprocessing_main_handling test_runpy
    (...)

    @elprans
    Copy link
    Mannequin

    elprans mannequin commented Nov 4, 2018

    #10327 fixes the remaining test failures.

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented Nov 27, 2018

    As #10327 has been merged, I think this issue can be closed?

    @vstinner
    Copy link
    Member Author

    As #10327 has been merged, I think this issue can be closed?

    The Versions field of this issue is set to Python 3.7, but 7 tests are failing with:

    $ SOURCE_DATE_EPOCH=0 ./python -m test -j0 -r -u all,-gui
    (...)
    7 tests failed:
        test_cmd_line_script test_compileall test_importlib
        test_multiprocessing_main_handling test_posix test_py_compile
        test_runpy

    Note: the full test suite pass with SOURCE_DATE_EPOCH=0 on master.

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented Nov 27, 2018

    Looks like in #10327, Serhiy Storchaka considers fixing these issues for 3.8 only - "It is easier to skip the test on 3.7." and then remove the "needs backport to 3.7" label. How about changing the target version to 3.8 only and close this issue?

    @vstinner
    Copy link
    Member Author

    "What’s New In Python 3.7" mentions twice "build reproducibility":
    https://docs.python.org/dev/whatsnew/3.7.html

    @yan12125
    Copy link
    Mannequin

    yan12125 mannequin commented Nov 27, 2018

    Got it. Thanks for the pointer.

    @vstinner
    Copy link
    Member Author

    test_compileall, test_importlib, test_py_compile: I created #10775 backport.

    test_cmd_line_script, test_runpy and test_multiprocessing_main_handling failures are related to zipimport. They have been fixed in master by commit a6e956b which modifies Lib/zipimport.py... but in 3.7, zipimport is written in C. It seems non-trivial to fix zipimport, and I'm not sure that it's worth it.

    Note: test_posix now pass, no idea why it failed a few days ago.

    @miss-islington
    Copy link
    Contributor

    New changeset 24b51b1 by Miss Islington (bot) in branch '3.7':
    bpo-34022: Stop forcing of hash-based invalidation with SOURCE_DATE_EPOCH (GH-9607)
    24b51b1

    @vstinner
    Copy link
    Member Author

    New changeset 24b51b1 by Miss Islington (bot) in branch '3.7':

    With this change, only 3 tests fail on 3.7, and all these 3 fail because of zipimport: test_cmd_line_script, test_multiprocessing_main_handling and test_runpy.

    Chih-Hsuan Yen:

    Looks like in #10327, Serhiy Storchaka considers fixing these issues for 3.8 only - "It is easier to skip the test on 3.7." and then remove the "needs backport to 3.7" label. How about changing the target version to 3.8 only and close this issue?

    Now I agree to close the issue :-)

    I'm ok to not fix zipimport in 3.7.

    Anyway, it's not like Python is perfect in the master branch: frozenset in marshal is still not reproducible. See bpo-29708.

    @vstinner vstinner added the 3.8 (EOL) end of life label Nov 29, 2018
    @vstinner
    Copy link
    Member Author

    With this change, only 3 tests fail on 3.7, and all these 3 fail because of zipimport: test_cmd_line_script, test_multiprocessing_main_handling and test_runpy.

    These tests were fixed by:

    commit a6e956b
    Author: Elvis Pranskevichus <elvis@magic.io>
    Date: Wed Nov 7 13:34:59 2018 -0500

    bpo-34726: Fix handling of hash-based pycs in zipimport. (GH-10327)
    
    Current support for hash-based bytecode files in `zipimport` is rather
    sparse, which leads to test failures when the test suite is ran with
    the ``SOURCE_DATE_EPOCH`` environment variable set.
    
    This teaches zipimport to handle hash-based pycs properly.
    

    @ezio-melotti ezio-melotti transferred this issue from another repository Apr 10, 2022
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Labels
    3.7 (EOL) end of life 3.8 (EOL) end of life tests Tests in the Lib/test dir
    Projects
    None yet
    Development

    No branches or pull requests

    4 participants