Skip to content

dirOf "regression" in 2.23 #14513

@xokdvium

Description

@xokdvium

Describe the bug

The behavior of builtins.dirOf got silently changed in 2.23.

Steps To Reproduce

nix run github:nixos/nix/2.22-maintenance -- eval --expr 'builtins.dirOf "a///b"'
"a//"
nix run github:nixos/nix/2.23-maintenance -- eval --expr 'builtins.dirOf "a///b"'
"a"

It's pretty clear that the >=2.23 behaviour is more "correct" but we don't have the luxury of breaking bug-for-bug compatibility in stable interfaces. Also I think this got changed silently rather than intentionally, because the reason this works like this now is because dirOf started delegating to std::filesystem for this, but since the evaluator must always follow the CanonPath semantics of UNIX paths this isn't correct.

Expected behavior

Bug-for-bug compat is retained. This behavior has existed since forever and should be restored.

Metadata

Not applicable.

Additional context

Checklist


Add 👍 to issues you find important.

Metadata

Metadata

Assignees

No one assigned

    Labels

    buglanguageThe Nix expression language; parser, interpreter, primops, evaluation, etcregressionSomething doesn't work anymore

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions