Skip to content

Fix reading file with a path relative to HOME#224

Merged
Nadrieril merged 6 commits intomasterfrom
fix-home-import
Dec 7, 2021
Merged

Fix reading file with a path relative to HOME#224
Nadrieril merged 6 commits intomasterfrom
fix-home-import

Conversation

@basile-henry
Copy link
Copy Markdown
Collaborator

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
Copy link
Copy Markdown
Owner

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
Copy link
Copy Markdown
Owner

Looks perfect!

@Nadrieril Nadrieril merged commit 826b2fd into master Dec 7, 2021
@padhia
Copy link
Copy Markdown

padhia commented Dec 22, 2021

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 Nadrieril deleted the fix-home-import branch January 1, 2022 15:10
@Nadrieril
Copy link
Copy Markdown
Owner

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

@padhia
Copy link
Copy Markdown

padhia commented Jan 1, 2022

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

home-anchored imports don't work

3 participants