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

Use conda_package_streaming for tarball extraction to avoid umask problems #74

Merged
merged 8 commits into from
Jun 7, 2024

Conversation

jaimergp
Copy link
Collaborator

@jaimergp jaimergp commented Jun 5, 2024

Description

Should help with reports like conda/conda-libmamba-solver#522 and conda-forge/miniforge#506 (comment).

Checklist - did you ...

  • Add a file to the news directory (using the template) for the next release's release notes?
  • Add / update necessary tests?
  • Add / update outdated documentation?

@conda-bot conda-bot added the cla-signed [bot] added once the contributor has signed the CLA label Jun 5, 2024
@jaimergp jaimergp marked this pull request as ready for review June 5, 2024 14:56
@jaimergp jaimergp requested a review from a team as a code owner June 5, 2024 14:56
Comment on lines 92 to 98
process = subprocess.Popen(
[CONDA_EXE, "constructor", "--prefix", tmp_path, "--extract-tarball"],
stdin=subprocess.PIPE,
umask=0o022,
)
process.communicate(tarbytes.getvalue())
rc = process.wait()
Copy link
Contributor

Choose a reason for hiding this comment

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

Could run_conda be expanded to add stdin strings or is it not worth the effort?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

If we need to send stdin in one more test, I'll do that :P

assert rc == 0
if sys.platform != "win32":
mode = (tmp_path / "naughty_umask").stat().st_mode
assert not mode & stat.S_IWGRP, "%o" % mode
Copy link
Contributor

Choose a reason for hiding this comment

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

This only checks group writing permissions. This is the origin of the bug, but shouldn't the entire umask be tested?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Maybe. I copied the logic from Daniel's PR but maybe I can simply test the resulting chmod. Should be 0o777-0o22 right?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

New commit added, hopefully with the expected changes :)

@jaimergp jaimergp merged commit 02feac0 into conda:main Jun 7, 2024
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed [bot] added once the contributor has signed the CLA
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

4 participants