Repository navigation
Closed
Closed
Copy link
Labels
Issue-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 aWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Description
Steps to reproduce
PS> cmd /c echo ":(top,exclude).*"Expected behavior
:(top,exclude).*
Actual behavior
C:\Users\duhowett\src\openconsole-inbox\:(top,exclude).*
Environment data
Name Value
---- -----
PSVersion 7.1.0-preview.7
PSEdition Core
GitCommitId 7.1.0-preview.7
OS Microsoft Windows 10.0.19042
Platform Win32NT
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
It appears as though the check here
PowerShell/src/System.Management.Automation/engine/NativeCommandParameterBinder.cs
Lines 388 to 406 in 3effa20
| if (path.Contains(':')) | |
| { | |
| LocationGlobber globber = new LocationGlobber(context.SessionState); | |
| try | |
| { | |
| ProviderInfo providerInfo; | |
| // replace the argument with resolved path if it's a filesystem path | |
| string pspath = globber.GetProviderPath(path, out providerInfo); | |
| if (string.Equals(providerInfo.Name, FileSystemProvider.ProviderName, StringComparison.OrdinalIgnoreCase)) | |
| { | |
| path = pspath; | |
| } | |
| } | |
| catch | |
| { | |
| // if it's not a provider path, do nothing | |
| } | |
| } |
is not strict enough.
I encountered this by trying to use a git globbing expression, which can begin with : to introduce a set of flags.
PS> & git log ":(top,exclude).git/" ":(top,exclude)**/*.rec"
fatal: invalid object name 'C'.Reacted by Michael Klement
Metadata
Metadata
Assignees
Labels
Issue-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 aWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Activity
DHowett commentedon Sep 15, 2020
(This broke an existing script that we were using to generate git logs.)
DHowett commentedon Sep 15, 2020
(We cannot figure out how to get
:xto behave normally.)mklement0 commentedon Sep 15, 2020
mklement0 commentedon Sep 15, 2020
As for the root cause: please see #13640 - I suggest you close this issue in favor of the latter.
[Edit: I missed that you've commendably already done all the hard analysis work, but the linked issue may still be a more succinct formulation, complete with tests.]
Another workaround (apart from using
--%) on Windows is to use'...'rather than"..."quoting, though the fact that this works is arguably a separate bug: