msg288880 - (view) |
Author: Bernhard M. Wiedemann (bmwiedemann) * |
Date: 2017-03-03 11:36 |
See https://reproducible-builds.org/ and https://reproducible-builds.org/docs/buy-in/ for why this is a good thing to have in general.
Fedora, openSUSE and possibly other Linux distributions package .pyc files as part of their binary rpm packages and they are not trivial to drop [1].
A .pyc header includes the timestamp of the source .py file
which creates non-reproducible builds when the .py file is touched during build time (e.g. for a version.py).
As of 2017-02-10 in openSUSE Factory this affected 476 packages (such as python-amqp and python3-Twisted).
[1] http://lists.opensuse.org/opensuse-packaging/2017-02/msg00086.html
|
msg288883 - (view) |
Author: Eric V. Smith (eric.smith) * |
Date: 2017-03-03 13:20 |
--
Eric.
> On Mar 3, 2017, at 6:36 AM, Bernhard M. Wiedemann <report@bugs.python.org> wrote:
>
>
> New submission from Bernhard M. Wiedemann:
>
> See https://reproducible-builds.org/ and https://reproducible-builds.org/docs/buy-in/ for why this is a good thing to have in general.
>
> Fedora, openSUSE and possibly other Linux distributions package .pyc files as part of their binary rpm packages and they are not trivial to drop [1].
>
> A .pyc header includes the timestamp of the source .py file
> which creates non-reproducible builds when the .py file is touched during build time (e.g. for a version.py).
> As of 2017-02-10 in openSUSE Factory this affected 476 packages (such as python-amqp and python3-Twisted).
>
>
> [1] http://lists.opensuse.org/opensuse-packaging/2017-02/msg00086.html
>
> ----------
> components: Build, Distutils
> messages: 288880
> nosy: bmwiedemann, dstufft, merwok
> priority: normal
> pull_requests: 353
> severity: normal
> status: open
> title: support reproducible Python builds
> versions: Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <http://bugs.python.org/issue29708>
> _______________________________________
> _______________________________________________
> New-bugs-announce mailing list
> New-bugs-announce@python.org
> https://mail.python.org/mailman/listinfo/new-bugs-announce
>
|
msg288889 - (view) |
Author: Barry A. Warsaw (barry) * |
Date: 2017-03-03 14:25 |
Shouldn't this at least also cover Python 3.7? And should it be officially backported? I would think that if https://github.com/python/cpython/pull/296 gets accepted for 3.7, then distros that care can cherry pick it back into whatever versions they still support. It probably needn't be officially cherry picked upstream.
(FWIW, this doesn't affect the Debian ecosystem since we don't ship pycs in debs.)
|
msg288948 - (view) |
Author: Bernhard M. Wiedemann (bmwiedemann) * |
Date: 2017-03-04 03:30 |
backports are optional.
It can help reduce duplicated work for the various distributions.
Currently, I think master and 2.7 are the most relevant targets.
|
msg301354 - (view) |
Author: Benjamin Peterson (benjamin.peterson) * |
Date: 2017-09-05 18:24 |
I have proposed PEP 552 to address this issue.
|
msg309394 - (view) |
Author: Alexandru Ardelean (Alexandru Ardelean) * |
Date: 2018-01-02 22:21 |
Hey,
Allow me to join the discussion here.
Context:
- I'm the maintainer of Python & Python3 in the OpenWrt distro, and (since a while) we also care about reproducible builds.
- The person [Alexander Couzens] who's leading the effort for OpenWrt, has pinged me about Python(3) and packages [to see about making them reproducible]
- In OpenWrt we *only* ship .pyc files, because of performance considerations [.pyc can be 10x faster than .py on some SoCs], and size limitation [we cannot allow auto .pyc generation since it can be expensive on RAM [ < 32 MB systems ] or flash [ ~8 MB sizes ] ; believe it or not, people run Python on something like this
Current status:
- so far I've implemented a simple change to Python & Python3 here:
https://github.com/openwrt/packages/pull/5303/commits/1b6dd4781f901a769718c49f6f255c15fd376f6e
- that has improved reproduce-ability quite a bit : only binaries are not reproduce-able now
- when I did this [1-2 weeks ago] I did not think of checking of any bug/issue opened here [ I only thought if this now ]
- I only checked what other distros may do regarding Python:
https://tests.reproducible-builds.org/debian/reproducible.html
References:
- initial discussion on OpenWrt: https://github.com/openwrt/packages/issues/5278
- PR with discussion: https://github.com/openwrt/packages/pull/5303
- current OpenWrt reproducible state [with the patch applied]: https://tests.reproducible-builds.org/lede/lede_ar71xx.html
I wanted to share my [and our] interest in this.
If we can help in any way, feel free to ping.
I will try to hack/patch some more stuff in the current Python releases to make them fully reproducible [for us], and probably share the results here.
When PEP 552 gets implemented and there will be a Python we will switch to them.
Atm, in trunk we package Python 2.7.14 & Python 3.6.4
Thanks
Alex
|
msg309395 - (view) |
Author: Benjamin Peterson (benjamin.peterson) * |
Date: 2018-01-02 22:25 |
PEP 552 has been implemented for 3.7.
|
msg309401 - (view) |
Author: Alexandru Ardelean (Alexandru Ardelean) * |
Date: 2018-01-03 08:24 |
Thank you for the heads-up.
I did not follow-up too in-depth on the resolution.
I just stumbled over this last night.
Will keep an eye for 3.7, and see about 2.7.
|
msg309870 - (view) |
Author: Brett Cannon (brett.cannon) * |
Date: 2018-01-12 19:22 |
A disagreement has popped up over what the ideal solution is on the PR currently connected to this issue. I'm having the folks involved switch it over to here.
IMO I think py_compile can respect SOURCE_DATE_EPOCH and just blindly use it for creating .pyc files. That way builds are reproducible. Yes, it will quite possibly lead to those .pyc files being regenerated the instant Python starts running, but SOURCE_DATE_EPOCH is entirely about builds, not runtimes. Plus .pyc files are just optimizations and so it is not critical they not be regenerated again later.
|
msg309905 - (view) |
Author: Eli Schwartz (eschwartz) * |
Date: 2018-01-14 00:57 |
So, a couple of things.
It seems to me, that properly supporting SOURCE_DATE_EPOCH means using exactly that and nothing else. To that end, I'm not entirely sure why things like --clamp-mtime even exist, as the original timestamp of a source file doesn't seem to have a lot of utility and it is better to be entirely predictable. But I'm not going to argue that, except insomuch as it seems IMHO to fit better for python to just keep things simple and override the timestamp with the value of SOURCE_DATE_EPOCH
That being said, I see two problems with python implementing something analogous to --clamp-mtime rather than just --mtime.
1) Source files are extracted by some build process, and remain untouched. Python generates bytecode pinned to the original time, rather than SOURCE_DATE_EPOCH. Later, the build process packages those files and implements --mtime, not --clamp-mtime. Because Python and the packaging software disagree about which one to use, the bytecode fails.
2) Source files are extracted, and the build process even tosses all timestamps to the side of the road, by explicitly `touch`ing all of them to the date of SOURCE_DATE_EPOCH just in case. Then for whatever reason (distro patches, 2to3, the use of `cp`) the timestamps get updated to $currentime. But SOURCE_DATE_EPOCH is in the future, so the timestamps get downdated. Python bytecode is generated by emulating --clamp-mtime. The build process then uses --mtime to package the files. Again, because Python and the packaging software disagree about which one to use, the bytecode fails.
Of course, in both those cases, blindly respecting SOURCE_DATE_EPOCH will seemingly break everything for people who use --clamp-mtime instead. I'm not happy with reproducible-builds.org for allowing either one.
I don't think python should rely on --mtime users manually overriding the filesystem metadata of the source files outside of py_compile, as that is a hack that I think we'd like to remove if possible... that being said, Arch Linux will, on second thought, not be adversely affected even if py_compile tries to be clever and emulate --clamp-mtime to decide on its own whether to respect SOURCE_DATE_EPOCH.
Likewise, I don't really expect people to try to reproduce builds using a future date for SOURCE_DATE_EPOCH. On the other hand, the reproducible builds spec doesn't forbid it AFAICT.
But... neither of those mitigations seem "clean" to me, for the reasons stated above.
There is something that would solve all these issues, though. From reading the importlib code (I haven't actually tried smoketesting actual imports), it appears that Python 2 accepts any bytecode that is dated at or later than the timestamp of its source .py, while Python 3 requires the timestamps to perfectly match. This seems bizarre to behave differently, especially as until @bmwiedemann mentioned it on the GitHub PR I blindly assumed that Python would not care if your bytecode is somehow dated later than your sources. If the user is playing monkey games with mismatched source and byte code, while backdating the source code to *trick* the interpreter into loading it... let them? They can break their stuff if they want to!
On looking through the commit logs, it seems that Python 3 used to do the same, until https://github.com/python/cpython/commit/61b14251d3a653548f70350acb250cf23b696372 refactored the general vicinity and modified this behavior without warning. In a commit that seems to be designed to do something else entirely. This really should have been two separate commits, and modifying the import code to more strictly check the timestamp should have come with an explanatory justification. Because I cannot think of a good reason for this behavior, and the commit isn't giving me an opportunity to understand either. As it is, I am completely confused, and have no idea whether this was even supposed to be deliberate.
In hindsight it is certainly preventing nice solutions to supporting SOURCE_DATE_EPOCH.
|
msg309931 - (view) |
Author: Brett Cannon (brett.cannon) * |
Date: 2018-01-14 18:19 |
As Eli's comments are coming off as negative to/at me, I feel like I have
to defend myself here. If you look at the commit there was actually two
places where the timestamp was checked; one did an equality comparison and
one did a >= comparison. It's quite possible the semantics accidentally
changed as part of the refactoring due to the check being done in different
places and a different one was copied, although no one has even noticed
until now.
If there is a desire to change the semantics of how timestamps are checked
then that should be done in a separate issue as at this point we have lived
with the current semantics for several releases -- all releases of Python 3
still receiving security updates -- so it's passed being a bug and is now
the semantics in Python 3.
On Sat, Jan 13, 2018, 16:57 Eli Schwartz, <report@bugs.python.org> wrote:
>
> Eli Schwartz <eschwartz93@gmail.com> added the comment:
>
> So, a couple of things.
>
> It seems to me, that properly supporting SOURCE_DATE_EPOCH means using
> exactly that and nothing else. To that end, I'm not entirely sure why
> things like --clamp-mtime even exist, as the original timestamp of a source
> file doesn't seem to have a lot of utility and it is better to be entirely
> predictable. But I'm not going to argue that, except insomuch as it seems
> IMHO to fit better for python to just keep things simple and override the
> timestamp with the value of SOURCE_DATE_EPOCH
>
> That being said, I see two problems with python implementing something
> analogous to --clamp-mtime rather than just --mtime.
>
>
> 1) Source files are extracted by some build process, and remain untouched.
> Python generates bytecode pinned to the original time, rather than
> SOURCE_DATE_EPOCH. Later, the build process packages those files and
> implements --mtime, not --clamp-mtime. Because Python and the packaging
> software disagree about which one to use, the bytecode fails.
>
> 2) Source files are extracted, and the build process even tosses all
> timestamps to the side of the road, by explicitly `touch`ing all of them to
> the date of SOURCE_DATE_EPOCH just in case. Then for whatever reason
> (distro patches, 2to3, the use of `cp`) the timestamps get updated to
> $currentime. But SOURCE_DATE_EPOCH is in the future, so the timestamps get
> downdated. Python bytecode is generated by emulating --clamp-mtime. The
> build process then uses --mtime to package the files. Again, because Python
> and the packaging software disagree about which one to use, the bytecode
> fails.
>
> Of course, in both those cases, blindly respecting SOURCE_DATE_EPOCH will
> seemingly break everything for people who use --clamp-mtime instead. I'm
> not happy with reproducible-builds.org for allowing either one.
>
> I don't think python should rely on --mtime users manually overriding the
> filesystem metadata of the source files outside of py_compile, as that is a
> hack that I think we'd like to remove if possible... that being said, Arch
> Linux will, on second thought, not be adversely affected even if py_compile
> tries to be clever and emulate --clamp-mtime to decide on its own whether
> to respect SOURCE_DATE_EPOCH.
>
> Likewise, I don't really expect people to try to reproduce builds using a
> future date for SOURCE_DATE_EPOCH. On the other hand, the reproducible
> builds spec doesn't forbid it AFAICT.
>
> But... neither of those mitigations seem "clean" to me, for the reasons
> stated above.
>
> There is something that would solve all these issues, though. From reading
> the importlib code (I haven't actually tried smoketesting actual imports),
> it appears that Python 2 accepts any bytecode that is dated at or later
> than the timestamp of its source .py, while Python 3 requires the
> timestamps to perfectly match. This seems bizarre to behave differently,
> especially as until @bmwiedemann mentioned it on the GitHub PR I blindly
> assumed that Python would not care if your bytecode is somehow dated later
> than your sources. If the user is playing monkey games with mismatched
> source and byte code, while backdating the source code to *trick* the
> interpreter into loading it... let them? They can break their stuff if they
> want to!
>
> On looking through the commit logs, it seems that Python 3 used to do the
> same, until
> https://github.com/python/cpython/commit/61b14251d3a653548f70350acb250cf23b696372
> refactored the general vicinity and modified this behavior without warning.
> In a commit that seems to be designed to do something else entirely. This
> really should have been two separate commits, and modifying the import code
> to more strictly check the timestamp should have come with an explanatory
> justification. Because I cannot think of a good reason for this behavior,
> and the commit isn't giving me an opportunity to understand either. As it
> is, I am completely confused, and have no idea whether this was even
> supposed to be deliberate.
> In hindsight it is certainly preventing nice solutions to supporting
> SOURCE_DATE_EPOCH.
>
> ----------
> nosy: +eschwartz
>
> _______________________________________
> Python tracker <report@bugs.python.org>
> <https://bugs.python.org/issue29708>
> _______________________________________
>
|
msg309972 - (view) |
Author: Bernhard M. Wiedemann (bmwiedemann) * |
Date: 2018-01-15 12:56 |
I think, there is no single nice and clean solution with time-based .pyc files, but to get a whole distribution to build reproducibly, there are two other ways:
1) if the SOURCE_DATE_EPOCH environment variable is set,
make hash-based .pyc files the default.
2) instead of storing .py mtime in the .pyc header, use the .pyc's filesystem mtime value - also making it more available to users.
Not sure if this would have side-effects or cause regressions.
on the side-issue: IMHO checking exact mtimes is the right thing to do, because sometimes users will copy back old .py files and expect mismatching .pyc files to not be used.
|
msg310010 - (view) |
Author: Brett Cannon (brett.cannon) * |
Date: 2018-01-15 19:31 |
Bernhard's idea of SOURCE_DATE_EPOCH being an implicit envvar to forcibly switch on hash-based .pyc files in py_compile is intriguing. I assume this would force the check_source bit to be set? Or since SOURCE_DATE_EPOCH should only be used in build scenarios would you want UNCHECKED_HASH?
As the core dev who seems the most engaged and willing to commit this, I'm willing to make the final decision on this and commit the final PR. I see the options of getting this into 3.7 as the following:
1. SOURCE_DATE_EPOCH acts as an environment variable flag to forcibly generate hash-based .pyc files with the check_source bit set in py_compile and compileall
2. SOURCE_DATE_EPOCH is used to specifically set the timestamp in .pyc files in py_compile and compileall
That's it. No clamping, no changing how timestamp-based .pyc files are invalidated, no touching source files, etc.
If this is going to make it into Python 3.7 then a decision must be made by Friday, Jan 19, so have your opinions on those two options in before then (and in the case of the hash-based solution, would you expect CHECKED_HASH or UNCHECKED_HASH?). At that point I will make a decision and Bernhard can either update his PR or I can create a new one forked from his(I leave that up to Bernhard based on the decision I'll make on/by Friday).
|
msg310012 - (view) |
Author: Barry A. Warsaw (barry) * |
Date: 2018-01-15 19:41 |
On Jan 15, 2018, at 11:31, Brett Cannon <report@bugs.python.org> wrote:
>
> 1. SOURCE_DATE_EPOCH acts as an environment variable flag to forcibly generate hash-based .pyc files with the check_source bit set in py_compile and compileall
> 2. SOURCE_DATE_EPOCH is used to specifically set the timestamp in .pyc files in py_compile and compileall
I’d suggest that if SDE is set to an integer, that is used as the timestamp. If it’s set to a special symbol (e.g. ‘hash’) then the hash is used. I’m not volunteering to write the code though. :)
|
msg310292 - (view) |
Author: Brett Cannon (brett.cannon) * |
Date: 2018-01-19 22:08 |
Since Barry chose an option that wasn't listed, I'm planning on accepting Bernhard's https://github.com/python/cpython/pull/5200 at some point next week barring any new, unique objections.
|
msg310636 - (view) |
Author: Brett Cannon (brett.cannon) * |
Date: 2018-01-24 21:26 |
New changeset ccbe5818af20f8c12043f5c30c277a74714405e0 by Brett Cannon (Bernhard M. Wiedemann) in branch 'master':
bpo-29708: Setting SOURCE_DATE_EPOCH forces hash-based .pyc files (GH-5200)
https://github.com/python/cpython/commit/ccbe5818af20f8c12043f5c30c277a74714405e0
|
msg310637 - (view) |
Author: Brett Cannon (brett.cannon) * |
Date: 2018-01-24 21:27 |
Just merged Bernhard's PR which forces hash-based .pyc files. Thanks to everyone who constructively helped reach this point.
|
msg310652 - (view) |
Author: Brett Cannon (brett.cannon) * |
Date: 2018-01-25 01:13 |
New changeset cab0b2b053970982b760048acc3046363615a8dd by Brett Cannon in branch 'master':
bpo-29708: Add What's New entries for SOURCE_DATE_EPOCH and py_compile (GH-5306)
https://github.com/python/cpython/commit/cab0b2b053970982b760048acc3046363615a8dd
|
msg310661 - (view) |
Author: Alexandru Ardelean (Alexandru Ardelean) * |
Date: 2018-01-25 08:07 |
Hey,
Sorry, if I'm a bit late to the party with this.
The road to reproducible builds has a few more steps.
The way I validate whether Python is reproducible is with this link:
https://tests.reproducible-builds.org/lede/lede_ar71xx.html
There is a need to also patch getbuildinfo.c to make Python reproducible.
I have opened a PR for this : https://github.com/python/cpython/pull/5313
I've waited for the periodic build to trigger on that reproducible page.
In OpenWrt, the packages to look for [that is affected by this getbuildinfo.c patch] are python-base & python3-base.
There are still some python3 packages that need patching.
Seems that python3-asyncio, pydoc, and some other pyc files need investigation.
I'll check.
Maybe this isn't an issue in 3.7.
Alex
|
msg311317 - (view) |
Author: Bernhard M. Wiedemann (bmwiedemann) * |
Date: 2018-01-31 08:34 |
Any chance we can get the (somewhat related) patch for https://bugs.python.org/issue30693 also merged?
|
msg313312 - (view) |
Author: Will Thompson (Will Thompson) |
Date: 2018-03-06 09:34 |
For what it's worth, in Endless OS we still saw slight variations between builds in the .pyc files, even with all the source files' mtimes set to the epoch (ie. equivalent to setting & supporting SOURCE_DATE_EPOCH, I believe). Looking at the contents of the file suggested it was just reordering of class fields; indeed, we only saw this on Python versions where hash randomization is enabled by default, and disabling hash randomization made the output reproducible.
|
msg313313 - (view) |
Author: Alexandru Ardelean (Alexandru Ardelean) * |
Date: 2018-03-06 09:46 |
Yeah, I also see it with 3.6.4.
I wanted to try 3.7 to see if it's fixed by chance.
Otherwise I may have to start digging deep into compilation logic.
Looking here:
https://tests.reproducible-builds.org/lede/lede_ar71xx.html
More specifically here:
https://tests.reproducible-builds.org/lede/dbd/packages/mips_24kc/packages/python3-asyncio_3.6.4-5_mips_24kc.ipk.html
it looks like 2 byte-codes are inverted
build1: 00007f80:·0100·003e·0200·0000·72b6·0000·0072·b500··...>....r....r..
build2: 00007f80:·0100·003e·0200·0000·72b5·0000·0072·b600··...>....r....r..
72b6 and 72b5 like to swap positions sometimes.
|
msg313383 - (view) |
Author: Inada Naoki (methane) * |
Date: 2018-03-07 11:07 |
00007f80:·0100·003e·0200·0000·72b6·0000·0072·b500··...>....r....r..
vs
00007f80:·0100·003e·0200·0000·72b5·0000·0072·b600··...>....r....r..
3e 02 00 00 00 is frozenset(size=2)
72 b6/b5 00 00 00 is reference to b5 or b6
So it seems set order changed. (or items in the set is appearance order is changed.)
Did you set PYTHONHASHSEED?
Anyway, I think Python 3.7 can't guarantee "reproducible" compile because marshal uses reference count.
|
msg313384 - (view) |
Author: Inada Naoki (methane) * |
Date: 2018-03-07 11:08 |
3e 02 00 00 00 is frozenset(size=2)
72 b6/b5 00 00 00 is reference to b5 or b6
So it seems set order changed. (or items in the set is appearance order is changed.)
Did you set PYTHONHASHSEED?
Anyway, I think Python 3.7 can't guarantee "reproducible" compile because marshal uses reference count.
|
msg313391 - (view) |
Author: Alexandru Ardelean (Alexandru Ardelean) * |
Date: 2018-03-07 18:41 |
PYTHONHASHSEED does help on 3.6.4
I'll use it during build.
Thanks for help
|
msg320942 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2018-07-03 07:52 |
I created PR 8057 to upstream distutils-reproducible-compile.patch from OpenSUSE (context: see bpo-34022).
|
msg320989 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2018-07-03 15:46 |
I created bpo-34033: distutils is not reproducible.
|
msg321002 - (view) |
Author: Bernhard M. Wiedemann (bmwiedemann) * |
Date: 2018-07-03 19:49 |
also related to this topic: https://github.com/pypa/pip/pull/5525 for pip's RECORD file.
|
msg327480 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2018-10-10 16:43 |
New changeset a6b3ec5b6d4f6387820fccc570eea08b9615620d by Victor Stinner (Elvis Pranskevichus) in branch 'master':
bpo-34022: Stop forcing of hash-based invalidation with SOURCE_DATE_EPOCH (GH-9607)
https://github.com/python/cpython/commit/a6b3ec5b6d4f6387820fccc570eea08b9615620d
|
msg330623 - (view) |
Author: miss-islington (miss-islington) |
Date: 2018-11-28 17:45 |
New changeset 24b51b1a4919e310d338629cc60371387f475a32 by Miss Islington (bot) in branch '3.7':
bpo-34022: Stop forcing of hash-based invalidation with SOURCE_DATE_EPOCH (GH-9607)
https://github.com/python/cpython/commit/24b51b1a4919e310d338629cc60371387f475a32
|
msg347971 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2019-07-15 15:06 |
I created bpo-37596 "Reproducible pyc: frozenset is not serialized in a deterministic order".
|
msg384065 - (view) |
Author: Frederik Rietdijk (Frederik Rietdijk) |
Date: 2020-12-30 13:08 |
Building Python packages reproducibly has now basically been resolved with the reproducible bytecode as well as changes in tools such as pip.
Unfortunately, the interpreters do not yet seem to be reproducible. After certain changes, a Nixpkgs build of 3.9 shows several tiny bytecode differences. What could have caused these differences? Please see the attached diffoscope report.
As part of installation all bytecode is force regenerated using compileall. This is using the default checked-hash.
|
msg384066 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2020-12-30 13:10 |
> tiny bytecode differences
bpo-37596 "Reproducible pyc: frozenset is not serialized in a deterministic order" is not fixed yet.
|
msg384099 - (view) |
Author: Inada Naoki (methane) * |
Date: 2020-12-31 03:05 |
See bpo-34093 too.
|
msg384100 - (view) |
Author: Frederik Rietdijk (Frederik Rietdijk) |
Date: 2020-12-31 08:07 |
note the optimized .pyc is deterministic. As far as I know only __debug__ is set to False, or is there something else different?
|
msg384104 - (view) |
Author: Inada Naoki (methane) * |
Date: 2020-12-31 09:06 |
> note the optimized .pyc is deterministic. As far as I know only __debug__ is set to False, or is there something else different?
There is no difference between normal pyc and optimized pyc.
* frozenset is deterministic if PYTHONHASHSEED is set
* FLAG_REF is unstable. It is based on reference count but it is changed by various environment (environment variables, build path, order of py files, and any other thing using interned strings). bpo-30493 must be fixed.
|
msg384110 - (view) |
Author: STINNER Victor (vstinner) * |
Date: 2020-12-31 12:11 |
> note the optimized .pyc is deterministic. As far as I know only __debug__ is set to False, or is there something else different?
Hum, maybe there is a misunderstanding on the PEP 552 purpose.
I understood that the main point of the PEP 552 is to compare hash(<source code>), rather than checking the .py and .pyc file modification time.
It doesn't magically make the PYC file content fully reproducible. Correct me if I misunderstood PEP 552 as well.
|
msg384123 - (view) |
Author: Benjamin Peterson (benjamin.peterson) * |
Date: 2020-12-31 15:10 |
PEP 552 was a necessary but not sufficient step on the road towards fully deterministic pycs. The PEP says: "(Note there are other problems [1] [2] we do not address here that can make pycs non-deterministic.)" where [1] and [2] are basically the issues Inada-san has linked.
|
msg386272 - (view) |
Author: Steve Dower (steve.dower) * |
Date: 2021-02-03 18:09 |
This doesn't seem to necessarily impact distutils, so I'm leaving it open despite PEP 632.
|
msg391616 - (view) |
Author: Felix C. Stegerman (obfusk) * |
Date: 2021-04-22 17:01 |
Hi! I've been working on reproducible builds for python-for-android [1,2,3].
Current issues with .pyc files are:
* .pyc files differ depending on whether Python was compiled w/ liblzma-dev installed or not;
* many .pyc files include build paths;
* some .pyc files include paths to system utilities, like `/bin/mkdir` or `/usr/bin/install`, which can differ between systems (e.g. on Debian w/ merged /usr).
[1] https://github.com/kivy/python-for-android/pull/2390
[2] https://lists.reproducible-builds.org/pipermail/rb-general/2021-January/002132.html
[3] https://lists.reproducible-builds.org/pipermail/rb-general/2021-March/002207.html
|
|
Date |
User |
Action |
Args |
2022-04-11 14:58:43 | admin | set | github: 73894 |
2021-04-22 17:01:17 | obfusk | set | messages:
+ msg391616 |
2021-04-22 16:51:56 | obfusk | set | nosy:
+ obfusk
|
2021-04-15 00:33:16 | benjamin.peterson | link | issue43850 superseder |
2021-02-03 18:09:23 | steve.dower | set | nosy:
+ steve.dower messages:
+ msg386272
dependencies:
- Reproducible pyc: FLAG_REF is not stable., Reproducible pyc: frozenset is not serialized in a deterministic order components:
- Distutils |
2021-01-04 21:12:16 | brett.cannon | set | nosy:
- brett.cannon
|
2020-12-31 15:10:28 | benjamin.peterson | set | messages:
+ msg384123 |
2020-12-31 12:11:15 | vstinner | set | messages:
+ msg384110 |
2020-12-31 09:06:54 | methane | set | dependencies:
+ Reproducible pyc: FLAG_REF is not stable. |
2020-12-31 09:06:37 | methane | set | messages:
+ msg384104 versions:
+ Python 3.10, - Python 3.9 |
2020-12-31 08:07:35 | Frederik Rietdijk | set | messages:
+ msg384100 |
2020-12-31 03:05:31 | methane | set | messages:
+ msg384099 |
2020-12-30 13:10:04 | vstinner | set | messages:
+ msg384066 |
2020-12-30 13:08:47 | Frederik Rietdijk | set | files:
+ python39_2.html versions:
+ Python 3.9, - Python 3.7 nosy:
+ Frederik Rietdijk
messages:
+ msg384065
|
2020-10-22 20:46:51 | Will Thompson | set | nosy:
- Will Thompson
|
2020-10-22 20:40:05 | eric.araujo | set | dependencies:
- setup.py sdist should honor SOURCE_DATE_EPOCH, setup.py sdist --format=gztar should use (equivalent of) `gzip -n` |
2020-10-22 20:39:28 | eric.araujo | set | dependencies:
+ Reproducible pyc: frozenset is not serialized in a deterministic order, setup.py sdist should honor SOURCE_DATE_EPOCH, setup.py sdist --format=gztar should use (equivalent of) `gzip -n` |
2020-04-08 12:49:01 | jefferyto | set | nosy:
+ jefferyto
|
2019-07-15 15:06:34 | vstinner | set | messages:
+ msg347971 |
2018-11-28 17:45:40 | miss-islington | set | nosy:
+ miss-islington messages:
+ msg330623
|
2018-11-28 17:19:03 | miss-islington | set | pull_requests:
+ pull_request10019 |
2018-11-13 13:30:43 | sascha_silbe | set | nosy:
+ sascha_silbe
|
2018-10-10 16:43:20 | vstinner | set | messages:
+ msg327480 |
2018-09-27 17:19:45 | Elvis.Pranskevichus | set | pull_requests:
+ pull_request9005 |
2018-07-03 19:49:30 | bmwiedemann | set | messages:
+ msg321002 |
2018-07-03 15:46:47 | vstinner | set | messages:
+ msg320989 |
2018-07-03 09:29:39 | mcepl | set | nosy:
+ mcepl
|
2018-07-03 07:52:03 | vstinner | set | messages:
+ msg320942 |
2018-07-03 07:45:37 | vstinner | set | stage: patch review pull_requests:
+ pull_request7666 |
2018-03-07 18:41:15 | Alexandru Ardelean | set | messages:
+ msg313391 |
2018-03-07 11:08:00 | methane | set | nosy:
barry, brett.cannon, vstinner, eric.smith, benjamin.peterson, eric.araujo, methane, dstufft, bmwiedemann, Alexandru Ardelean, Ray Donnelly, eschwartz, Will Thompson messages:
+ msg313384 |
2018-03-07 11:07:41 | methane | set | nosy:
+ methane messages:
+ msg313383
|
2018-03-06 09:46:12 | Alexandru Ardelean | set | messages:
+ msg313313 |
2018-03-06 09:34:53 | Will Thompson | set | nosy:
+ Will Thompson messages:
+ msg313312
|
2018-01-31 08:34:31 | bmwiedemann | set | messages:
+ msg311317 |
2018-01-30 20:27:46 | brett.cannon | set | assignee: brett.cannon -> stage: resolved -> (no value) |
2018-01-25 18:47:40 | brett.cannon | set | status: closed -> open resolution: fixed -> |
2018-01-25 08:07:47 | Alexandru Ardelean | set | messages:
+ msg310661 |
2018-01-25 07:55:24 | Alexandru Ardelean | set | pull_requests:
+ pull_request5159 |
2018-01-25 01:13:26 | brett.cannon | set | messages:
+ msg310652 |
2018-01-25 00:53:52 | brett.cannon | set | pull_requests:
+ pull_request5153 |
2018-01-24 21:27:17 | brett.cannon | set | status: open -> closed resolution: fixed messages:
+ msg310637
stage: patch review -> resolved |
2018-01-24 21:26:21 | brett.cannon | set | messages:
+ msg310636 |
2018-01-20 08:48:50 | yan12125 | set | nosy:
- yan12125
|
2018-01-19 22:08:26 | brett.cannon | set | messages:
+ msg310292 |
2018-01-16 10:10:56 | bmwiedemann | set | keywords:
+ patch stage: patch review pull_requests:
+ pull_request5054 |
2018-01-15 19:41:19 | barry | set | messages:
+ msg310012 |
2018-01-15 19:31:35 | brett.cannon | set | assignee: brett.cannon messages:
+ msg310010 versions:
- Python 2.7, Python 3.3, Python 3.4, Python 3.5, Python 3.6 |
2018-01-15 12:56:33 | bmwiedemann | set | messages:
+ msg309972 |
2018-01-14 18:19:03 | brett.cannon | set | messages:
+ msg309931 |
2018-01-14 00:57:43 | eschwartz | set | nosy:
+ eschwartz messages:
+ msg309905
|
2018-01-12 19:22:13 | brett.cannon | set | messages:
+ msg309870 |
2018-01-03 08:33:17 | pitrou | set | nosy:
+ Ray Donnelly
|
2018-01-03 08:24:52 | Alexandru Ardelean | set | messages:
+ msg309401 |
2018-01-02 22:25:57 | benjamin.peterson | set | messages:
+ msg309395 |
2018-01-02 22:21:01 | Alexandru Ardelean | set | nosy:
+ Alexandru Ardelean messages:
+ msg309394
|
2017-09-05 18:24:18 | benjamin.peterson | set | nosy:
+ benjamin.peterson messages:
+ msg301354
|
2017-08-31 12:43:58 | vstinner | set | nosy:
+ vstinner
|
2017-08-31 12:40:30 | r.david.murray | link | issue31312 superseder |
2017-03-06 18:43:12 | brett.cannon | set | nosy:
+ brett.cannon
|
2017-03-04 16:00:58 | yan12125 | set | nosy:
+ yan12125
|
2017-03-04 03:30:40 | bmwiedemann | set | messages:
+ msg288948 versions:
+ Python 3.7 |
2017-03-03 14:25:10 | barry | set | messages:
+ msg288889 |
2017-03-03 14:23:08 | barry | set | nosy:
+ barry
|
2017-03-03 13:20:40 | eric.smith | set | nosy:
+ eric.smith messages:
+ msg288883
|
2017-03-03 11:36:06 | bmwiedemann | create | |