elm-repl
elm-repl copied to clipboard
elm-repl fails in directories inside a smbfs mount
If I change into a directory inside a smbfs mount, elm repl doesn't work properly.
$ elm repl
---- elm repl 0.16.0 -----------------------------------------------------------
:help for help, :exit to exit, more at <https://github.com/elm-lang/elm-repl>
--------------------------------------------------------------------------------
> 1+1
elm-repl: repl-temp-000.elm: openFile: does not exist (No such file or directory)
Couldn't the file repl-temp-000.elm
be created in /tmp
or ~
instead?
I’m facing a similar problem: elm-repl: repl-temp-000.elm: openFile: permission denied (Permission denied)
. If the file can’t be created elsewhere, then at least a helpful error message would be cool.
👍
Permissions issue.
When I installed the Elm-Platform-0.17.1.pkg , it asked for my admin password and installed the elm apps in /usr/local/bin/ owned by user "root" with group "wheel". Everything else I run is user "my username" group "admin". I changed everything in that directory that started with 'elm' to those my permissions, and restarting iTerm2, it worked.
I found this directory by running which elm-repl
@Benxamin I changed everything in that directory that started with 'elm' to those my permissions, and restarting iTerm2, it worked.
Hmmm... downgrading the security/sanity of the installation (i.e. changing the ownership of a globally installed package to those of a particular user) so that things work does not sound like the correct way to go about things.
elm-repl
wants to create working files in the "current working directory" (of the shell that started elm-repl
). If that directory is not writeable by the current user, then it bails.
This can be seen by attaching strace
to the elm-repl
process (strace -p <pid>
), then executing 1 / 2
for example.
The system call failure to write a temporary file
openat(AT_FDCWD, "repl-temp-000.elm", O_WRONLY|O_CREAT|O_NOCTTY|O_NONBLOCK, 0666) = -1 EACCES (Permission denied)
is seen if one is in a non-writeable directory (ouch). AT_FDCWD
means "create file in current working directory".
So you have to run a script that creates a working directory; cds to it, then launches elm-repl
, something like:
D=elm-repl-tmp; cd ~ ; [[ -d $D ]] || mkdir $D ; cd $D ; elm-repl
The above creates elm-repl-tmp
in your home directory and starts elm-repl
in there. The directory is immediately filled with 1.7 MiB of stuff.
elm-repl
should really deal with this and create a user-specific working directory all by itself, something by default underneath /tmp/$(whoami)
and accessible to the current user only for example, or else allow defining the working directory on the command line, or both.
(elm-repl 0.18.0 on node v9.11.1 here, on Linux Fedora 27, btw.)