-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Argument globbing (expansion) on Windows causes arguments intended as patterns to be prematurely expanded #3985
Comments
This is mostly an issue with testing I believe. In both unix and windows, the expansion happens, but for one it happens in the shell and for the other in the util. Hence, it only happens in the tests for windows. So if we can disable it when calling it from the test suite, I think we're good. Apart from the tests, we could look into using an env var or something to control the expansion. |
We don't want the expansion for all arguments. For one, when the argument passed is meant to be a pattern, the expansion of the pattern messes up the user's intention. I believe the expansion happens outside of tests too. |
But the same happens on unix shells, doesn't it? The shell doesn't have any idea about what an argument is for and whether to apply the expansion.
It does, I'm not questioning that. But in my opinion, there's only a problem when it comes to testing. In normal use, the expansion is expected behavior. |
It does happen on unix shells, but that expansion can be controlled by escaping, so a user could do By applying expansion through |
Quoting also stops the expansion in |
I verified that the expansion is excluded when quotes are applied: (I hacked
With
|
In
ls
for example, the--ignore
flag expects a pattern.In windows, these flags are prematurely expanded, so patterns become actual files, which are then ignored when they should not be.
For example, in
test_ls_ignore_explicit_period
, two files are created:.hidden.yml
regular.yml
When this command is executed:
ls -a --ignore ?hidden.yml
, the desired outcome is that both.hidden.yml
andregular.yml
are listed, because filename matching inls
requires explicit.
s for hidden files.On windows, the
?hidden.yml
is expanded bywild::args()
to.hidden.yml
. When matching, the new argument.hidden.yml
is a perfect match, and has a leading.
, which causes it to be hidden (not the expected output)More details here: #3803
The premature globbing causes problems in some cases. We should investigate how the globbing can be refactored.
The text was updated successfully, but these errors were encountered: