Thanks to visit codestin.com
Credit goes to github.com

Skip to content

dirname handles paths ending in /. differently from GNU coreutils #10508

@jfmc

Description

@jfmc

This bug completely breaks https://github.com/ciao-lang/ciao installation on Ubuntu 25.10.

The Rust implementation of dirname is giving different output than GNU coreutils for paths that end with /.

What I'm seeing

On GNU coreutils:

$ dirname "a/b/."
a/b

On rust coreutils (Ubuntu 25.10):

$ dirname "a/b/."
a

It works on Ubuntu 25.05 and macOS but breaks on Ubuntu 25.10 because of this dirname behavior difference.

According to POSIX, dirname should "remove the suffix from the last '/' to the end of string". For a/b/., the last / is between b and ., so removing everything after that should give you a/b.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions