catala icon indicating copy to clipboard operation
catala copied to clipboard

clerk behavior differs when using absolute or relative paths?

Open rprimet opened this issue 1 year ago • 1 comments

Hi,

Not sure whether it's a bug, just a behavior that I would like more context on and possibly a discussion? : running clerk run with a file yields a different behavior when the target file path is absolute or relative.

For instance, in catala-language-server:

(absolute path)

romain@enclume:~/inria/cat_root/catala-language-server$ clerk run /home/romain/inria/cat_root/catala-language-server/test-case-parser/examples/test_case_arith.catala_en --scope B_test
ninja: error: /tmp/clerk_build_ca1757.ninja:133: unknown target '/home/romain/inria/cat_root/catala-language-server/test-case-parser/examples/test_case_arith.catala_en@interpret'

(relative path)

romain@enclume:~/inria/cat_root/catala-language-server$ clerk run test-case-parser/examples/test_case_arith.catala_en --scope B_test
[5/6] <catala> interpret B_test ⇐ _b...ser/examples/test_case_arith.catala_en
┌─[RESULT]─
│ a = Arith.A { -- w: -4 -- x: 2 -- y: 2 -- z: 4,990.0 }

(if that matters, the clerk.toml file is in the examples direcory in this instance)

rprimet avatar Sep 23 '24 06:09 rprimet

This is indeed a limitation of Ninja: the "key" identifying a target is a specific PATH, without resolution of the underlying file of any kind. I admit it's a sane default though.

What we could attempt to do is some resolution of file names specified on the command-line before we call Ninja from Clerk, though.

AltGr avatar Sep 24 '24 13:09 AltGr

TODO Doc : clerk paths in the CLI should always be relative.

denismerigoux avatar Oct 29 '24 14:10 denismerigoux