-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Closed
Closed
Copy link
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtimeWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.
Description
I found this issue while trying to take on #13089 myself. It's a minor headache to be unable to glob stuff with escapes and embedded spaces. This is not a limitation in POSIX shell, nor is it one in the original glob(3) language.
Steps to reproduce
# prepare
$a = mktemp -d
cd $a
mkdir "A B"
# test
/bin/echo "A "*
/bin/echo *' B'
/bin/echo *` B
# ast poke sans globbing
Write-Output "A "*
Write-Output *' B'Expected behavior
A B
A B
A B
(pwsh stuff)
(pwsh stuff)
Actual behavior
A A B
* B
* B
A
*
* B
Environment data
Name Value
---- -----
PSVersion 7.0.2
PSEdition Core
GitCommitId 7.0.2
OS Darwin 19.5.0 Darwin Kernel Version 19.5.0: Tue…
Platform Unix
PSCompatibleVersions {1.0, 2.0, 3.0, 4.0…}
PSRemotingProtocolVersion 2.3
SerializationVersion 1.1.0.1
WSManStackVersion 3.0
How did this happen?
Test case (4) indicates that the parser sees two string literals glued together as two distinct "words". This could be improved without breakings stuff by just making a cmdlet for globbing a mixture of quoted (to be escaped) and bare (to be put into the pattern raw) character runs.
Test case (3) indicates that the heuristic in NativeCommandParameterBinder::AppendOneNativeArgument is inadequate. Even when fed a valid glob, it sees the space in the string and decides that it is non-globbable from that. Bad idea.
Metadata
Metadata
Assignees
Labels
Issue-Enhancementthe issue is more of a feature request than a bugthe issue is more of a feature request than a bugResolution-No ActivityIssue has had no activity for 6 months or moreIssue has had no activity for 6 months or moreWG-Enginecore PowerShell engine, interpreter, and runtimecore PowerShell engine, interpreter, and runtimeWG-Engine-Providersbuilt-in PowerShell providers such as FileSystem, Certificates, Registry, etc.built-in PowerShell providers such as FileSystem, Certificates, Registry, etc.