Skip to content

gh-127172: Honor umask and default ACL when installing venv activation scripts - #154850

Merged
vsajip merged 1 commit into
python:mainfrom
tonghuaroot:venv-honor-umask-acl
Nov 12, 2026
Merged

vsajip merged 1 commit into
python:mainfrom
tonghuaroot:venv-honor-umask-acl

Conversation

@tonghuaroot

@tonghuaroot tonghuaroot commented Jul 29, 2026 •

Copy link
Copy Markdown
Contributor

venv installs the activation scripts (activate, activate.csh,
activate.fish) by copying the packaged template's mode onto the output, so
they always end up 0644 regardless of the process umask or any default ACL on
the target directory. Every other file venv creates (the pip wrappers, and
any file written afterwards) honors the umask and ACL, so the activation scripts
are the odd ones out: on a directory with a group-writable default ACL they come
out rw-r--r-- while pip* come out rw-rw-rw-.

Activation scripts are sourced, not executed, so they need no special mode. This
drops the mode-copying in install_scripts so the scripts inherit the umask and
default ACL like everything else venv writes.

The added regression test drives the process umask, so it needs no ACL support
and runs on every POSIX platform.

…ivation scripts

venv wrote the activation scripts with a fixed mode copied from the packaged
templates, so they ignored the process umask and any default ACL, unlike every
other file venv creates. Copy only the data and let the new files inherit the
umask and ACL.
@github-actions

Copy link
Copy Markdown

This PR is stale because it has been open for 90 days with no activity.

@github-actions github-actions Bot added the stale Stale PR or inactive for long period of time. label Oct 29, 2026
@vsajip
vsajip merged commit 1086205 into python:main Nov 12, 2026
52 checks passed
@vsajip vsajip added needs backport to 3.14 bugs and security fixes needs backport to 3.15 bugs and security fixes labels Nov 12, 2026
@miss-islington-app

Copy link
Copy Markdown

Thanks @tonghuaroot for the PR, and @vsajip for merging it 🌮🎉.. I'm working now to backport this PR to: 3.14.
🐍🍒⛏🤖

@miss-islington-app

Copy link
Copy Markdown

Thanks @tonghuaroot for the PR, and @vsajip for merging it 🌮🎉.. I'm working now to backport this PR to: 3.15.
🐍🍒⛏🤖

@bedevere-app

bedevere-app Bot commented Nov 12, 2026

Copy link
Copy Markdown

GH-161855 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.14 bugs and security fixes label Nov 12, 2026
@bedevere-app

bedevere-app Bot commented Nov 12, 2026

Copy link
Copy Markdown

GH-161856 is a backport of this pull request to the 3.15 branch.

@bedevere-app bedevere-app Bot removed the needs backport to 3.15 bugs and security fixes label Nov 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

stale Stale PR or inactive for long period of time.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants