rust-lang / rust-lang/glob

glob() should take a Path not str

Open
#78 6 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Rust
Stars
595
Forks
93
PR merge metrics
No merged PRs in 30d

Description

Paths on UNIX are bytes, not unicode. Using str means that all of them can't be represented.

In particular, on systems set with a different locale, or when using disks that were created in a different locale, or simply because of some glitch somewhere, files using non-UTF-8 byte sequence can totally exist.

Not only is it not that much of a corner-case, but the standard library already dealt with that by providing the Path type. AsRef<Path> can also be used to allow users to still pass in string slices and string literals.

Related to #23 which is not about the interface but a bug in the internals.

Contributor guide

No contributing guide indexed for this repository

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 by inspecting the glob() public API and its handling of path arguments, then review how Path and AsRef are used in the crate. Check existing tests for string inputs and add coverage for non-UTF-8 paths; done means the API accepts Path values while preserving supported string inputs.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
operating-systems
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
38/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.