find on Windows: opt in to / as the path separator
Maintainers usually reply within 1 day
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 15/100
Research direction
A pull request (#907) is already open for this, so read it before anything else. The proposal reads the UUTILS_PATH_SEPARATOR variable on Windows only, next to UUTILS_DIAG, and affects path output in printing, -path/-regex, -printf and -exec. The docs go in docs/src/extensions.md. The name and shape are still open for maintainer decision, and the existing tests assert native separators through fix_up_slashes.
Written by the indexing model from the issue text.
Description
On Windows, find joins the paths it walks with \, so output mixes separators with whatever the start point used, and -path/-prune patterns written with / match nothing:
PS> find tree -not -path '*/.*'
tree
tree\.hidden
tree\.hidden\secret.txt
...
PS> find test_data/depth/1 -name f2
test_data/depth/1\2\f2
This is the expected native behavior (the tests assert it through fix_up_slashes), so I am not proposing to change the default. But MSYS2, Cygwin and Git Bash users, scripts written for POSIX shells, and tools that drive find from another program (our case: an agent shell whose paths are all /) need /. The same request exists for ls in uutils/coreutils#12742 and microsoft/coreutils#107, and ripgrep answers it with --path-separator.
Proposal: an environment variable, UUTILS_PATH_SEPARATOR=/, read only on Windows, in the same family as UUTILS_DIAG. With it set, every path a walk produces uses /: printing, -path/-wholename/-regex, -printf %p/%h/%P, and -exec {}. Any other value, or none, changes nothing. It should also accept slash: Git Bash and MSYS2 rewrite an environment value of a bare / into their install folder (C:/Program Files/Git/) before a native program sees it. A GNU-style option would collide with GNU's option space, which is why I lean to the variable. The same variable would serve uutils grep (uutils/grep, PR ready) and later ls.
I have a PR ready (about 40 lines plus tests and a section in docs/src/extensions.md), green on the Windows CI legs in my fork. Happy to change the name or the shape before opening it.
- Dominant language
- Rust
- Stars
- 651
- Forks
- 111
- Avg merge
- 1d 13h
- Merged PRs (30d)
- 21
Getting set up
- No Dockerfile or Docker Compose file
- No pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from uutils/findutils
-
-printf %m and -ls drop setuid/setgid/sticky bits and the file typePossibly taken A pull request linked to this issue is open or already merged. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
uutils/findutils#692 · 1 comment ·
Maintainers usually reply within 1 day
-
xargs: -x runs a pending command before rejecting an oversized argumentPossibly taken @SichenLiang claimed this 6 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 28/100
Maintainers usually reply within 1 day
-
find: -ls shows the time instead of the year for old filesPossibly taken @SichenLiang claimed this 5 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 32/100
Maintainers usually reply within 1 day
-
xargs: empty items are dropped with -0 and -dPossibly taken @SichenLiang claimed this 16 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 68/100
Maintainers usually reply within 1 day
All issues in uutils/findutils
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
swc-project/swc#12576 ·
Maintainers usually reply within 1 day
-
good first issue gpu serve
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
biomejs/biome#12475 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 80/100
Maintainers usually reply within 1 day