Skip to content

Ignore trailing separators when deriving path basenames #592

Closed

Description

@LunaStev

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.

Activity

  1. added
    bug
    good first issue
    cross-platform
    on Sep 12, 2026
  2. self-assigned this
    on Sep 24, 2026
  3. added a commit that references this issue on Sep 24, 2026
    01955d7
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugcross-platformgood first issue

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions