Mkpath behaves differently on Julia 1.12-rc1

Julia 1.11:

cd(mktempdir())
mkpath("uwe/")

Output: "uwe"

Julia 1.12-rc1:

cd(mktempdir())
mkpath("uwe/")

Output: "uwe/"

This difference causes my unit tests to fail.

Is this a bug, or just undefined behaviour?

This is on Ubuntu Linux.

If you care about your mental sanity, you should really not rely on the trailing path separator being there, you should always get rid of it before doing anything else with that path. See [Breaking] Make `basename` and `dirname` ignore a trailing path separator ยท Issue #43137 ยท JuliaLang/julia ยท GitHub as an example where the trailing separator causes different behaviour.

2 Likes

In principle, I agree. But I still do not know if I should report that as bug in the Julia repo.

That seems to be a deliberate change:

The linked issue specifically talks about the case of directories ending with path separator. The handling of the trailing path separator is maddening.

1 Like

I created an issue: