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

gh-121874: Define audit-event open parameters consistently #121883

Merged
merged 1 commit into from
Jul 18, 2024

Conversation

bmwiedemann
Copy link
Contributor

@bmwiedemann bmwiedemann commented Jul 17, 2024

Define audit-event open parameters consistently to be the same as in

Doc/library/io.rst:   .. audit-event:: open path,mode,flags io.open
Doc/library/os.rst:   .. audit-event:: open path,mode,flags os.open

to avoid triggering a race-condition in Sphinx
that causes non-deterministic output.

See https://reproducible-builds.org/ for why this matters.

Fixes: #121874

This patch was done while working on reproducible builds for openSUSE, sponsored by the NLnet NGI0 fund.


📚 Documentation preview 📚: https://cpython-previews--121883.org.readthedocs.build/

as in
Doc/library/io.rst:   .. audit-event:: open path,mode,flags io.open
Doc/library/os.rst:   .. audit-event:: open path,mode,flags os.open
to avoid triggering a race-condition in Sphinx
that causes non-deterministic output.

See https://reproducible-builds.org/ for why this matters.

Fixes: python#121874

This patch was done while working on reproducible builds for openSUSE, sponsored by the NLnet NGI0 fund.
@hugovk
Copy link
Member

hugovk commented Jul 17, 2024

io.open is an alias for open and both have a file parameter rather than name.

https://docs.python.org/3/library/functions.html#open says:

open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)

...

Raises an auditing event open with arguments file, mode, flags.

https://docs.python.org/3/library/io.html#io.open says:

io.open(file, mode='r', buffering=-1, encoding=None, errors=None, newline=None, closefd=True, opener=None)

...

This function raises an auditing event open with arguments path, mode and flags. The mode and flags arguments may have been modified or inferred from the original call.

Should we change both to file rather than path? And write them all in italics?

bmwiedemann added a commit to bmwiedemann/cpython that referenced this pull request Jul 17, 2024
as in
Doc/library/functions.rst:   .. audit-event:: open file,mode,flags open
Doc/library/io.rst:   .. audit-event:: open path,mode,flags io.open
Doc/library/os.rst:   .. audit-event:: open path,mode,flags os.open
to avoid triggering a race-condition in Sphinx
that causes non-deterministic output.

See https://reproducible-builds.org/ for why this matters.

Fixes: python#121874
Alternative to: python#121883

This patch was done while working on reproducible builds for openSUSE, sponsored by the NLnet NGI0 fund.
@bmwiedemann
Copy link
Contributor Author

I tried that and found that os.open also needs to be adapted then, making the whole change more intrusive: https://github.com/bmwiedemann/cpython/pull/new/docrace2

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

This is incorrect. The name of the parameter is file, not path.

@bedevere-app
Copy link

bedevere-app bot commented Jul 17, 2024

A Python core developer has requested some changes be made to your pull request before we can consider merging it. If you could please address their requests along with any other requests in other reviews from core developers that would be appreciated.

Once you have made the requested changes, please leave a comment on this pull request containing the phrase I have made the requested changes; please review again. I will then notify any core developers who have left a review that you're ready for them to take another look at this pull request.

@bmwiedemann
Copy link
Contributor Author

I have made the requested changes; please review again.

@bedevere-app
Copy link

bedevere-app bot commented Jul 17, 2024

Thanks for making the requested changes!

@serhiy-storchaka: please review the changes made to this pull request.

Copy link
Member

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

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

LGTM.

@serhiy-storchaka serhiy-storchaka merged commit 24cf867 into python:main Jul 18, 2024
49 of 52 checks passed
@serhiy-storchaka serhiy-storchaka added needs backport to 3.12 bug and security fixes needs backport to 3.13 bugs and security fixes labels Jul 18, 2024
@miss-islington-app
Copy link

Thanks @bmwiedemann for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖

@miss-islington-app
Copy link

Thanks @bmwiedemann for the PR, and @serhiy-storchaka for merging it 🌮🎉.. I'm working now to backport this PR to: 3.13.
🐍🍒⛏🤖

miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 18, 2024
…honGH-121883)

Use same names for parameters to avoid triggering a race-condition in Sphinx
that causes non-deterministic output.
(cherry picked from commit 24cf867)

Co-authored-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Jul 18, 2024
…honGH-121883)

Use same names for parameters to avoid triggering a race-condition in Sphinx
that causes non-deterministic output.
(cherry picked from commit 24cf867)

Co-authored-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
@bedevere-app
Copy link

bedevere-app bot commented Jul 18, 2024

GH-121955 is a backport of this pull request to the 3.12 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.12 bug and security fixes label Jul 18, 2024
@bedevere-app
Copy link

bedevere-app bot commented Jul 18, 2024

GH-121956 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Jul 18, 2024
serhiy-storchaka pushed a commit that referenced this pull request Jul 18, 2024
…-121883) (GH-121955)

Use same names for parameters to avoid triggering a race-condition in Sphinx
that causes non-deterministic output.
(cherry picked from commit 24cf867)

Co-authored-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
hugovk added a commit that referenced this pull request Aug 9, 2024
…-121883) (#121956)

Co-authored-by: Bernhard M. Wiedemann <bwiedemann@suse.de>
Co-authored-by: Hugo van Kemenade <1324225+hugovk@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

docs: inconsistent open and io.open audit-event parameters
3 participants