Skip to content

configure.py: quote generated shell environment values #750

Description

@moreaki

Problem

configure.py writes non-Windows generated environment files as unquoted POSIX shell assignments. An inherited value containing a space makes the generated env.sh invalid.

Minimal reproduction

Run configure with a PATH entry such as:

/Applications/Little Snitch.app/Contents/Components

Current output contains an unquoted line equivalent to:

export PATH=/usr/bin:/Applications/Little Snitch.app/Contents/Components:/bin

Sourcing that line splits the value at the spaces and attempts to export extra words. The generated environment therefore cannot reproduce the configure environment.

Expected output is shell-quoted, for example:

export PATH='/usr/bin:/Applications/Little Snitch.app/Contents/Components:/bin'

Minimal fix

On non-Windows hosts, pass each stringified value through Python's shlex.quote before emitting export KEY=value. Windows env.bat output is unchanged. PR: #752.

Validation

  • Reproduced independently on current origin/main (5ac81eda).
  • python3 -m py_compile configure.py and git diff --check pass.
  • Ran a clean Darwin configure with the inherited Little Snitch path.
  • The generated env.sh sources successfully and restores the original PATH byte-for-byte.
  • The integrated full Darwin/Arm build completes after sourcing that file and supplying the separate kBuild SDK/tool overrides required by the current tree.

Scope note

This issue is only about POSIX shell quoting. It does not assert that env.sh by itself carries every selected SDK setting into kBuild; the current Darwin build still needs explicit PATH_SDK_MACOSX* and tool overrides.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions