Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[release/v7.5.7] Fix checks for local user config file paths#27459

Merged
adityapatwardhan merged 2 commits into
PowerShell:release/v7.5.7PowerShell/PowerShell:release/v7.5.7from
adityapatwardhan:backport/release/v7.5.7/26269-c7ee0d294adityapatwardhan/PowerShell:backport/release/v7.5.7/26269-c7ee0d294Copy head branch name to clipboard
May 18, 2026
Merged

[release/v7.5.7] Fix checks for local user config file paths#27459
adityapatwardhan merged 2 commits into
PowerShell:release/v7.5.7PowerShell/PowerShell:release/v7.5.7from
adityapatwardhan:backport/release/v7.5.7/26269-c7ee0d294adityapatwardhan/PowerShell:backport/release/v7.5.7/26269-c7ee0d294Copy head branch name to clipboard

Conversation

@adityapatwardhan

Copy link
Copy Markdown
Member

Backport of #26269 to release/v7.5.7

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

  • Required tooling change
  • Optional tooling change (include reasoning)

Customer Impact

  • Customer reported
  • Found internally

Fixes user configuration path handling so SYSTEM uses the expected default config location and skips user config loading when the configured Documents folder resolves to an empty/whitespace path.

Regression

REQUIRED: Check exactly one box.

  • Yes
  • No

This is not a regression.

Testing

Cherry-pick completed onto release/v7.5.7 and conflict resolution preserved release-specific telemetry module lists while applying the config-path fix logic. The changed files match the original PR scope and the backport commit applied cleanly after resolving one conflict in Telemetry.cs.

Risk

REQUIRED: Check exactly one box.

  • High
  • Medium
  • Low

Change is scoped to path derivation and guard logic for user config locations. The backport keeps existing release branch behavior outside this targeted fix, minimizing regression surface.

Merge Conflicts

Resolved one conflict in src/System.Management.Automation/utils/Telemetry.cs by preserving release/v7.5.7 content and applying the intended CanSendTelemetry/telemetry.uuid path derivation update from PR #26269.

Copilot AI review requested due to automatic review settings May 17, 2026 17:17
@adityapatwardhan adityapatwardhan added the CL-Engine Indicates that a PR should be marked as an engine change in the Change Log label May 17, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This backport updates user-local path derivation and guard logic so PowerShell avoids using invalid local config/cache locations when special folders are unavailable.

Changes:

  • Uses DoNotVerify for Windows special-folder path lookup and adds safer cache/config path derivation.
  • Skips telemetry, update notification cache, module analysis cache, profile optimization, and config reads when cache/config paths are unavailable.
  • Adds guards around profile and transcript path generation for empty user path scenarios.

Reviewed changes

Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
src/System.Management.Automation/CoreCLR/CorePsPlatform.cs Adds safe special-folder derivation and cache path helper methods.
src/System.Management.Automation/engine/PSConfiguration.cs Skips current-user config file reads when no user config path exists.
src/System.Management.Automation/engine/Modules/AnalysisCache.cs Avoids module cache serialization when no cache path is available.
src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs Adds a transcript path guard for unavailable base directories.
src/System.Management.Automation/engine/hostifaces/HostUtilities.cs Applies empty base-path handling to both current-user and all-users profiles.
src/System.Management.Automation/engine/CommandDiscovery.cs Uses DoNotVerify when expanding ~ in PATH lookup entries.
src/System.Management.Automation/utils/Telemetry.cs Disables telemetry when the UUID cache path cannot be derived.
src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs Derives update notification cache path through the new cache helper.
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs Skips profile optimization setup when no cache directory is available.

Comment on lines +92 to +95
if (!string.IsNullOrEmpty(perUserConfigDirectory))
{
perUserConfigFile = Path.Combine(perUserConfigDirectory, ConfigFileName);
}
Comment on lines +1159 to +1162
if (string.IsNullOrEmpty(baseDirectory))
{
return string.Empty;
}
@adityapatwardhan adityapatwardhan merged commit d94e211 into PowerShell:release/v7.5.7 May 18, 2026
35 checks passed
@adityapatwardhan adityapatwardhan deleted the backport/release/v7.5.7/26269-c7ee0d294 branch May 18, 2026 17:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-Engine Indicates that a PR should be marked as an engine change in the Change Log

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.