indygreg / indygreg/PyOxidizer

execution of a pyoxidizer binary fails if importing a file with spaces

Open
#720 4 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
6.2k
Forks
256
PR merge metrics
No merged PRs in 30d

Description

Running the following configuration to build and run scoutsuite==5.13.0 results in a successful build but an un-runnable package:

def make_exe():
    dist = default_python_distribution()
    policy = dist.make_python_packaging_policy()
    policy.resources_location = "filesystem-relative:lib"
    policy.resources_location_fallback = "filesystem-relative:lib"
    python_config = dist.make_python_interpreter_config()
    python_config.run_module = "ScoutSuite"
    exe = dist.to_python_executable(
        name = "scout-oxide",
        packaging_policy = policy,
        config = python_config,
    )
    exe.add_python_resources(exe.pip_install(["scoutsuite==5.13.0"]))
    return exe

At runtime it fails with this error:

Traceback (most recent call last):
  File "runpy", line 196, in _run_module_as_main
  File "runpy", line 86, in _run_code
  File "ScoutSuite.__main__", line 15, in <module>
  File "ScoutSuite.core.server", line 2, in <module>
  File "cherrypy", line 66, in <module>
  File "cherrypy._cperror", line 135, in <module>
  File "cherrypy.lib.httputil", line 20, in <module>
  File "jaraco.collections", line 12, in <module>
  File "jaraco.text", line 231, in <module>
  File "importlib.abc", line 378, in read_text
  File "importlib._adapters", line 54, in open
ValueError

jaroco.text is trying to load a file from the python path with a space in it.

The maintainer of jaroco.text has made clear that files with spaces in them should be valid and is not willing to remove the space or modify the code that loads the file, and has requested that when encountering tools that don't support files with spaces to file upstream issues. (See 1, 2)

While not a minimal repro, I'm pretty sure this is pyoxidizer running into an issue with files with spaces on the python path.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the provided PyOxidizer configuration and traceback, then reproduce the failure using scoutsuite==5.13.0 and jaraco.text. Trace how the file path is represented when Python imports a resource containing spaces; done means the packaged binary can import that resource successfully. No PyOxidizer source file or test is named in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
python, rust
Domain
build-system
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.