[release/v7.4.16] Fix checks for local user config file paths#27453
[release/v7.4.16] Fix checks for local user config file paths#27453adityapatwardhan wants to merge 1 commit into
Conversation
27652f2 to
18f3098
Compare
There was a problem hiding this comment.
Pull request overview
This PR backports path-resolution hardening for user-local PowerShell configuration/cache/profile locations so missing or unverified special-folder directories do not prevent startup/config loading.
Changes:
- Uses
DoNotVerifywhen deriving Windows special-folder paths and adds safe cache/config path derivation helpers. - Adds guards for empty config/cache/profile/transcript paths.
- Updates cache consumers, telemetry UUID storage, update notifications, and profile optimization to tolerate unavailable local paths.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
src/System.Management.Automation/CoreCLR/CorePsPlatform.cs |
Safely derives Windows cache/config paths and special-folder lookups. |
src/System.Management.Automation/engine/PSConfiguration.cs |
Skips current-user config file reads when no user config path is available. |
src/System.Management.Automation/engine/Modules/AnalysisCache.cs |
Avoids serializing module analysis cache when no cache path is available. |
src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs |
Handles empty transcript base paths. |
src/System.Management.Automation/engine/hostifaces/HostUtilities.cs |
Handles empty profile base paths for current-user and all-user profiles. |
src/System.Management.Automation/engine/CommandDiscovery.cs |
Uses unverified user-profile folder lookup for ~ path expansion. |
src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs |
Disables update cache usage when no cache path can be derived. |
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs |
Skips profile optimization cache setup when cache directory is unavailable. |
src/System.Management.Automation/utils/Telemetry.cs |
Moves telemetry UUID path derivation to the shared cache helper and updates telemetry module metadata. |
| private static readonly HashSet<string> s_knownSubsystemNames; | ||
|
|
daxian-dbw
left a comment
There was a problem hiding this comment.
CIs are failing. It seems the build failed.
|
I checked this against the original PR #26269 and I think this backport picked up an intermediate In Separately, The original PR
So my read is that the CI failures are very likely caused by an incomplete/incorrect backport of |
|
Follow-up: if the goal is the minimal safe fix for
Concretely, I'd expect the branch to need:
That should separate the actual config-path fix from the accidental |
|
I put together a minimal fix branch for the Telemetry.cs backport drift here:
What it changes:
So this reduces Telemetry.cs back to the release/v7.4.16 shape plus only the UUID/cache-path behavior needed for this PR. I couldn't run a full local dotnet build on this machine because there is no .NET SDK installed here, but the file diagnostics are clean and this should address the exact CS1519/CS1022 constructor breakage showing up in CI.
|
|
Going to do a manual backport instead. |
Backport of #26269 to release/v7.4.16
Triggered by @adityapatwardhan on behalf of @SeeminglyScience
Original CL Label: CL-Engine
/cc @PowerShell/powershell-maintainers
Impact
REQUIRED: Choose either Tooling Impact or Customer Impact (or both). At least one checkbox must be selected.
Tooling Impact
Customer Impact
Fixes an issue where configuration file loading could fail when the Documents directory location was not yet created. The fix ensures PowerShell can locate user config files even when their parent directories don't exist yet.
Regression
REQUIRED: Check exactly one box.
This is not a regression.
Testing
Original PR testing included verification that SYSTEM's default config path is properly resolved regardless of whether the Documents directory exists. Uses DoNotVerify option with Environment.GetFolderPath to ensure configured location is returned.
Risk
REQUIRED: Check exactly one box.
This is a targeted fix for config path resolution that improves robustness by ensuring paths are returned regardless of directory existence. The changes are localized to config file path validation logic with no impact to core functionality.