uutils / uutils/coreutils

Argument globbing (expansion) on Windows causes arguments intended as patterns to be prematurely expanded

Open
#3,985 7 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

wontfix
Dominant language
Rust
Stars
24.1k
Forks
2k
Avg merge
1d 5h
Merged PRs (30d)
365

Description

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 and regular.yml are listed, because filename matching in ls requires explicit .s for hidden files.

On windows, the ?hidden.yml is expanded by wild::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: https://github.com/uutils/coreutils/pull/3803

The premature globbing causes problems in some cases. We should investigate how the globbing can be refactored.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the test_ls_ignore_explicit_period case and trace how Windows arguments reach wild::args(). Determine how the --ignore pattern should remain unexpanded, then verify that the test lists both .hidden.yml and regular.yml on Windows without regressing other argument globbing behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.