-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.Waiting - DotNetCorewaiting on a fix/change in .NETwaiting on a fix/change in .NET
Description
Note: The problem:
-
affects only files, not also directories
-
for file paths, affects all path components.
Simple demonstration (macOS and Windows):
PS> (Get-Item $PSHOME/POWERSHELL.config.json).Name
POWERSHELL.config.jsonNote how POWERSHELL.config.json was reported via .Name - exactly as specified - even though the actual casing of the filename is powershell.config.json
Steps to reproduce
Windows and macOS only (platforms with case-insensitive (but case-preserving) file-systems).
# Note: The problem occurs only with *files*, not directories.
# With files, the problem occurs in all path components.
Describe "Get-Item / Get-ChildItem: non-wildcard file-name case fidelity test" {
BeforeAll {
Push-Location (Get-Item testdrive:/).FullName
$nameActual = 'AB'
$nameCaseVariant = 'aB'
New-Item $nameActual # create as all-uppercase
$testCases =
@{ Cmdlet = 'Get-Item'; Parameter = 'Path'; Property = 'Name' },
@{ Cmdlet = 'Get-Item'; Parameter = 'Path'; Property = 'FullName' },
@{ Cmdlet = 'Get-Item'; Parameter = 'LiteralPath'; Property = 'Name' },
@{ Cmdlet = 'Get-Item'; Parameter = 'LiteralPath'; Property = 'FullName' },
@{ Cmdlet = 'Get-ChildItem'; Parameter = 'Path'; Property = 'Name' },
@{ Cmdlet = 'Get-ChildItem'; Parameter = 'Path'; Property = 'FullName' },
@{ Cmdlet = 'Get-ChildItem'; Parameter = 'LiteralPath'; Property = 'Name' },
@{ Cmdlet = 'Get-ChildItem'; Parameter = 'LiteralPath'; Property = 'FullName' }
}
It "<Cmdlet>: .<Property> should report '$nameActual' as the file name when literal case variant '$nameCaseVariant' is passed to <Parameter>" -Skip:$IsLinux -TestCase $testCases {
param($Cmdlet, $Parameter, $Property)
$htArgs = @{ $Parameter = $nameCaseVariant }
Split-Path -Leaf (& $Cmdlet @htArgs).$Property | Should -BeExactly $nameActual
}
AfterAll {
Pop-Location
}
}Expected behavior
The tests should succeed.
Actual behavior
All tests fail.
Environment data
PowerShell Core 7.1.0-preview.5
Metadata
Metadata
Assignees
Labels
Area-FileSystem-Providerspecific to the FileSystem providerspecific to the FileSystem providerIssue-Questionideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aideally support can be provided via other mechanisms, but sometimes folks do open an issue to get aResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Cmdlets-Managementcmdlets in the Microsoft.PowerShell.Management modulecmdlets in the Microsoft.PowerShell.Management moduleWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.Waiting - DotNetCorewaiting on a fix/change in .NETwaiting on a fix/change in .NET