Ignore trailing separators when deriving path basenames
- Dominant language
- Rust
- Stars
- 53
- Forks
- 16
- Avg merge
- 4h 22m
- Merged PRs (30d)
- 46
Description
`path_basename_start` updates the basename start after every path separator and does not skip separators at the end of a path.
As a result, paths ending in one or more separators produce an empty basename even when a final path component exists before them.
For example, the current source-derived behavior is equivalent to:
- `dir/` → empty basename
- `/usr/bin/` → empty basename
- `/usr/bin///` → empty basename
`path_dirname_copy` already provides component-oriented path behavior, so basename handling should not lose the final non-separator component merely because the path contains trailing separators.
Code evidence:
- `std/path/analyze.wave` — `path_basename_start`, `path_basename_len`
- `std/path/copy.wave` — `path_basename_copy`
Acceptance:
- [ ] Ignore trailing path separators when locating a non-root basename.
- [ ] Add cases for `dir/`, `/usr/bin/`, and repeated trailing separators.
- [ ] Define and preserve explicit behavior for root-only paths such as `/`.
- [ ] Keep both `/` and `\\` separator behavior covered.
- [ ] Do not regress paths without trailing separators.
Contributor guide
Research direction
Start by reading path_basename_start and path_basename_len in std/path/analyze.wave, then compare their behavior with path_basename_copy in std/path/copy.wave. Add regression cases for dir/, /usr/bin/, repeated trailing separators, both slash types, root-only paths, and paths without trailing separators. Done means trailing separators are ignored for non-root basenames while root behavior remains explicit and unchanged.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- compilers
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Active
- Clarity
- Clearly specified
- Newbie friendliness
- 74/100