Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automatic globbing for native commands doesn't work with backtick-escaped spaces #10683

Open
mklement0 opened this issue Oct 2, 2019 · 6 comments

Comments

@mklement0
Copy link
Contributor

commented Oct 2, 2019

When calling external programs (native programs), wildcard patterns that you want automatic globbing applied to (as in Bash, for instance) must be unquoted, i.e. they must neither be enclosed in single quotes nor in double quotes.

Therefore, if you want globbing to be applied to a wildcard pattern that has spaces, for instance, you need to individually escape the space, namely as

However, the automatic globbing mechanism currently doesn't recognize that and doesn't expand such patterns.

Steps to reproduce

On Linux (native globbing is currently fundamentally broken on macOS, and isn't applied on Windows)

Push-Location temp:/
touch 'a b.txt'

/bin/echo a` * | Should -Be 'a b.txt'

Remove-Item 'a b.txt'
Pop-Location

Expected behavior

The test should succeed.

Actual behavior

The test fails, because the pattern is not expanded ('a *' is echoed).

Environment data

PowerShell Core v7.0.0-preview.3 
@iSazonov

This comment has been minimized.

Copy link
Collaborator

commented Oct 7, 2019

Is there a workaround?

@iSazonov iSazonov added the Area-Engine label Oct 7, 2019
@mklement0

This comment has been minimized.

Copy link
Contributor Author

commented Oct 7, 2019

@iSazonov: Not in terms of native globbing, as far as I can tell, but you can do the following:

 /bin/echo (Get-Item 'a *').Name
@iSazonov

This comment has been minimized.

Copy link
Collaborator

commented Oct 7, 2019

It seems a dup #10675.

@mklement0

This comment has been minimized.

Copy link
Contributor Author

commented Oct 7, 2019

It's not a duplicate, because the linked issue relates to resolving PS-drive-based paths to native paths, (which would also apply to Windows), whereas this issue is related to the (Unix-only) native-globbing feature.

@iSazonov

This comment has been minimized.

Copy link
Collaborator

commented Oct 8, 2019

Really the resolving is executed by the same LocalGlobbig code. So technically it is one issue.

@mklement0

This comment has been minimized.

Copy link
Contributor Author

commented Oct 8, 2019

I see: it happens to be technically related rather than a duplicate.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.