indygreg / indygreg/PyOxidizer

Built extension hack causes SandboxViolation in bdist_egg

Open
#196 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

Splitting off from https://github.com/indygreg/PyOxidizer/issues/162#issuecomment-554753018 , as it is quite a bit more obscure and more difficult.

The hacked distutils writes to the `PYOXIDIZER_DISTUTILS_STATE_DIR`, which is not in the sandbox. This only occur for built extensions, which is what the hacked distutils is all about.

Installing `storyscript<0.26.0` using a `SetupPyInstall` rule triggers this -- the error occurs while it is handling the peewee dependency which has two built extensions.

I tried adding this hack https://github.com/aquynh/capstone/issues/583#issuecomment-177034772 to unixccompiler.py , to no avail.

Setting the `dest_path` for the hacks to the sandbox permitted directory does avoid the SandboxViolation.

`dest_path = output_dir if output_dir else os.path.dirname(output_filename)`

Then the .json and .o files are collected in the resources. This seems to be a sane direction to go, as the .json and .o can then be identified by the normal resources processing in `PythonResourceIterator` and be directed to be processed by a successor of `resolve_built_extensions`.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing SetupPyInstall through the hacked distutils and unixccompiler.py, focusing on writes to PYOXIDIZER_DISTUTILS_STATE_DIR during bdist_egg. Read PythonResourceIterator and resolve_built_extensions to understand how the proposed resource handling fits; done means the storyscript0.26.0 installation no longer raises SandboxViolation and the generated .json and .o files are processed correctly.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
build-system, devtools
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.