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

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

Merged
adityapatwardhan merged 1 commit into
release/v7.5.7PowerShell/PowerShell:release/v7.5.7from
revert-27459-backport/release/v7.5.7/26269-c7ee0d294PowerShell/PowerShell:revert-27459-backport/release/v7.5.7/26269-c7ee0d294Copy head branch name to clipboard
May 19, 2026
Merged

Revert "[release/v7.5.7] Fix checks for local user config file paths"#27476
adityapatwardhan merged 1 commit into
release/v7.5.7PowerShell/PowerShell:release/v7.5.7from
revert-27459-backport/release/v7.5.7/26269-c7ee0d294PowerShell/PowerShell:revert-27459-backport/release/v7.5.7/26269-c7ee0d294Copy head branch name to clipboard

Conversation

@adityapatwardhan

Copy link
Copy Markdown
Member

Reverts #27459

Copilot AI review requested due to automatic review settings May 19, 2026 01:06
@adityapatwardhan adityapatwardhan added the CL-NotInBuild Indicates that a PR is reverted and not part of the build. label May 19, 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 PR reverts the earlier change that added extra validation around deriving per-user config/cache paths, restoring prior behavior in several core engine and host components (telemetry, update notifications, module analysis cache, profile/config path derivation, and ~ expansion in PATH processing).

Changes:

  • Removes “derive from cache” gating and several string.IsNullOrEmpty(...) guards, allowing code paths to proceed even when cache/config directories can’t be resolved.
  • Reverts Windows folder derivation behavior by removing SpecialFolderOption.DoNotVerify usage and helper methods in CorePsPlatform.
  • Reverts ~/~/... PATH expansion to use default Environment.GetFolderPath(...) semantics.

Reviewed changes

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

Show a summary per file
File Description
src/System.Management.Automation/utils/Telemetry.cs Stops gating telemetry enablement on successfully deriving a cache path.
src/System.Management.Automation/engine/PSConfiguration.cs Removes empty-checks when deriving the per-user config file path and reading from it.
src/System.Management.Automation/engine/Modules/AnalysisCache.cs Derives module analysis cache file location directly from Platform.CacheDirectory.
src/System.Management.Automation/engine/hostifaces/MshHostUserInterface.cs Removes an early return when transcript base directory is empty.
src/System.Management.Automation/engine/hostifaces/HostUtilities.cs Changes when/where empty base-path checks apply for profile paths.
src/System.Management.Automation/engine/CommandDiscovery.cs Reverts ~ expansion to use Environment.GetFolderPath(UserProfile) without DoNotVerify.
src/System.Management.Automation/CoreCLR/CorePsPlatform.cs Reverts cache/config directory derivation and removes TryDeriveFromCache + safe folder derivation helpers.
src/Microsoft.PowerShell.ConsoleHost/host/msh/UpdatesNotification.cs Removes cache-derivation gating for enabling update notifications; derives cache directory directly.
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleHost.cs Adjusts profile optimization directory creation behavior for cache directory.

Comment on lines +211 to 216
if (string.IsNullOrEmpty(basePath))
{
return string.Empty;
}
}

Comment on lines 89 to 93
// Note: This directory may or may not exist depending upon the execution scenario.
// Writes will attempt to create the directory if it does not already exist.
perUserConfigDirectory = Platform.ConfigDirectory;
if (!string.IsNullOrEmpty(perUserConfigDirectory))
{
perUserConfigFile = Path.Combine(perUserConfigDirectory, ConfigFileName);
}
perUserConfigFile = Path.Combine(perUserConfigDirectory, ConfigFileName);

Comment on lines 1219 to 1222
if (tempDir.EqualsOrdinalIgnoreCase("~"))
{
tempDir = Environment.GetFolderPath(
Environment.SpecialFolder.UserProfile,
Environment.SpecialFolderOption.DoNotVerify);
tempDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
}
Comment on lines 1223 to 1226
else if (tempDir.StartsWith("~" + Path.DirectorySeparatorChar))
{
tempDir = Environment.GetFolderPath(
Environment.SpecialFolder.UserProfile,
Environment.SpecialFolderOption.DoNotVerify)
+ Path.DirectorySeparatorChar
+ tempDir.Substring(2);
tempDir = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile) + Path.DirectorySeparatorChar + tempDir.Substring(2);
}
Comment on lines +170 to 172
internal static readonly string CacheDirectory = Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData) + @"\Microsoft\PowerShell";
internal static readonly string ConfigDirectory = Environment.GetFolderPath(Environment.SpecialFolder.Personal) + @"\PowerShell";

};
#else
return Environment.GetFolderPath(folder, Environment.SpecialFolderOption.DoNotVerify);
return Environment.GetFolderPath(folder);
Comment on lines +63 to +68
CanNotifyUpdates = s_notificationType != NotificationType.Off;

if (CanNotifyUpdates)
{
s_enumOptions = new EnumerationOptions();
s_cacheDirectory = Path.Combine(Platform.CacheDirectory, PSVersionInfo.GitCommitId);
@adityapatwardhan adityapatwardhan merged commit 3122d06 into release/v7.5.7 May 19, 2026
40 of 41 checks passed
@adityapatwardhan adityapatwardhan deleted the revert-27459-backport/release/v7.5.7/26269-c7ee0d294 branch May 19, 2026 15:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CL-NotInBuild Indicates that a PR is reverted and not part of the build.

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.