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

00328: Restore pyc to TIMESTAMP invalidation mode as default in rpmbuild #3

Merged
merged 1 commit into from Jul 15, 2019

Conversation

hroncok
Copy link
Member

@hroncok hroncok commented Jul 11, 2019

Since Fedora 31, the $SOURCE_DATE_EPOCH is set in rpmbuild to the latest
%changelog date. This makes Python default to the CHECKED_HASH pyc
invalidation mode, bringing more reproducible builds traded for an import
performance decrease. To avoid that, we don't default to CHECKED_HASH
when $RPM_BUILD_ROOT is set (i.e. when we are building RPM packages).

See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426

Untested yet. Will run a scratchbuild.

@hroncok
Copy link
Member Author

hroncok commented Jul 11, 2019

Prior to this change:

$ hexdump usr/lib64/python3.8/__pycache__/codecs.cpython-38.pyc | head -n1
0000000 0d53 0a0d 0003 0000 7730 bf47 16d2 6c2d

Scratchbuild: https://koji.fedoraproject.org/koji/taskinfo?taskID=36183131

@hroncok hroncok self-assigned this Jul 11, 2019
@hroncok hroncok added the WIP Work in progreess label Jul 11, 2019
@hroncok
Copy link
Member Author

hroncok commented Jul 11, 2019

With the change (file from the aarch64 package):

$ hexdump usr/lib64/python3.8/__pycache__/codecs.cpython-38.pyc | head -n1
0000000 0d53 0a0d 0000 0000 d9eb 5d1d 8eee 0000

@hroncok
Copy link
Member Author

hroncok commented Jul 11, 2019

Running python3 build in https://copr.fedorainfracloud.org/coprs/churchyard/dirty-tests/builds/ so I can test Python 3 package rebuilds against it.

Since Fedora 31, the $SOURCE_DATE_EPOCH is set in rpmbuild to the latest
%changelog date. This makes Python default to the CHECKED_HASH pyc
invalidation mode, bringing more reproducible builds traded for an import
performance decrease. To avoid that, we don't default to CHECKED_HASH
when $RPM_BUILD_ROOT is set (i.e. when we are building RPM packages).

See https://src.fedoraproject.org/rpms/redhat-rpm-config/pull-request/57#comment-27426
@hroncok
Copy link
Member Author

hroncok commented Jul 11, 2019

Prior to the build:

$ hexdump usr/lib/python3.7/site-packages/emcee/__pycache__/mh.cpython-37.pyc | head -n1
0000000 0d42 0a0d 0003 0000 13eb 2a64 d154 f403

@hroncok
Copy link
Member Author

hroncok commented Jul 11, 2019

After the build:

$ hexdump usr/lib/python3.7/site-packages/emcee/__pycache__/mh.cpython-37.pyc | head -n1
0000000 0d42 0a0d 0000 0000 9a90 5788 1563 0000

This indeed fixes the problem.

@hroncok hroncok removed the WIP Work in progreess label Jul 11, 2019
Copy link
Member

@encukou encukou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, as does your test. (I didn't test myself.)

@hroncok hroncok merged commit 746a45a into fedora-python:fedora-3.8 Jul 15, 2019
@hroncok hroncok deleted the source_epoch branch July 15, 2019 13:35
hrnciar pushed a commit that referenced this pull request May 8, 2022
…python#91466)

Fix an uninitialized bool in exception print context.
    
`struct exception_print_context.need_close` was uninitialized.
    
Found by oss-fuzz in a test case running under the undefined behavior sanitizer.
    
https://oss-fuzz.com/testcase-detail/6217746058182656
    
```
Python/pythonrun.c:1241:28: runtime error: load of value 253, which is not a valid value for type 'bool'
    #0 0xbf2203 in print_chained cpython3/Python/pythonrun.c:1241:28
    #1 0xbea4bb in print_exception_cause_and_context cpython3/Python/pythonrun.c:1320:19
    #2 0xbea4bb in print_exception_recursive cpython3/Python/pythonrun.c:1470:13
    #3 0xbe9e39 in _PyErr_Display cpython3/Python/pythonrun.c:1517:9
```
    
Pretty obvious what the ommission was upon code inspection.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants