| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Makes it a hard failure for environment variables in paths to be empty. Fixes python#427
There was a problem hiding this comment.
Path expansion can still select the working directory unexpectedly, and fallback lookup and resource-cleanup defects remain.
4 open issuesThis PR addresses #427 by recovering missing Windows environment variables during configuration loading, helping prevent Python Manager from resolving installation paths against the working directory.
Changes:
| File | Description |
|---|---|
| tests/test_pathutils.py | Tests absolute and relative Windows paths. |
| tests/test_config.py | Tests missing variables, fallback values, and configuration resolution. |
| src/manage/pathutils.py | Adds absolute-path detection. |
| src/manage/config.py | Adds environment fallback and stricter substitution handling. |
| src/_native/misc.cpp | Retrieves a default Windows environment block. |
| _msbuild.py | Links and exposes the native environment helper. |
| _msbuild_test.py | Adds native helper support to the test build. |
Review effort: Balanced
Sorry, something went wrong.
There was a problem hiding this comment.
Explicit environment mappings are ignored when empty and are not forwarded during nested configuration resolution.
No open issues 🎉
2 previously missed issuesIn code that hasn't changed since last review
src/manage/config.py:259
The new environ argument is not forwarded by the recursive call on line 275. Nested settings such as install.source and list.format therefore use the process environment instead of the supplied mapping, unlike top-level settings. A value consisting solely of a variable supplied only in that mapping is silently removed. Forward environ when resolving nested schemas so all levels use the same environment.
src/manage/config.py:283
An explicitly supplied empty environment is ignored because {} is falsy. For example, resolving %AppData%/Python with environ={} reads the process environment and OS fallbacks instead of reporting the missing variable. Select the default only when environ is None so an intentionally empty mapping is respected.
4 resolved since last reviewReview effort: Balanced
Sorry, something went wrong.
There was a problem hiding this comment.
Unresolved configuration fallback, strict path expansion, path utility, and test failures block approval.
1 open issue 2 previously missed issuesIn code that hasn't changed since last review
src/manage/config.py:254
This only raises when the placeholder is followed by a path separator. A path-valued setting whose entire value is %TEMP% or %AppData% still expands to an empty string, and resolve_config then deletes the setting, allowing a later default (such as the current directory) instead of failing as promised. Apply strict empty-substitution validation to path-valued settings while preserving optional expansion for non-path settings.
src/manage/pathutils.py:110
drive and root returns the root string rather than a boolean (for example, an absolute drive path returns "\\"). That makes is_absolute() type-inconsistent with the pathlib-style API and breaks callers that use is True or otherwise require a boolean; return bool(drive and root) instead.
Review effort: Lite
Sorry, something went wrong.
There was a problem hiding this comment.
Unresolved moderate issues remain in log-directory fallback, empty-variable validation without separators, and UNC-path absolute detection.
No open issues 🎉
1 previously missed issueIn code that hasn't changed since last review
src/manage/config.py:190
Adding TEMP/TMP here does not protect the log path in the reported minimal-environment case: BaseCommand.get_log_file() still calls os.getenv("TMP") or os.getenv("TEMP") or os.getcwd(), so when both variables are absent it writes into the caller's current directory. Please route log-directory resolution through the same fallback environment (or fail rather than choosing the CWD), otherwise this part of #427 remains reproducible.
1 resolved since last reviewReview effort: Lite
Sorry, something went wrong.
|
My other important change needs to build on this, and I don't think this is going to get properly exercised without a beta release (and probably not even without a full release), so I'm merging based on the Copilot reviews being clean (the log path fallback is intentional and won't be changed). |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Makes it a hard failure for environment variables in paths to be empty.
Fixes #427