unisonweb / unison

A friendly programming language from the future
https://unison-lang.org
Other
5.81k stars 271 forks source link

compile.native does not work with relative file paths with at least one directory #5426

Open fwip opened 4 weeks ago

fwip commented 4 weeks ago

Describe and demonstrate the bug

In UCM, compile.native seems to fail when given a relative path with at least one directory to the output file, e.g:

scratch/main> compile.native main build/main.out

Fails with the following error:

open-output-file: error opening file
  path: /Users/fwip/.cache/unisonlanguage/racket-tmp/build/main.out.rkt
  system error: No such file or directory; errno=2
  context...:
   body of '#%mzc:unison-runtime
raco exe: source file does not exist
  path: /Users/fwip/.cache/unisonlanguage/racket-tmp/build/main.out.rkt

  Sorry, I got an error of type 'failed' when I ran `raco`, and I'm not sure what to do
  about it.

  For debugging purposes, the full command was:

    raco exe -o build/helloworld.out /Users/fwip/.cache/unisonlanguage/racket-tmp/build/main.out.rkt

Compile.native works correctly with absolute paths (/full/path/to/project/build/main.out), and with relative files without directories (main.out). Additionally, compilation to bytecode appears to work in all cases.

Here is a transcript: compile-native-bug.output.md

Environment (please complete the following information):

Additional context This is a papercut-level issue - just wanted to bring it to your attention.