Open curusarn opened 2 years ago
This is a peculiar edge case, for sure.
I also get a result with Jsonnet when doing this:
➜ jsonnet -J a.jsonnet main.jsonnet
{
"import": {
"x": "this should not work imho"
},
"relative_import": {
"x": "this should not work imho"
}
}
Not sure if bug or feature. :thinking:
Some extra observations:
a.jsonnet
into "tanka root" just for this example. When I discovered the issue the file was nested quite deep in the directory structure. So this issue does not seem to be just "tanka root is added to jsonnetpath"../
into the import path causes the import to fail as expected.Ad. "your example how to replicate this with just jsonnet": It's definitely surprising to me that "jsonnetpath" is used even for relative imports that start with ./
.
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.
not stale
Can still reproduce this with v0.26.0.
Steps to reproduce
We are creating following directory structure:
And these files:
Setup steps
The issue
Evaluate with jsonnet for reference:
You can see that the import fails as expected because the relative path should be
./a.jsonnet
(or equivalent) not./../a.jsonnet
.Evaluate with tanka:
Here we see that something weird is happening when jsonnet is evaluated in tanka. I originally thought that this is caused by paths that are added by Tanka into "jsonnetpath". But when you look above you can see that even relative import
import "./../a.jsonnet"
evaluates without errors. I assumed that the relative import starting with./
is strictly relative to current file but that does not seem to be the case.Let me know if anything is unclear of if you can't reproduce the issue.
Simon Let