Why is this happening?
The path ./whatever is automatically transformed into an absolute path by cargo due to the relative flag.
The path_bug test checks if exporting to ../somewhere/ works.
The paths are combined into something like /usr/me/../somewhere and passed into the absolute function.
The absolute function, seeing the path starts at the root directory / assumes this is already an absolute path and does nothing
The diff_paths function, not expecting the absolute function to return a path containing . or .., panics
Describe the bug Certain combinations of absolute paths and
..
/.
path components can trick theaboslute
function into doing nothingTo Reproduce
.cargo/config.toml
with the following content:cargo test
Why is this happening? The path
./whatever
is automatically transformed into an absolute path bycargo
due to therelative
flag. Thepath_bug
test checks if exporting to../somewhere/
works. The paths are combined into something like/usr/me/../somewhere
and passed into theabsolute
function. Theabsolute
function, seeing the path starts at the root directory/
assumes this is already an absolute path and does nothing Thediff_paths
function, not expecting theabsolute
function to return a path containing.
or..
, panicsVersion 8.1.0