Nadrieril / dhall-rust

Maintainable configuration files, for Rust users
Other
303 stars 27 forks source link

Fix reading file with a path relative to HOME #224

Closed basile-henry closed 2 years ago

basile-henry commented 2 years ago

Fixes #223

We need to actually resolve the ~ in the path, this is not something supported by the std::fs::File API.

It looks like dhall-haskell does this as well: https://github.com/dhall-lang/dhall-haskell/blob/14ae4296874fa9bdd4b585f0ef82d43cff36b091/dhall/src/Dhall/Import.hs#L475-L477

Maybe we should add some tests to cover this? At the moment all import tests are relative, doing otherwise in the dhall-lang repo would be tricky as it would rely on knowing where the file are located. But we should be able to do the following in this test suite: for all import tests, parse and convert imports to absolute imports and to relative to home imports, serialize and then test that.

Nadrieril commented 2 years ago

Looks good, but you're right we need tests. We should set "$HOME" to point to dhall/tests in the test harness and then try to import things.

Nadrieril commented 2 years ago

Looks perfect!

padhia commented 2 years ago

Sorry if I am being too impatient, but are you able to share an approximate timeline of the next release that includes this fix?

PS: my interest in having this fix rolled out is due to s-zeng/dhall-python#41

Nadrieril commented 2 years ago

@padhia oh yeah don't hesistate to ask! Here you go, v0.11.0 is out

padhia commented 2 years ago

Thank you!