idris-lang / Idris2

A purely functional programming language with first class types
https://idris-lang.org/
Other
2.46k stars 369 forks source link

Chez backend is too naive on the value of `CHEZ` environment variable #3295

Open buzden opened 4 weeks ago

buzden commented 4 weeks ago

Steps to Reproduce

Set CHEZ environment variable to something that does not start with a slash (/) and compile an application.

Expected Behavior

Either successsfull compilation or nice error about not correct value of the CHEZ env variable

Observed Behavior

Failure during compilation of executable

Now compiling executable <whatever>
Exception in read: invalid syntax #!<value-of-CHEZ-var> at line 1, char 1 of /..../<whatever>.ss

Discussion

Variable CHEZ allows us to say which chez executable is to use in the shebang during the compilation. But its value is used blindly, thus when the value (usually by a mistake) does not start with a slash sign, it is interpreted as a pragma syntax in chez (pragmas in chez also start with #!).

Maybe, we should check at least that value of the CHEZ variable starts with slash, or maybe even that the file exists (but we must be aware of whiltespaces there, which are allowed, strictly speaking).